|
@@ -24,7 +24,7 @@
|
|
|
<view class="one_4" v-if="couponList.length>0">
|
|
|
<view class="left">优惠券</view>
|
|
|
<view class="right" @tap="toCoupon">
|
|
|
- <text v-if="discountInfo.name">{{discountInfo.name}}</text>
|
|
|
+ <text class="text" v-if="discountInfo.name">{{discountInfo.name}}</text>
|
|
|
<text class="iconfont icon-dayuhao"></text>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -92,7 +92,8 @@
|
|
|
<uni-easyinput v-model="form.card" minlength="18" maxlength="18" placeholder="必填,请输入证件号" />
|
|
|
</uni-forms-item>
|
|
|
<uni-forms-item label="手机号" name="phone" required>
|
|
|
- <uni-easyinput v-model="form.phone" minlength="11" maxlength="11" placeholder="必填,请输入联系人手机号" />
|
|
|
+ <uni-easyinput v-model="form.phone" minlength="11" maxlength="11"
|
|
|
+ placeholder="必填,请输入联系人手机号" />
|
|
|
</uni-forms-item>
|
|
|
</uni-forms>
|
|
|
<button class="button" type="primary" @click="submit">保存</button>
|
|
@@ -123,8 +124,7 @@
|
|
|
</view>
|
|
|
<view class="center">
|
|
|
<view class="name textOver">{{item.name}}</view>
|
|
|
- <view class="content">有效日期:({{item.expire_type_label}}) {{item.expire_time}}
|
|
|
- </view>
|
|
|
+ <view class="content">有效日期:{{item.time}}</view>
|
|
|
</view>
|
|
|
<view class="right">
|
|
|
<button class="button_1" type="primary" @tap="toUser(item)">使用</button>
|
|
@@ -192,7 +192,8 @@
|
|
|
errorMessage: '请填写手机号码',
|
|
|
}, {
|
|
|
validateFunction: function(rule, value, data, callback) {
|
|
|
- let iphoneReg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
|
|
+ let iphoneReg =
|
|
|
+ /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
|
|
if (!iphoneReg.test(value)) {
|
|
|
callback('手机号码格式不正确,请重新填写')
|
|
|
}
|
|
@@ -359,7 +360,27 @@
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
});
|
|
|
- } else that.$set(that, `discountInfo`, item);
|
|
|
+ } else {
|
|
|
+ const date = moment().format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ const time = item.time.split('至');
|
|
|
+ // 判断日期是否在开始日期和结束日期中间,并且可能是开始日期或者结束日期
|
|
|
+ const startDate = time[0];
|
|
|
+ const endDate = time[1];
|
|
|
+ const format = 'YYYY-MM-DD HH:mm:ss';
|
|
|
+ const diffStart =
|
|
|
+ moment(startDate, format).diff(moment(date, format), 'days') <= 0;
|
|
|
+ const diffEnd =
|
|
|
+ moment(endDate, format).diff(moment(date, format), 'days') >= 0;
|
|
|
+ const diffDtate = diffStart && diffEnd;
|
|
|
+ if (diffDtate) that.$set(that, `discountInfo`, item);
|
|
|
+ else {
|
|
|
+ uni.showToast({
|
|
|
+ title: '该优惠券过期了 无法使用!',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
that.toCouponClose();
|
|
|
},
|
|
|
// 关闭弹框
|
|
@@ -502,10 +523,23 @@
|
|
|
.one_4 {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
- font-size: var(--font18Size);
|
|
|
- font-weight: bold;
|
|
|
padding: 2vw;
|
|
|
border-bottom: 1px solid var(--f9Color);
|
|
|
+
|
|
|
+ .left {
|
|
|
+ font-size: var(--font18Size);
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ .right {
|
|
|
+ .text {
|
|
|
+ padding: 4px;
|
|
|
+ font-size: var(--font12Size);
|
|
|
+ color: var(--mainColor);
|
|
|
+ border-radius: 5px;
|
|
|
+ background: linear-gradient(to right, #FFA500, #FF0000);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|