Commit c8997b96 by zhangzhen

细节优化

parent 6f8cfb5e
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
code:this.code.split(" ").join(""), code:this.code.split(" ").join(""),
openShopUuid:this.openShopUuid openShopUuid:this.openShopUuid
}).then(res=>{ }).then(res=>{
console.log(res,909090) uni.hideLoading()
if(res.data.code === 200){ if(res.data.code === 200){
this.couponInfo = res.data.data this.couponInfo = res.data.data
uni.showToast({ uni.showToast({
...@@ -127,7 +127,8 @@ ...@@ -127,7 +127,8 @@
}else{ }else{
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
title:res.data.msg title:res.data.msg,
duration: 3000
}) })
} }
}) })
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
queryParams: { queryParams: {
pageSize: 10, pageSize: 10,
pageNum: 1, pageNum: 1,
useStatus: '', useStatus: '0',
}, },
eventChannel:null, eventChannel:null,
tipText:"", tipText:"",
...@@ -91,17 +91,17 @@ ...@@ -91,17 +91,17 @@
statusIndex: 0, statusIndex: 0,
statusList: [ statusList: [
{ {
label: "全部",
value: "",
},
{
label: "待使用", label: "待使用",
value: "0", value: "0",
}, },
{ {
label: "已使用", label: "已使用",
value: "1", value: "1",
} },
{
label: "已过期",
value: "2",
},
] ]
}; };
}, },
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
</view> </view>
<view v-for="(item,k) in dateList" :key="k" class="flex-1 flex-col date-item" <view v-for="(item,k) in dateList" :key="k" class="flex-1 flex-col date-item"
:class="{active:dateIndex === k}" @tap="onDateChange(k)"> :class="{active:dateIndex === k}" @tap="onDateChange(k)">
<text class="text-title text-bold text-first ">{{ k>0?item.weekday: '今天'}}</text> <text class="text-title text-bold text-first ">{{ k === 0 && item.readDate === toDayDate? '今天' : item.weekday}}</text>
<text class="text-title text-bold" style="margin-top: 12upx;">{{ item.date}}</text> <text class="text-title text-bold" style="margin-top: 12upx;">{{ item.date}}</text>
</view> </view>
</view> </view>
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
<text class="text-black text-left">{{useCouponList[selectCouponIndex].couponType==2? '团购券':'优惠券'}}</text> <text class="text-black text-left">{{useCouponList[selectCouponIndex].couponType==2? '团购券':'优惠券'}}</text>
<view class="flex-row" @tap="onNavToSelectCoupon"> <view class="flex-row" @tap="onNavToSelectCoupon">
<text class="" :class="useCouponList.length?'text-pink':'text-gray'"> <text class="" :class="useCouponList.length?'text-pink':'text-gray'">
{{ useCouponList.length && selectCouponIndex>=0? useCouponList[selectCouponIndex].name: useCouponList.length? '请选择':'暂无可用'}}</text> {{ useCouponList.length && selectCouponIndex>=0? useCouponList[selectCouponIndex].name: couponList.length? '请选择':'暂无可用'}}</text>
<text class="cuIcon-right " :class="useCouponList.length?'text-pink':'text-gray'"></text> <text class="cuIcon-right " :class="useCouponList.length?'text-pink':'text-gray'"></text>
</view> </view>
</view> </view>
...@@ -474,7 +474,8 @@ ...@@ -474,7 +474,8 @@
addM:false,//初始化加一分钟,之后不加 addM:false,//初始化加一分钟,之后不加
startHours:0, startHours:0,
endHours:48, endHours:48,
content:'' content:'',
toDayDate: '', // 今天日期
}; };
}, },
filters:{ filters:{
...@@ -519,6 +520,7 @@ ...@@ -519,6 +520,7 @@
}, },
methods: { methods: {
onInitDateList(){ onInitDateList(){
this.toDayDate = moment().format("YYYY-MM-DD")
let dateList = []; let dateList = [];
for (let i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
let obj = { let obj = {
...@@ -529,6 +531,7 @@ ...@@ -529,6 +531,7 @@
dateList.push(obj) dateList.push(obj)
} }
this.dateList = dateList; this.dateList = dateList;
console.log(this.dateList,909090)
}, },
onSetSelectTime(){ onSetSelectTime(){
if(this.dateIndex === 0){ if(this.dateIndex === 0){
...@@ -861,10 +864,19 @@ ...@@ -861,10 +864,19 @@
}).then(res => { }).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data && res.data.data.length) { if (res.data && res.data.data.length) {
this.useCouponList = res.data.data.filter(item => item.isAvailable === 0).sort((a, this.couponList = res.data.data;
b) => b.subPrice - a.subPrice); let list = res.data.data.filter(item => item.isAvailable === 0).map(item=> {
return {
...item,
subPrice: item.subPrice || 0
}
})
list.sort((a,b) => b.subPrice - a.subPrice)
this.useCouponList = list;
if(this.useCouponList.length){ if(this.useCouponList.length){
this.selectCouponIndex = 0; let i = this.useCouponList.findIndex(item=> item.duration == this.duration)
this.selectCouponIndex = i>=0? i : 0;
} }
} }
} else if (res.data.code == 401) { } else if (res.data.code == 401) {
...@@ -875,7 +887,7 @@ ...@@ -875,7 +887,7 @@
}, },
onNavToSelectCoupon() { onNavToSelectCoupon() {
let that = this; let that = this;
if (this.useCouponList.length) { if (this.useCouponList.length || this.couponList.length) {
uni.navigateTo({ uni.navigateTo({
url: "/pages/useCoupon/index", url: "/pages/useCoupon/index",
events: { events: {
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
<text class="text-title text-lg text-bold">{{item.name}}</text> <text class="text-title text-lg text-bold">{{item.name}}</text>
</view> </view>
<view v-if="item.couponType == 4" class="flex-row margin-top"> <view v-if="item.couponType == 4" class="flex-row margin-top">
<text class="">使用说明:</text> <text class="part-tip">使用说明:</text>
<text>{{item.remark || ''}}</text> <text>{{item.remark || ''}}</text>
</view> </view>
<view v-else class="flex-row margin-top"> <view v-else class="flex-row margin-top">
<text class="">使用说明:</text> <text class="part-tip">使用说明:</text>
<text class="">{{item.minPrice}}元,优惠{{item.subPrice}}</text> <text class="">{{item.minPrice}}元,优惠{{item.subPrice}}</text>
</view> </view>
<!-- <view class="flex-row margin-top"> <!-- <view class="flex-row margin-top">
...@@ -110,7 +110,15 @@ ...@@ -110,7 +110,15 @@
getUseCoupon(d).then(res => { getUseCoupon(d).then(res => {
if (res.statusCode == 200) { if (res.statusCode == 200) {
if (res.data && res.data.data.length) { if (res.data && res.data.data.length) {
this.list = res.data.data.sort((a, b) => b.subPrice - a.subPrice); let list = res.data.data.map(item=> {
return {
...item,
subPrice: item.subPrice || 0
}
})
list.sort((a, b) => b.subPrice - a.subPrice);
this.list = list;
} }
} }
}) })
...@@ -163,6 +171,9 @@ ...@@ -163,6 +171,9 @@
width: 100%; width: 100%;
padding: 20upx 30upx; padding: 20upx 30upx;
z-index: 99; z-index: 99;
.part-tip{
width: 160upx;
}
} }
.part-bottom{ .part-bottom{
display: flex; display: flex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment