Commit 4a145e97 by 胡悦

提交优惠券

1 parent c8623cbb
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-09-06 10:11:03 * @Date: 2024-09-06 10:11:03
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-09-12 10:15:21 * @LastEditTime: 2024-09-12 15:25:12
--> -->
<template> <template>
<view> <view>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
:key="index" :key="index"
> >
<view :class="['label',{required:i.required}]">{{ i.label }}</view> <view :class="['label',{required:i.required}]">{{ i.label }}</view>
<view :class="['value', { error: showError(i.key) && i.required },{disabled:customerType == 0}]"> <view :class="['value', { error: showError(i.key) && i.required },{disabled: pageParams.received}]">
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<input <input
:type="i.inputType" :type="i.inputType"
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
v-model="customerInfo[i.key]" v-model="customerInfo[i.key]"
class="input" class="input"
:placeholder="i.placeholder" :placeholder="i.placeholder"
:disabled="customerType == 0" :disabled="pageParams.received"
@input="inputCustomer" @input="inputCustomer"
placeholder-style="color:#c9c9c9;" placeholder-style="color:#c9c9c9;"
/> />
...@@ -93,14 +93,11 @@ ...@@ -93,14 +93,11 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<template v-if="pageParams.QRURL"> <image v-if="pageParams.QRURL"
<image
class="qr-code-img" class="qr-code-img"
:src="pageParams.QRURL" :src="pageParams.QRURL"
/> />
</template> <view v-else class="no-data">
<tempalate v-else>
<view class="no-data">
<image <image
src="@/assets/images/boutique/no-data.webp" src="@/assets/images/boutique/no-data.webp"
class="no-data-img" class="no-data-img"
...@@ -108,23 +105,18 @@ ...@@ -108,23 +105,18 @@
<view>填写客户信息后点击</view> <view>填写客户信息后点击</view>
<view>生成专属二维码」生成券码</view> <view>生成专属二维码」生成券码</view>
</view> </view>
</tempalate>
</template> </template>
</template> </template>
<template v-else> <template v-else>
<!-- <vue-qr <image
ref="qrCode" class="qr-code-img"
:margin="10" :src="pageParams.customerQr"
:text="pageParams.customerCouponId" />
colorDark="black"
colorLight="#F9F9F9"
:size="200"
></vue-qr> -->
</template> </template>
</view> </view>
<view <view
class="ok-tips" class="ok-tips"
v-if="pageParams.received" v-if="customerType == 1 && pageParams.received"
> >
<view>车主已领取该礼券</view> <view>车主已领取该礼券</view>
<view>请前往客户邀约列表查看</view> <view>请前往客户邀约列表查看</view>
...@@ -188,7 +180,7 @@ const formObject_boutique = [{ ...@@ -188,7 +180,7 @@ const formObject_boutique = [{
key: "customerName", key: "customerName",
type: "input", type: "input",
inputType: "text", inputType: "text",
maxlength: 50, maxlength: 20,
placeholder: '请输入姓名', placeholder: '请输入姓名',
required: true required: true
}, },
...@@ -227,10 +219,6 @@ const formObject_boutique = [{ ...@@ -227,10 +219,6 @@ const formObject_boutique = [{
export default { export default {
name: 'CouponPop', name: 'CouponPop',
props: { props: {
customerType: {
type: Number,
default: 1
},
carInfo: { carInfo: {
type: Object, type: Object,
default: () => ({}) default: () => ({})
...@@ -242,15 +230,29 @@ export default { ...@@ -242,15 +230,29 @@ export default {
immediate: true, immediate: true,
handler(newval) { handler(newval) {
console.log(newval, 'carModel') console.log(newval, 'carModel')
this.customerInfo = newval this.customerInfo = Object.assign(this.customerInfo, newval)
this.pageParams.showDetail = false this.pageParams.showDetail = false
} }
}, },
watchStatus: {
immediate: true,
handler(newval) {
console.log('重新进入', this.pageParams)
let item = this.couponList.find(e => e.couponType == 1),
item2 = this.couponList.find(e => e.couponType == 18)
if (item) this.chooseCoupon(item) //默认填入类型为「太阳膜」类型
else if (item2) this.chooseCoupon(item2) //次选填入「精品」类型
else this.chooseCoupon(this.couponList[0]) // 无此两种类型情况默认带入任意类型礼券
}
}
}, },
computed: { computed: {
watchCustomerInfo () { watchCustomerInfo () {
return this.$store.state.user.customerInfo return this.$store.state.user.customerInfo
}, },
watchStatus () {
return this.$store.state.user.historyStatus
},
}, },
data () { data () {
return { return {
...@@ -265,9 +267,11 @@ export default { ...@@ -265,9 +267,11 @@ export default {
QRURL: '', QRURL: '',
showDetail: false, showDetail: false,
clickFlag: false, clickFlag: false,
customerCouponId: '' customerCouponId: '',
customerQr: ''
}, },
isCheck: false isCheck: false,
customerType: 1
} }
}, },
mounted () { mounted () {
...@@ -302,7 +306,6 @@ export default { ...@@ -302,7 +306,6 @@ export default {
let item = arr.find(e => e.couponType == 1), let item = arr.find(e => e.couponType == 1),
item2 = arr.find(e => e.couponType == 18) item2 = arr.find(e => e.couponType == 18)
if (!this.pageParams.couponId) { if (!this.pageParams.couponId) {
console.log(1111111111111)
if (item) this.chooseCoupon(item) //默认填入类型为「太阳膜」类型 if (item) this.chooseCoupon(item) //默认填入类型为「太阳膜」类型
else if (item2) this.chooseCoupon(item2) //次选填入「精品」类型 else if (item2) this.chooseCoupon(item2) //次选填入「精品」类型
else this.chooseCoupon(arr[0]) // 无此两种类型情况默认带入任意类型礼券 else this.chooseCoupon(arr[0]) // 无此两种类型情况默认带入任意类型礼券
...@@ -321,6 +324,7 @@ export default { ...@@ -321,6 +324,7 @@ export default {
console.log(item, '----------') console.log(item, '----------')
this.pageParams.couponId = item.id this.pageParams.couponId = item.id
this.customerInfo.couponTypeName = item.couponTypeName this.customerInfo.couponTypeName = item.couponTypeName
this.$store.dispatch('setCustomerInfo', this.customerInfo)
this.$refs.couponBoxVisible.close() this.$refs.couponBoxVisible.close()
}, },
showError (key) { showError (key) {
...@@ -329,13 +333,17 @@ export default { ...@@ -329,13 +333,17 @@ export default {
return this.errorTip && flag return this.errorTip && flag
}, },
showPopup (e) { showPopup (e) {
let { customerType } = this let { pageParams } = this
if (customerType == 0) return if (pageParams.received) return
this.$refs[e].open(); this.$refs[e].open();
}, },
open () { open (customerType, customerCouponId) {
this.$refs.couponPopup.open() this.$refs.couponPopup.open()
this.customerType = customerType
this.pageParams.customerCouponId = customerCouponId
this.init() this.init()
const { customerName, phoneNumber, staffName } = this.customerInfo
this.isCheck = customerName && phoneNumber && staffName
}, },
close () { close () {
this.$refs.couponPopup.close() this.$refs.couponPopup.close()
...@@ -377,7 +385,8 @@ export default { ...@@ -377,7 +385,8 @@ export default {
console.log(flag, this.customerInfo, this.pageParams) console.log(flag, this.customerInfo, this.pageParams)
return flag return flag
}, },
async createCoupon () { async createCoupon() {
if (this.pageParams.received) return
try { try {
console.log(this.pageParams) console.log(this.pageParams)
const { pageParams: { clickFlag, couponId }, carInfo, customerInfo } = this, { const { pageParams: { clickFlag, couponId }, carInfo, customerInfo } = this, {
...@@ -409,6 +418,8 @@ export default { ...@@ -409,6 +418,8 @@ export default {
if (code == 0) { if (code == 0) {
if (data) { if (data) {
this.pageParams.QRURL = data this.pageParams.QRURL = data
clearInterval(this.pageParams.qrTimer)
this.pageParams.qrTimer = null
this.checkCustomerReceivedStatus(dayjs().format("YYYY-MM-DD HH:mm:ss")) this.checkCustomerReceivedStatus(dayjs().format("YYYY-MM-DD HH:mm:ss"))
uni.hideLoading() uni.hideLoading()
this.pageParams.clickFlag = false this.pageParams.clickFlag = false
...@@ -443,6 +454,8 @@ export default { ...@@ -443,6 +454,8 @@ export default {
}) })
if (res && res.total) { if (res && res.total) {
this.pageParams.received = true this.pageParams.received = true
console.log(this.pageParams, '=======')
this.isCheck = false
this.$emit('reception', { this.$emit('reception', {
item: { item: {
customerName: customerInfo.customerName, customerName: customerInfo.customerName,
...@@ -450,7 +463,8 @@ export default { ...@@ -450,7 +463,8 @@ export default {
customerPhone: customerInfo.phoneNumber, customerPhone: customerInfo.phoneNumber,
userId: customerInfo.salesUuid, userId: customerInfo.salesUuid,
employeeName: customerInfo.staffName, employeeName: customerInfo.staffName,
receiveCouponDate: Date.now() receiveCouponDate: Date.now(),
customerCouponId: res.list[0].id,
} }
}) })
} }
...@@ -675,7 +689,7 @@ export default { ...@@ -675,7 +689,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
.label { .label {
width: 150rpx; width: 185rpx;
text-align: right; text-align: right;
margin-right: 32rpx; margin-right: 32rpx;
font-size: 28rpx; font-size: 28rpx;
...@@ -683,6 +697,7 @@ export default { ...@@ -683,6 +697,7 @@ export default {
line-height: 44rpx; line-height: 44rpx;
} }
.value-text { .value-text {
flex: 1;
font-size: 30rpx; font-size: 30rpx;
color: #333333; color: #333333;
line-height: 44rpx; line-height: 44rpx;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!