Commit 4a145e97 by 胡悦

提交优惠券

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