|
|
@@ -235,6 +235,136 @@
|
|
|
<!-- <view class="tabBarView">-->
|
|
|
<!-- <tab-bar :tabIndex="tabIndex"></tab-bar>-->
|
|
|
<!-- </view>-->
|
|
|
+
|
|
|
+
|
|
|
+ <uni-popup ref="strategyListPoup">
|
|
|
+
|
|
|
+ <view class="flex-col justify-start expirePopup" >
|
|
|
+ <view class="flex-row justify-center">
|
|
|
+ <text class="popupTitle">新人专享</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <scroll-view scroll-y class="flex-col justify-start scroll-y1">
|
|
|
+ <view class="flex-col">
|
|
|
+
|
|
|
+ <u--form
|
|
|
+ labelPosition="left"
|
|
|
+ :model="phoneParam"
|
|
|
+ :rules="rules"
|
|
|
+ ref="form1"
|
|
|
+ >
|
|
|
+ <u-form-item
|
|
|
+ label="手机号"
|
|
|
+ prop="phonenumber"
|
|
|
+ labelWidth="auto"
|
|
|
+ labelAlign="right"
|
|
|
+ >
|
|
|
+ <u--input
|
|
|
+ v-model="phoneParam.phonenumber"
|
|
|
+ placeholder="请输入手机号"
|
|
|
+ border="bottom"
|
|
|
+ type="number"
|
|
|
+ maxlength="11"
|
|
|
+ ></u--input>
|
|
|
+ </u-form-item>
|
|
|
+ <u-form-item
|
|
|
+ labelWidth="auto"
|
|
|
+ labelAlign="right"
|
|
|
+ label="验证码"
|
|
|
+ prop="smsCode"
|
|
|
+ width="120"
|
|
|
+ >
|
|
|
+ <u--input
|
|
|
+ v-model="phoneParam.smsCode"
|
|
|
+ disabledColor="#ffffff"
|
|
|
+ placeholder="请输入验证码"
|
|
|
+ border="bottom"
|
|
|
+ maxlength="4"
|
|
|
+ ></u--input>
|
|
|
+ <template #right>
|
|
|
+ <view class="identifying-code">
|
|
|
+ <u-code
|
|
|
+ ref="uCode3"
|
|
|
+ @change="codeChange2"
|
|
|
+ keep-running
|
|
|
+ start-text="获取验证码"
|
|
|
+ ></u-code>
|
|
|
+ <text
|
|
|
+ @tap="getCode2"
|
|
|
+ :text="tips2"
|
|
|
+ class="u-page__code-text"
|
|
|
+ >{{ tips2 }}
|
|
|
+ </text>
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ </u-form-item>
|
|
|
+ </u--form>
|
|
|
+
|
|
|
+ <view class="flex-col justify-start">
|
|
|
+ <text style="font-size: 28rpx;color: #333333;text-align: center">{{rule.title}}</text>
|
|
|
+
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="flex-col " v-for="(item,index) in rule.strategyList" :key="index" >
|
|
|
+ <view class="flex-row justify-start quan " :class="[item.select == 1 ? 'row-list' : 'listBackground']" @click="selectQuan(item,index)">
|
|
|
+ <view class=" h-text flex-col justify-center ">
|
|
|
+ <view class="money">
|
|
|
+ <text class="money" v-if="item.discountsType == 2">{{item.discount}}折</text>
|
|
|
+ <text class="money" v-else>{{`减` + item.discountsPrice}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="desc">
|
|
|
+ <text>满{{item.reachPrice}}可用</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class=" h-center-content flex-col justify-around">
|
|
|
+ <view class="h-value">
|
|
|
+ <text>{{item.name}}</text>
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ <view class="title">
|
|
|
+ 可用次数:{{item.degree}}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="title flex-row">
|
|
|
+ <text @click="showRemark(item)">使用说明</text>
|
|
|
+ <u-icon v-if="item.id == showRemarkId" name="arrow-down-fill" color="" size="12"></u-icon>
|
|
|
+ <u-icon v-else name="play-right-fill" color="" size="12"></u-icon>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-if="showRemarkId == item.id" class="remark" style="text-indent:unset">
|
|
|
+ <view class="remarkText">
|
|
|
+ <view>
|
|
|
+ 可用门店:<text>{{item.useStoreDesc}}</text>
|
|
|
+ </view>
|
|
|
+ <view>
|
|
|
+ 适用项目:<text>{{item.useServiceDesc}}</text>
|
|
|
+ </view>
|
|
|
+ <view v-if="item.remark !=null">
|
|
|
+ 使用说明:<text>{{item.remark}}</text>
|
|
|
+ </view>
|
|
|
+ <text v-else class="remarkText">该优惠券暂无使用说明</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </scroll-view>
|
|
|
+
|
|
|
+ <view @click="userBindMember" class="op-btn-wrap">
|
|
|
+ <view class="h-btn">
|
|
|
+ <text v-if="rule.isAllReceived == 1">全部领取</text>
|
|
|
+ <text v-else>确定 (可选{{rule.receivedCount}}张优惠券)</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </uni-popup>
|
|
|
+
|
|
|
+
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
@@ -250,6 +380,7 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+
|
|
|
isGetAddress: true, //是否获取到了经纬度
|
|
|
noticeList: [],
|
|
|
notice: '',
|
|
|
@@ -264,6 +395,43 @@ export default {
|
|
|
},
|
|
|
storeList: [],
|
|
|
storeInfo: {},
|
|
|
+
|
|
|
+ showRemarkId:'',
|
|
|
+ rule:[],
|
|
|
+ tips2: '',
|
|
|
+
|
|
|
+ phoneParam: {
|
|
|
+ phonenumber: '',
|
|
|
+ smsCode: '',
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ phonenumber: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ min: 11,
|
|
|
+ max: 11,
|
|
|
+ message: '请输入11位电话号码',
|
|
|
+ trigger: ['blur', 'change'],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
|
|
|
+ return !this.$isDataEmpty(value);
|
|
|
+ },
|
|
|
+ message: "请认真填写电话号码",
|
|
|
+ trigger: ['blur', 'change'],
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ smsCode: {
|
|
|
+ required: true,
|
|
|
+ min: 4,
|
|
|
+ max: 6,
|
|
|
+ message: '请输入4位验证码',
|
|
|
+ trigger: ['blur', 'change'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -291,13 +459,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onLoad(e) {
|
|
|
+
|
|
|
+ //程序启动时自动登录成功时触发的事件
|
|
|
+ uni.$off('loginSuccess')
|
|
|
+ uni.$on('loginSuccess',this.getRuleById)
|
|
|
+
|
|
|
console.log(e)
|
|
|
if (e.shareUserId) {
|
|
|
//用户点击分享到好友或者朋友圈传递过来的参数
|
|
|
uni.setStorageSync('shareUserId', e.shareUserId)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (e.q) {
|
|
|
//用户扫技师端或者拓客端二维码传递过来的参数
|
|
|
|
|
|
@@ -387,6 +559,127 @@ export default {
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
+
|
|
|
+
|
|
|
+ userBindMember (){
|
|
|
+ let expandParam = uni.getStorageSync('expandParam')
|
|
|
+ let that = this
|
|
|
+ this.$refs.form1.validate().then(res => {
|
|
|
+ let couponIds = []
|
|
|
+ for (const strategy of this.rule.strategyList) {
|
|
|
+ if (strategy.select == 1){
|
|
|
+ couponIds.push(strategy.id)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //用户扫码拓客端进入小程序
|
|
|
+ that.$api.userBindMember(
|
|
|
+ {
|
|
|
+ ...expandParam,
|
|
|
+ memberId: this.userInfo.id,
|
|
|
+ memberPhone:this.phoneParam.phonenumber,
|
|
|
+ code:this.phoneParam.code,
|
|
|
+ couponIds: couponIds
|
|
|
+ }
|
|
|
+ ).then(res1 => {
|
|
|
+ console.log('拓客端推广用户绑定成功!')
|
|
|
+
|
|
|
+ that.$api.addRecordForAttach({
|
|
|
+ ...expandParam,
|
|
|
+ isNew:1,
|
|
|
+ isBindSuccess:1,
|
|
|
+ }).then(res=>{
|
|
|
+ console.log('+++++++++新用户,扫码推广成功记录!++++++++++++++++')
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.removeStorageSync('expandParam');
|
|
|
+ }).catch(err=>{
|
|
|
+
|
|
|
+ that.$api.addRecordForAttach({
|
|
|
+ ...expandParam,
|
|
|
+ isNew:1,
|
|
|
+ isBindSuccess:0,
|
|
|
+ }).then(res=>{
|
|
|
+ console.log('+++++++++新用户,扫码推广失败记录!++++++++++++++++')
|
|
|
+ })
|
|
|
+
|
|
|
+ uni.removeStorageSync('expandParam');
|
|
|
+ })
|
|
|
+
|
|
|
+ }).catch(errors => {
|
|
|
+ console.log(errors)
|
|
|
+ uni.$u.toast('校验失败,请认真填写')
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ codeChange2(text) {
|
|
|
+ this.tips2 = text;
|
|
|
+ },
|
|
|
+ getCode2() {
|
|
|
+ let that = this;
|
|
|
+ if (this.$refs.uCode3.canGetCode) {
|
|
|
+ that.getPhoneCode();
|
|
|
+ } else {
|
|
|
+ uni.$u.toast('倒计时结束后再发送');
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取验证码
|
|
|
+ getPhoneCode() {
|
|
|
+ let that = this;
|
|
|
+ // 模拟向后端请求验证码
|
|
|
+ uni.showLoading({
|
|
|
+ title: '正在获取验证码'
|
|
|
+ })
|
|
|
+ this.$api.getSmsCodeByType({phonenumber: this.phoneParam.phonenumber, auth: true, type: 0}).then((res) => {
|
|
|
+ uni.hideLoading();
|
|
|
+ // 这里此提示会被this.start()方法中的提示覆盖
|
|
|
+ uni.$u.toast('验证码已发送');
|
|
|
+ // 通知验证码组件内部开始倒计时
|
|
|
+ that.$refs.uCode3.start();
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ showRemark(item){
|
|
|
+ if (this.showRemarkId == item.id ){
|
|
|
+ this.showRemarkId = ''
|
|
|
+
|
|
|
+ }else {
|
|
|
+ this.showRemarkId = item.id
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ getRuleById(){
|
|
|
+ let expandParam = uni.getStorageSync('expandParam')
|
|
|
+ this.$api.getRuleById({
|
|
|
+ id: expandParam.ruleId
|
|
|
+ }).then(res=>{
|
|
|
+ this.rule = res.data.data
|
|
|
+
|
|
|
+ if (this.rule.strategyList.length > 0){
|
|
|
+ for (const strategy of this.rule.strategyList) {
|
|
|
+ if (this.rule.isAllReceived == 1){
|
|
|
+ strategy.select = 1
|
|
|
+ }else {
|
|
|
+ strategy.select = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$refs.strategyListPoup.open()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ selectQuan(item,index){
|
|
|
+ if (this.rule.isAllReceived == 1){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ console.log(item)
|
|
|
+ item.select = item.select ? 0 : 1
|
|
|
+ this.$set(this.rule.strategyList,index,item)
|
|
|
+ },
|
|
|
+
|
|
|
operLog() {
|
|
|
let param = uni.getStorageSync('promotionParam')
|
|
|
let userInfo = uni.getStorageSync('userInfo')
|
|
|
@@ -635,6 +928,9 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+
|
|
|
+@import "index.rpx.css";
|
|
|
+
|
|
|
/* 头部内容 */
|
|
|
.head-wrap {
|
|
|
height: 100vh;
|