Commit f7c84de1 by 胡悦

提交为客户发券、查看客户二维码

1 parent 81c3e416
No preview for this file type
...@@ -183,6 +183,14 @@ ...@@ -183,6 +183,14 @@
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz",
"integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==" "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg=="
}, },
"decompress-response": {
"version": "6.0.0",
"resolved": "https://registry.npmmirror.com/decompress-response/-/decompress-response-6.0.0.tgz",
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
"requires": {
"mimic-response": "^3.1.0"
}
},
"delayed-stream": { "delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
...@@ -449,6 +457,11 @@ ...@@ -449,6 +457,11 @@
"resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz", "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz",
"integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==" "integrity": "sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg=="
}, },
"js-binary-schema-parser": {
"version": "2.0.3",
"resolved": "https://registry.npmmirror.com/js-binary-schema-parser/-/js-binary-schema-parser-2.0.3.tgz",
"integrity": "sha512-xezGJmOb4lk/M1ZZLTR/jaBHQ4gG/lqQnJqdIv4721DMggsa1bDVlHXNeHYogaIEHD9vCRv0fcL4hMA+Coarkg=="
},
"jsbn": { "jsbn": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
...@@ -529,6 +542,11 @@ ...@@ -529,6 +542,11 @@
"mime-db": "1.52.0" "mime-db": "1.52.0"
} }
}, },
"mimic-response": {
"version": "3.1.0",
"resolved": "https://registry.npmmirror.com/mimic-response/-/mimic-response-3.1.0.tgz",
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="
},
"minimatch": { "minimatch": {
"version": "3.0.8", "version": "3.0.8",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
...@@ -629,6 +647,11 @@ ...@@ -629,6 +647,11 @@
"wrappy": "1" "wrappy": "1"
} }
}, },
"parenthesis": {
"version": "3.1.8",
"resolved": "https://registry.npmmirror.com/parenthesis/-/parenthesis-3.1.8.tgz",
"integrity": "sha512-KF/U8tk54BgQewkJPvB4s/US3VQY68BRDpH638+7O/n58TpnwiwnOtGIOsT2/i+M78s61BBpeC83STB88d8sqw=="
},
"parse-data-uri": { "parse-data-uri": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/parse-data-uri/-/parse-data-uri-0.2.0.tgz", "resolved": "https://registry.npmjs.org/parse-data-uri/-/parse-data-uri-0.2.0.tgz",
...@@ -779,6 +802,21 @@ ...@@ -779,6 +802,21 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz",
"integrity": "sha512-5OkOBiw69xqmxOFIXwXsiY1HlE+om8nNptg1ZIf95fzcnfgOv2fLm7pmmGbRJsjJIqPpW5Kwy4wpDBTz5wQlUw==" "integrity": "sha512-5OkOBiw69xqmxOFIXwXsiY1HlE+om8nNptg1ZIf95fzcnfgOv2fLm7pmmGbRJsjJIqPpW5Kwy4wpDBTz5wQlUw=="
}, },
"simple-concat": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/simple-concat/-/simple-concat-1.0.1.tgz",
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="
},
"simple-get": {
"version": "4.0.1",
"resolved": "https://registry.npmmirror.com/simple-get/-/simple-get-4.0.1.tgz",
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
"requires": {
"decompress-response": "^6.0.0",
"once": "^1.3.1",
"simple-concat": "^1.0.0"
}
},
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
...@@ -829,6 +867,14 @@ ...@@ -829,6 +867,14 @@
"tweetnacl": "~0.14.0" "tweetnacl": "~0.14.0"
} }
}, },
"string-split-by": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/string-split-by/-/string-split-by-1.0.0.tgz",
"integrity": "sha512-KaJKY+hfpzNyet/emP81PJA9hTVSfxNLS9SFTWxdCnnW1/zOOwiV248+EfoX7IQFcBaOp4G5YE6xTJMF+pLg6A==",
"requires": {
"parenthesis": "^3.1.5"
}
},
"string_decoder": { "string_decoder": {
"version": "0.10.31", "version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
...@@ -1037,6 +1083,47 @@ ...@@ -1037,6 +1083,47 @@
"vinyl": "^1.1.0" "vinyl": "^1.1.0"
} }
}, },
"vue-qr": {
"version": "4.0.9",
"resolved": "https://registry.npmmirror.com/vue-qr/-/vue-qr-4.0.9.tgz",
"integrity": "sha512-pAISV94T0MNEYA3NGjykUpsXRE2QfaNxlu9ZhEL6CERgqNc21hJYuP3hRVzAWfBQlgO18DPmZTbrFerJC3+Ikw==",
"requires": {
"glob": "^8.0.1",
"js-binary-schema-parser": "^2.0.2",
"simple-get": "^4.0.1",
"string-split-by": "^1.0.0"
},
"dependencies": {
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"requires": {
"balanced-match": "^1.0.0"
}
},
"glob": {
"version": "8.1.0",
"resolved": "https://registry.npmmirror.com/glob/-/glob-8.1.0.tgz",
"integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
}
},
"minimatch": {
"version": "5.1.6",
"resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.6.tgz",
"integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==",
"requires": {
"brace-expansion": "^2.0.1"
}
}
}
},
"webpack-spritesmith": { "webpack-spritesmith": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/webpack-spritesmith/-/webpack-spritesmith-1.1.0.tgz", "resolved": "https://registry.npmjs.org/webpack-spritesmith/-/webpack-spritesmith-1.1.0.tgz",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"hammerjs": "^2.0.8", "hammerjs": "^2.0.8",
"number-precision": "^1.6.0", "number-precision": "^1.6.0",
"prettier": "^3.3.2", "prettier": "^3.3.2",
"vue-qr": "^4.0.9",
"webpack-spritesmith": "^1.1.0" "webpack-spritesmith": "^1.1.0"
} }
} }
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
* @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-06 14:38:09 * @LastEditTime: 2024-09-06 17:14:39
--> -->
<template> <template>
<view> <view>
<MessageBox ref="couponPopup" type="center" :is-mask-click="false" animation :isFooter="false" :title="'为客户发券'" :popupW="1200" :maxHeight="896"> <MessageBox ref="couponPopup" type="center" :is-mask-click="false" animation :isFooter="false" :title="customerType == 1 ?'为客户发券' : '客户二维码'" :popupW="1200" :maxHeight="896">
<view name="content" class="content"> <view name="content" class="content">
<view class="form"> <view class="form" v-if="customerType != 0">
<view v-for="(i, index) in formObject" class="form-item" :key="index"> <view v-for="(i, index) in formObject" class="form-item" :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:customerType == 0}]">
...@@ -44,9 +44,27 @@ ...@@ -44,9 +44,27 @@
</view> </view>
</view> </view>
</view> </view>
<view class="customer-info" v-else>
<view class="customer-title">当前客户信息</view>
<view class="line"></view>
<view class="customer-list">
<view class="customer-item" v-for="(j, idx) in formObject" :key="idx">
<view class="label">{{ j.label }}</view>
<view class="value-text">{{ customerInfo[j.key] || '-----'}}</view>
</view>
</view>
</view>
<view class="qr-code"> <view class="qr-code">
<template v-if="pageParams.QRURL"> <view class="qr-code-box">
<image :src="pageParams.QRURL" /> <template v-if="customerType == 1">
<template v-if="pageParams.received">
<view class="ok">
<image class="ok-status" src="@/assets/images/boutique/ok-status.webp"/>
<view>客户领券成功</view>
</view>
</template>
<template v-if="!pageParams.received && pageParams.QRURL">
<image class="qr-code-img" :src="pageParams.QRURL" />
</template> </template>
<template v-else> <template v-else>
<view class="no-data"> <view class="no-data">
...@@ -58,9 +76,22 @@ ...@@ -58,9 +76,22 @@
<view>生成专属二维码」生成券码</view> <view>生成专属二维码」生成券码</view>
</view> </view>
</template> </template>
</template>
<template v-else>
<vue-qr ref="qrCode" :margin="10" :text="pageParams.customerCouponId" colorDark="black" colorLight="#F9F9F9" :size="200"></vue-qr>
</template>
</view> </view>
<view class="ok-tips" v-if="pageParams.received">
<view>车主已领取该礼券</view>
<view>请前往客户邀约列表查看</view>
</view> </view>
<view name="footer"> <view class="ok-tips" v-if="customerType == 0">
<view>驻点销售使用微信或企微</view>
<view>扫描此码新增客户工单</view>
</view>
</view>
</view>
<view name="footer" v-if="customerType == 1">
<view class="footer-btn" @click="createCoupon" :class="{disabled: !isCheck}">生成专属二维码</view> <view class="footer-btn" @click="createCoupon" :class="{disabled: !isCheck}">生成专属二维码</view>
</view> </view>
</MessageBox> </MessageBox>
...@@ -95,6 +126,7 @@ ...@@ -95,6 +126,7 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import Employee from '@/components/Employee.vue' import Employee from '@/components/Employee.vue'
import VueQr from 'vue-qr'
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/;
const formObject_boutique = [{ const formObject_boutique = [{
label: "车主姓名", label: "车主姓名",
...@@ -145,7 +177,7 @@ export default { ...@@ -145,7 +177,7 @@ export default {
default: 1 default: 1
} }
}, },
components: { Employee }, components: { Employee, VueQr },
watch: { watch: {
watchCustomerInfo: { watchCustomerInfo: {
immediate: true, immediate: true,
...@@ -172,7 +204,8 @@ export default { ...@@ -172,7 +204,8 @@ export default {
carInfo: {}, carInfo: {},
QRURL: '', QRURL: '',
showDetail: false, showDetail: false,
clickFlag: false clickFlag: false,
customerCouponId: 'id=1'
}, },
isCheck: false isCheck: false
} }
...@@ -324,6 +357,42 @@ export default { ...@@ -324,6 +357,42 @@ export default {
} }
} }
}, },
checkCustomerReceivedStatus (receiveCouponStartTime) {
if (this.pageParams.qrTimer) return
try {
this.pageParams.received = false
this.pageParams.qrTimer = setInterval(async () => {
const { pageParams: { couponId }, customerInfo } = this,
res = await uni.$api.boutiqueApi.findCustomerReceivedStatus({
merchantCouponId: couponId,
customerPhone: customerInfo.phoneNumber,
receiveCouponStartTime
})
if (res && res.total) {
this.pageParams.received = true
this.closeQr()
this.$emit('reception', {
item: {
customerName: customerInfo.customerName,
carSeriesName: customerInfo.carModel,
customerPhone: customerInfo.phoneNumber,
userId: customerInfo.salesUuid,
employeeName: customerInfo.staffName,
receiveCouponDate: Date.now()
}
})
setTimeout(() => {
this.$refs.qrbox.close()
}, 3e3)
}
}, 2e3)
} catch (error) {
if (error) uni.showToast({
title: error,
icon: "none",
});
}
},
} }
} }
</script> </script>
...@@ -352,16 +421,23 @@ export default { ...@@ -352,16 +421,23 @@ export default {
.qr-code { .qr-code {
margin-top: 62rpx; margin-top: 62rpx;
width: 400rpx; width: 400rpx;
margin-left: 64rpx;
&-box {
height: 400rpx; height: 400rpx;
border-radius: 22.86rpx;
background-color: #F9F9F9; background-color: #F9F9F9;
margin-left: 64rpx; }
&-img {
width: 343rpx;
height: 343rpx;
}
} }
} }
.form { .form {
flex: 1; flex: 1;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 24rpx 0; gap: 32rpx 0;
padding-top: 30rpx; padding-top: 30rpx;
&-item { &-item {
display: flex; display: flex;
...@@ -476,4 +552,72 @@ export default { ...@@ -476,4 +552,72 @@ export default {
.disabled { .disabled {
filter: opacity(0.5) filter: opacity(0.5)
} }
.ok {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
font-weight: 500;
font-size: 28rpx;
color: #333333;
width: 100%;
height: 100%;
&-status {
width: 96rpx;
height: 96rpx;
margin-bottom: 16rpx;
}
}
.ok-tips {
font-size: 28rpx;
color: #999999;
text-align: center;
line-height: 36rpx;
margin-top: 32rpx;
}
.customer-info {
flex: 1;
padding-top: 30rpx;
background-color: #F9F9F9;
border-radius: 16rpx;
padding: 48rpx;
margin-top: 30rpx;
margin-bottom: 56rpx;
.customer-title {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
line-height: 44rpx;
height: 44rpx;
}
.line {
width: 100%;
height: 1px;
background-color: #e0e0e0;
margin: 32rpx 0;
}
.customer-list {
display: flex;
flex-wrap: wrap;
gap: 32rpx 0;
}
.customer-item {
width: 100%;
display: flex;
align-items: center;
.label {
width: 150rpx;
text-align: right;
margin-right: 32rpx;
font-size: 28rpx;
color: #6C6C70;
line-height: 44rpx;
}
.value-text {
font-size: 30rpx;
color: #333333;
line-height: 44rpx;
}
}
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!