实物兑换需求
This commit is contained in:
parent
ba71370c35
commit
e8a7b6558c
|
@ -20,12 +20,16 @@ const config = {
|
|||
// pagesInclude: ['ynyc/index.vue'],
|
||||
// 广州移动
|
||||
// pagesInclude: ['gzyd/login.vue'],
|
||||
<<<<<<< HEAD
|
||||
pagesInclude: ['physical/address.vue', 'physical/createAddress.vue'],
|
||||
// pagesInclude: ['physical/createAddress.vue'],
|
||||
=======
|
||||
pagesInclude: ['gzyd/index.vue'],
|
||||
>>>>>>> 964dde74b2f18de014a39db01294f7e0d62fd7cc
|
||||
// 实物需求
|
||||
// pagesInclude: ['physical/login.vue'],
|
||||
// pagesInclude: ['physical/index.vue'],
|
||||
// pagesInclude: ['physical/orderDetail.vue'],
|
||||
pagesInclude: [
|
||||
'physical/coupon.vue',
|
||||
'physical/redeem.vue',
|
||||
'physical/address.vue',
|
||||
'physical/createAddress.vue',
|
||||
],
|
||||
}
|
||||
|
||||
export function getPages() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!doctype html>
|
||||
<html build-date="2024-10-31 11:39:36">
|
||||
<html build-date="2024-11-04 16:53:16">
|
||||
<head>
|
||||
<link rel="stylesheet" href="./assets/uni.41f11072.css">
|
||||
<link rel="stylesheet" href="./assets/uni.4467a1ca.css">
|
||||
|
||||
<meta charset="UTF-8" />
|
||||
<!-- <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> -->
|
||||
|
@ -19,16 +19,16 @@
|
|||
<title>场景营销</title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
<script type="module" crossorigin src="./assets/index-D7EPZQLI.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-BjkUA-Pa.css">
|
||||
<script type="module" crossorigin src="./assets/index-C7RRrZOE.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-DClsoP6h.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<!-- <script src="https://fastly.jsdelivr.net/npm/eruda"></script>
|
||||
<script src="https://fastly.jsdelivr.net/npm/eruda"></script>
|
||||
<script>
|
||||
eruda.init()
|
||||
</script> -->
|
||||
</script>
|
||||
<script>
|
||||
// var clickCount = 0
|
||||
// var timer = null
|
||||
|
|
|
@ -5,7 +5,7 @@ VITE_DELETE_CONSOLE = false
|
|||
# 是否开启sourcemap
|
||||
VITE_SHOW_SOURCEMAP = false
|
||||
|
||||
VITE_APP_PUBLIC_BASE = './'
|
||||
VITE_APP_PUBLIC_BASE = ./
|
||||
# 测试线上
|
||||
VITE_SERVER_BASEURL = 'https://gateway.dev.cdlsxd.cn'
|
||||
# 正式环境
|
||||
|
@ -15,4 +15,4 @@ VITE_SERVER_BASEURL = 'https://gateway.dev.cdlsxd.cn'
|
|||
# 测试线上
|
||||
VITE_APP_PROXY_PREFIX = 'https://gateway.dev.cdlsxd.cn'
|
||||
# 正式环境
|
||||
# VITE_APP_PROXY_PREFIX = 'https://scens.h5.86698.cn'
|
||||
# VITE_APP_PROXY_PREFIX = 'https://scens.h5.86698.cn'
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
<!-- <script src="https://fastly.jsdelivr.net/npm/eruda"></script>
|
||||
<script src="https://fastly.jsdelivr.net/npm/eruda"></script>
|
||||
<script>
|
||||
eruda.init()
|
||||
</script> -->
|
||||
</script>
|
||||
<script>
|
||||
// var clickCount = 0
|
||||
// var timer = null
|
||||
|
|
|
@ -58,9 +58,10 @@ const httpInterceptor = {
|
|||
const { token } = userStore.userInfo as unknown as IUserInfo
|
||||
if (token) {
|
||||
options.header.Authorization = `Bearer ${token}`
|
||||
} else {
|
||||
options.header.Authorization = `Bearer c1ebcbc275b3b3ca72593d2c7a6583185c8`
|
||||
}
|
||||
// else {
|
||||
// options.header.Authorization = `Bearer 9a217f4ff2af6463e4e1a33ee558eee95c8`
|
||||
// }
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -16,19 +16,22 @@
|
|||
},
|
||||
"pages": [
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
"path": "pages/physical/address",
|
||||
=======
|
||||
"path": "pages/gzyd/index",
|
||||
>>>>>>> 964dde74b2f18de014a39db01294f7e0d62fd7cc
|
||||
"type": "page",
|
||||
"layout": "default",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
<<<<<<< HEAD
|
||||
"navigationBarTitleText": "收货地址"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/physical/coupon",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "我的奖品"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/physical/createAddress",
|
||||
"type": "page",
|
||||
|
@ -36,9 +39,14 @@
|
|||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "新增收货地址"
|
||||
=======
|
||||
"navigationBarTitleText": "广州移动"
|
||||
>>>>>>> 964dde74b2f18de014a39db01294f7e0d62fd7cc
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/physical/redeem",
|
||||
"type": "page",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "奖品兑换"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -9,12 +9,18 @@
|
|||
</route>
|
||||
<template>
|
||||
<view class="page-wrapper flex flex-col">
|
||||
<scroll-view scroll-y class="address-container flex-1">
|
||||
<scroll-view scroll-y class="address-container flex-1" v-if="addressList.length > 0">
|
||||
<view style="width: 100%; height: 34rpx"></view>
|
||||
<view v-for="(item, index) in addressList" :key="`${item.id}`">
|
||||
<AddressItem :detail="item" @update-event="updateEvent" @del-event="delEvent" />
|
||||
<AddressItem
|
||||
:detail="item"
|
||||
@update-event="updateEvent"
|
||||
@del-event="delEvent"
|
||||
@check-event="checkEvent"
|
||||
/>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="flex-1 flex flex-items-center flex-justify-center" v-else>暂无可用的收货地址</view>
|
||||
<view class="btns flex flex-justify-around flex-items-center">
|
||||
<view
|
||||
class="btn flex flex-items-center flex-justify-center"
|
||||
|
@ -26,10 +32,52 @@
|
|||
<view
|
||||
class="btn flex flex-items-center flex-justify-center"
|
||||
style="background: linear-gradient(90deg, #e82e28 0%, #fd8237 100%)"
|
||||
@click="dui"
|
||||
>
|
||||
确认兑换
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="isMask"
|
||||
class="mask flex_center flex_items"
|
||||
style="
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
"
|
||||
>
|
||||
<view class="flex_column flex_items bgwhite modal-container">
|
||||
<image
|
||||
src="@/assets/images/jlgh/icon_gou.png"
|
||||
style="width: 120rpx; height: 120rpx"
|
||||
mode=""
|
||||
></image>
|
||||
<text class="f40 mt50" style="font-size: 40rpx; font-weight: bold; color: #333">
|
||||
领取成功
|
||||
</text>
|
||||
<text class="f28 mt30" style="font-size: 28rpx; font-weight: 400; color: #808080">
|
||||
恭喜,奖品已经成功兑换。
|
||||
</text>
|
||||
<view class="flex_items flex_center mt50">
|
||||
<view
|
||||
@click="gomy"
|
||||
class="f32 f-center"
|
||||
style="
|
||||
width: 280rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(270deg, #ff9843 0%, #f43139 100%);
|
||||
border-radius: 54rpx;
|
||||
"
|
||||
>
|
||||
确认
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -38,19 +86,35 @@ import { ref, reactive, unref, onMounted } from 'vue'
|
|||
import Api from './api'
|
||||
import AddressItem from './components/address-item.vue'
|
||||
|
||||
const info = reactive<any>({})
|
||||
const isMask = ref<boolean>(false)
|
||||
const checkedAddressId = ref<number | string>('')
|
||||
|
||||
const addressList = ref<any[]>([])
|
||||
|
||||
onLoad((options) => {
|
||||
const item = decodeURIComponent(options.item)
|
||||
Object.assign(info, JSON.parse(item))
|
||||
})
|
||||
|
||||
// 初始化地址省级数据
|
||||
async function initAddressList() {
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
const res: any = await Api.getAddressList()
|
||||
uni.hideLoading()
|
||||
addressList.value = res.data.data
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
initAddressList()
|
||||
})
|
||||
|
||||
async function updateEvent(detailData) {
|
||||
// eslint-disable-next-line camelcase
|
||||
const { is_default, id } = detailData
|
||||
// eslint-disable-next-line camelcase
|
||||
const res: any = await Api.updateAddressDefault({ is_default, id })
|
||||
initAddressList()
|
||||
}
|
||||
|
@ -76,13 +140,87 @@ function delEvent(detailData) {
|
|||
})
|
||||
}
|
||||
|
||||
function checkEvent(id) {
|
||||
checkedAddressId.value = id
|
||||
}
|
||||
|
||||
function toAdd() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/physical/createAddress',
|
||||
url: `/pages/physical/createAddress?activity_code=${info.activity_code}`,
|
||||
})
|
||||
}
|
||||
|
||||
function gomy() {
|
||||
isMask.value = false
|
||||
uni.navigateTo({
|
||||
url: `/pages/physical/coupon?activity_code=${info.activity_code}`,
|
||||
})
|
||||
}
|
||||
|
||||
function dui() {
|
||||
if (!checkedAddressId.value) {
|
||||
uni.showToast({
|
||||
title: '请选择收货地址',
|
||||
icon: 'none',
|
||||
})
|
||||
return false
|
||||
}
|
||||
exchangeEvent()
|
||||
// if (checkedAddressId.value) {
|
||||
// exchangeEvent()
|
||||
// }
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '',
|
||||
// success: function (res) {
|
||||
// if (res.confirm) {
|
||||
// exchangeEvent()
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消')
|
||||
// }
|
||||
// },
|
||||
// })
|
||||
}
|
||||
|
||||
async function exchangeEvent() {
|
||||
uni.showLoading({
|
||||
title: '兑换中...',
|
||||
})
|
||||
const params = { id: info.id, user_address_id: checkedAddressId.value }
|
||||
const res1 = await Api.exchange(params)
|
||||
const { code, data, message } = res1 as any
|
||||
uni.hideLoading()
|
||||
if (code === 200) {
|
||||
// eslint-disable-next-line camelcase
|
||||
// const { shortUrl, status, order_id, order_no, wait_amount } = data
|
||||
// // 待支付
|
||||
// if (status === 1) {
|
||||
// const res2 = await api.getPayConfig({ activity_code: info.activity_code })
|
||||
// payList.value = (res2 as any).data
|
||||
// // eslint-disable-next-line camelcase
|
||||
// pay_order_id.value = order_id
|
||||
// // eslint-disable-next-line camelcase
|
||||
// pay_order_no.value = order_no
|
||||
// // eslint-disable-next-line camelcase
|
||||
// wait_pay_amount.value = wait_amount
|
||||
// showPayConfig.value = true
|
||||
// } else if (shortUrl && typeof shortUrl === 'string') {
|
||||
// isMask.value = true
|
||||
// linkUrl.value = shortUrl
|
||||
// } else {
|
||||
// isMask.value = true
|
||||
// }
|
||||
isMask.value = true
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
@use './style.css';
|
||||
.page-wrapper {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
|
@ -103,4 +241,11 @@ function toAdd() {
|
|||
border-radius: 29rpx;
|
||||
}
|
||||
}
|
||||
.modal-container {
|
||||
box-sizing: border-box;
|
||||
width: 634rpx;
|
||||
height: 534rpx;
|
||||
padding: 80rpx 50rpx 0;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -67,7 +67,7 @@ export const createAddress = (params: any) => {
|
|||
return http.post('/v1/address/create', params)
|
||||
}
|
||||
|
||||
export const getAddressList = (params: any) => {
|
||||
export const getAddressList = (params?: any) => {
|
||||
return http.get('/v1/address/list', params)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +1,33 @@
|
|||
<template>
|
||||
<view class="address-item-wrapper flex flex-col box-border" @click="goDetail">
|
||||
<view class="nav-info flex">
|
||||
<view style="margin-right: 40rpx">{{ detail.contact_name }}</view>
|
||||
<view>
|
||||
{{ detail.contact_phone }}
|
||||
</view>
|
||||
<view class="address-item-wrapper flex box-border">
|
||||
<view class="flex flex-items-center" style="margin-right: 10rpx">
|
||||
<wd-checkbox shape="square" size="large" v-model="value" @change="handleChange"></wd-checkbox>
|
||||
</view>
|
||||
<view class="address-info">
|
||||
{{ detail.address_detail }}
|
||||
</view>
|
||||
<view class="btns flex flex-justify-between">
|
||||
<view class="flex flex-items-center">
|
||||
<wd-switch
|
||||
v-model="detail.is_default"
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
size="18px"
|
||||
@change="goUpdate"
|
||||
/>
|
||||
<view style="margin-left: 12rpx">
|
||||
{{ detail.is_default === 1 ? '已默认' : '设为默认' }}
|
||||
<view class="flex flex-col box-border flex-1">
|
||||
<view class="nav-info flex">
|
||||
<view style="margin-right: 40rpx">{{ detail.contact_name }}</view>
|
||||
<view>
|
||||
{{ detail.contact_phone }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" @click="goDel">删除</view>
|
||||
<view class="address-info">
|
||||
{{ detail.address_detail }}
|
||||
</view>
|
||||
<view class="btns flex flex-justify-between">
|
||||
<view class="flex flex-items-center">
|
||||
<wd-switch
|
||||
v-model="detail.is_default"
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
size="18px"
|
||||
@change="goUpdate"
|
||||
/>
|
||||
<view style="margin-left: 12rpx">
|
||||
{{ detail.is_default === 1 ? '已默认' : '设为默认' }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn" @click="goDel">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -35,7 +40,8 @@ const props = defineProps({
|
|||
default: () => ({}),
|
||||
},
|
||||
})
|
||||
const emits = defineEmits(['del-event', 'update-event'])
|
||||
const emits = defineEmits(['del-event', 'update-event', 'check-event'])
|
||||
const value = ref(false)
|
||||
|
||||
function goDel(e) {
|
||||
if (e.stopPropagation) {
|
||||
|
@ -52,12 +58,21 @@ function goUpdate(e) {
|
|||
}
|
||||
emits('update-event', props.detail)
|
||||
}
|
||||
|
||||
function handleChange(e) {
|
||||
const { value } = e
|
||||
if (e.stopPropagation) {
|
||||
// W3C阻止冒泡方法
|
||||
e.stopPropagation()
|
||||
}
|
||||
emits('check-event', value ? props.detail.id : '')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.address-item-wrapper {
|
||||
width: 702rpx;
|
||||
padding: 24rpx;
|
||||
width: 710rpx;
|
||||
padding: 14rpx;
|
||||
margin: 0 auto 34rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 24rpx;
|
||||
|
|
|
@ -79,9 +79,17 @@ const query = reactive<any>({
|
|||
const dui = (item) => {
|
||||
item.activity_code = query.activity_code
|
||||
item.lottery_code = query.lottery_code
|
||||
if (item.product_form === 4) {
|
||||
uni.navigateTo({
|
||||
url:
|
||||
`/pages/physical/address?activity_code=${item.activity_code}&item=` +
|
||||
encodeURIComponent(JSON.stringify(item)),
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.navigateTo({
|
||||
url:
|
||||
`/pages/jlgh/redeem?activity_code=${item.activity_code}&item=` +
|
||||
`/pages/physical/redeem?activity_code=${item.activity_code}&item=` +
|
||||
encodeURIComponent(JSON.stringify(item)),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</route>
|
||||
<template>
|
||||
<view class="page-wrapper flex flex-col">
|
||||
<wd-form ref="form" :model="model">
|
||||
<wd-form ref="form" :model="model" style="box-sizing: border-box; flex: 1; padding: 30rpx 0">
|
||||
<wd-cell-group border>
|
||||
<wd-input
|
||||
label="联系人"
|
||||
|
@ -18,6 +18,7 @@
|
|||
v-model="model.contact_name"
|
||||
placeholder="请输入联系人"
|
||||
:rules="[{ required: true, message: '请填写联系人' }]"
|
||||
custom-label-class="label-class"
|
||||
/>
|
||||
<wd-input
|
||||
label="联系电话"
|
||||
|
@ -46,15 +47,20 @@
|
|||
:rules="[{ required: true, message: '请填写详细地址' }]"
|
||||
/>
|
||||
<wd-cell title="设为默认" title-width="100px" prop="is_default" center>
|
||||
<view style="text-align: left">
|
||||
<wd-switch v-model="model.is_default" :active-value="1" :inactive-value="2" />
|
||||
<view class="flex flex-items-center">
|
||||
<wd-switch
|
||||
v-model="model.is_default"
|
||||
:active-value="1"
|
||||
:inactive-value="2"
|
||||
size="20px"
|
||||
/>
|
||||
</view>
|
||||
</wd-cell>
|
||||
</wd-cell-group>
|
||||
<view class="footer">
|
||||
<wd-button type="primary" size="large" @click="handleSubmit" block>提交</wd-button>
|
||||
</view>
|
||||
</wd-form>
|
||||
<view class="footer flex flex-items-center flex-justify-center">
|
||||
<view class="btn flex flex-items-center flex-justify-center" @click="handleSubmit">提交</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -136,6 +142,9 @@ function handleSubmit() {
|
|||
const params = { ...model, address_detail: `${getAddressName()}${model.address_detail}` }
|
||||
const { code, data, message } = await Api.createAddress(params)
|
||||
if (code === 200) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/physical/address',
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: message,
|
||||
|
@ -154,4 +163,24 @@ function handleSubmit() {
|
|||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
.footer {
|
||||
width: 100%;
|
||||
height: 120rpx;
|
||||
.btn {
|
||||
width: 80%;
|
||||
height: 70rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #ffffff;
|
||||
background: linear-gradient(90deg, #4888f4 0%, #82b0f5 100%);
|
||||
border-radius: 29rpx;
|
||||
}
|
||||
}
|
||||
::v-deep .label-class {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
}
|
||||
// ::v-deep .wd-cell__wrapper {
|
||||
// border-bottom: 1px solid #e8e8e8;
|
||||
// }
|
||||
</style>
|
||||
|
|
|
@ -477,7 +477,7 @@ export default {
|
|||
data: {
|
||||
message: 'success',
|
||||
type: 'coupon',
|
||||
url: '/pages/jlgh/coupon',
|
||||
url: '/pages/physical/coupon',
|
||||
},
|
||||
},
|
||||
'*',
|
||||
|
@ -501,7 +501,7 @@ export default {
|
|||
data: {
|
||||
message: 'success',
|
||||
type: 'coupon',
|
||||
url: '/pages/jlgh/redeem',
|
||||
url: '/pages/physical/redeem',
|
||||
query: {
|
||||
item: encodeURIComponent(JSON.stringify(dataObj)),
|
||||
},
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
// Generated by vite-plugin-uni-pages
|
||||
|
||||
interface NavigateToOptions {
|
||||
<<<<<<< HEAD
|
||||
url: "/pages/physical/address" |
|
||||
"/pages/physical/createAddress";
|
||||
=======
|
||||
url: "/pages/gzyd/index";
|
||||
>>>>>>> 964dde74b2f18de014a39db01294f7e0d62fd7cc
|
||||
"/pages/physical/coupon" |
|
||||
"/pages/physical/createAddress" |
|
||||
"/pages/physical/redeem";
|
||||
}
|
||||
interface RedirectToOptions extends NavigateToOptions {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue