|
@@ -12,23 +12,23 @@
|
|
</view> -->
|
|
</view> -->
|
|
<scroll-view scroll-y="true" style="height: 550rpx;">
|
|
<scroll-view scroll-y="true" style="height: 550rpx;">
|
|
<view class="couponList">
|
|
<view class="couponList">
|
|
- <view class="couponItem" v-for="(item,index) in 4" :key="index">
|
|
|
|
|
|
+ <view class="couponItem" v-for="(item,index) in list" :key="index">
|
|
<view class="couponItem-subject">
|
|
<view class="couponItem-subject">
|
|
<view class="couponItem-subject-left">
|
|
<view class="couponItem-subject-left">
|
|
<view class="couponItem-subject-price">
|
|
<view class="couponItem-subject-price">
|
|
<text class="couponItem-subject-icon">¥</text>
|
|
<text class="couponItem-subject-icon">¥</text>
|
|
- <text class="couponItem-subject-price-min">39</text>
|
|
|
|
- <view class="couponItem-subject-price-reduce">满88元可用</view>
|
|
|
|
|
|
+ <text class="couponItem-subject-price-min">{{item.money/100}}</text>
|
|
|
|
+ <view class="couponItem-subject-price-reduce">{{item.name}}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="couponItem-subject-right">
|
|
<view class="couponItem-subject-right">
|
|
<view class="couponItem-subject-right-header">
|
|
<view class="couponItem-subject-right-header">
|
|
- <span class="couponItem-subject-right-header-icon">满减</span>
|
|
|
|
- 仅可购买本店铺商品
|
|
|
|
|
|
+ <span class="couponItem-subject-right-header-icon">{{item.type==1?'满减':'折扣'}}</span>
|
|
|
|
+ {{item.title}}
|
|
</view>
|
|
</view>
|
|
- <button data-index="" @click="collectCoupons" class="couponItem-subject-right-btn">使用</button>
|
|
|
|
|
|
+ <button :data-index="index" @click="collectCoupons(item,index)" class="couponItem-subject-right-btn">使用</button>
|
|
<view class="closing-date">
|
|
<view class="closing-date">
|
|
- 11月2日 - 11月30日
|
|
|
|
|
|
+ {{item.start_time}} - {{item.end_time}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -136,7 +136,7 @@
|
|
onShow() {
|
|
onShow() {
|
|
this.orderAmount = this.norderAmount + "元"
|
|
this.orderAmount = this.norderAmount + "元"
|
|
this.getUserInfo()
|
|
this.getUserInfo()
|
|
- this.getUserCoupon()
|
|
|
|
|
|
+ this.getcoupon()
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -163,10 +163,33 @@
|
|
show: false,
|
|
show: false,
|
|
maxnum: 6,
|
|
maxnum: 6,
|
|
password: "",
|
|
password: "",
|
|
- discountshow: false
|
|
|
|
|
|
+ discountshow: false,
|
|
|
|
+ list: [],
|
|
|
|
+ couponid: ""
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ getcoupon: async function() {
|
|
|
|
+ let res = await this.$request.post("/api/v1/coupon/userCouponList", {
|
|
|
|
+ page: this.pageindex
|
|
|
|
+ })
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res.status == 0) {
|
|
|
|
+ if (this.pageindex > res.data.last_page) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "没有更多了",
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.list = this.list.concat(res.data.data)
|
|
|
|
+ this.list.forEach(item => {
|
|
|
|
+ item.start_time = this.$util.formatDate(item.start_time)
|
|
|
|
+ item.end_time = this.$util.formatDate(item.end_time)
|
|
|
|
+ })
|
|
|
|
+ this.pageindex++
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
// 选中某个单选框时,由radio时触发
|
|
// 选中某个单选框时,由radio时触发
|
|
discount() {
|
|
discount() {
|
|
|
|
|
|
@@ -185,6 +208,23 @@
|
|
click(e) {
|
|
click(e) {
|
|
console.log(e)
|
|
console.log(e)
|
|
},
|
|
},
|
|
|
|
+ collectCoupons(item, index) {
|
|
|
|
+ if (item.type == 1) {
|
|
|
|
+ if (item.max_reduce_amount > this.infodata.total_amount * 100) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "满减金额不够",
|
|
|
|
+ icon: "none"
|
|
|
|
+ })
|
|
|
|
+ return false
|
|
|
|
+ } else {
|
|
|
|
+ this.coupon = item.name
|
|
|
|
+ this.couponid = item.id
|
|
|
|
+ let price = (this.norderAmount * 100) - item.money
|
|
|
|
+ this.norderAmount = price
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
confirmpay() {
|
|
confirmpay() {
|
|
if (this.info.balance < this.infodata.total_amount * 100) {
|
|
if (this.info.balance < this.infodata.total_amount * 100) {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
@@ -204,10 +244,6 @@
|
|
this.show = true
|
|
this.show = true
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- getUserCoupon: async function() {
|
|
|
|
- let res = await this.$request.post("/api/v1/coupon/userCouponList")
|
|
|
|
- console.log(res)
|
|
|
|
- },
|
|
|
|
getUserInfo: async function() {
|
|
getUserInfo: async function() {
|
|
let res = await this.$request.post('/api/v1/user/userInfo')
|
|
let res = await this.$request.post('/api/v1/user/userInfo')
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|
|
@@ -225,7 +261,8 @@
|
|
schedule_date: this.infodata.schedule_date,
|
|
schedule_date: this.infodata.schedule_date,
|
|
time_period_id: this.infodata.time_period_id,
|
|
time_period_id: this.infodata.time_period_id,
|
|
payment_type: this.infodata.payment_type,
|
|
payment_type: this.infodata.payment_type,
|
|
- pay_password: this.password
|
|
|
|
|
|
+ pay_password: this.password,
|
|
|
|
+ user_coupon_id:this.couponid
|
|
})
|
|
})
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|
|
this.popupShow = false
|
|
this.popupShow = false
|
|
@@ -285,7 +322,8 @@
|
|
guardian_name: this.infodata.guardian_name,
|
|
guardian_name: this.infodata.guardian_name,
|
|
relationship_type: this.infodata.relationship_type,
|
|
relationship_type: this.infodata.relationship_type,
|
|
payment_type: this.infodata.payment_type,
|
|
payment_type: this.infodata.payment_type,
|
|
- pay_password: this.password
|
|
|
|
|
|
+ pay_password: this.password,
|
|
|
|
+ user_coupon_id:this.couponid
|
|
})
|
|
})
|
|
console.log(res)
|
|
console.log(res)
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|
|
@@ -346,7 +384,8 @@
|
|
phone: this.infodata.phone,
|
|
phone: this.infodata.phone,
|
|
phone_minutes: this.infodata.phone_minutes,
|
|
phone_minutes: this.infodata.phone_minutes,
|
|
payment_type: 2,
|
|
payment_type: 2,
|
|
- pay_password: this.password
|
|
|
|
|
|
+ pay_password: this.password,
|
|
|
|
+ user_coupon_id:this.couponid
|
|
})
|
|
})
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|
|
this.popupShow = false
|
|
this.popupShow = false
|
|
@@ -406,7 +445,8 @@
|
|
symptoms: this.infodata.symptoms,
|
|
symptoms: this.infodata.symptoms,
|
|
medical_imgs: JSON.stringify(this.infodata.medical_imgs),
|
|
medical_imgs: JSON.stringify(this.infodata.medical_imgs),
|
|
payment_type: 2,
|
|
payment_type: 2,
|
|
- pay_password: this.password
|
|
|
|
|
|
+ pay_password: this.password,
|
|
|
|
+ user_coupon_id:this.couponid
|
|
})
|
|
})
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|
|
this.popupShow = false
|
|
this.popupShow = false
|
|
@@ -462,13 +502,13 @@
|
|
product_type: this.infodata.product_type,
|
|
product_type: this.infodata.product_type,
|
|
patient_id: this.infodata.patient_id,
|
|
patient_id: this.infodata.patient_id,
|
|
total_amount: this.infodata.total_amount * 100,
|
|
total_amount: this.infodata.total_amount * 100,
|
|
- user_coupon_id: "",
|
|
|
|
organization_id: this.infodata.organization_id,
|
|
organization_id: this.infodata.organization_id,
|
|
schedule_date: this.infodata.schedule_date,
|
|
schedule_date: this.infodata.schedule_date,
|
|
time_period_id: this.infodata.time_period_id,
|
|
time_period_id: this.infodata.time_period_id,
|
|
vaccine_id: this.infodata.vaccine_id,
|
|
vaccine_id: this.infodata.vaccine_id,
|
|
payment_type: this.infodata.payment_type,
|
|
payment_type: this.infodata.payment_type,
|
|
- pay_password: this.password
|
|
|
|
|
|
+ pay_password: this.password,
|
|
|
|
+ user_coupon_id:this.couponid
|
|
})
|
|
})
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|
|
this.popupShow = false
|
|
this.popupShow = false
|
|
@@ -525,13 +565,13 @@
|
|
product_type: this.infodata.product_type,
|
|
product_type: this.infodata.product_type,
|
|
patient_id: this.infodata.patient_id,
|
|
patient_id: this.infodata.patient_id,
|
|
total_amount: this.infodata.total_amount * 100,
|
|
total_amount: this.infodata.total_amount * 100,
|
|
- user_coupon_id: "",
|
|
|
|
organization_id: this.infodata.organization_id,
|
|
organization_id: this.infodata.organization_id,
|
|
schedule_date: this.infodata.schedule_date,
|
|
schedule_date: this.infodata.schedule_date,
|
|
time_period_id: this.infodata.time_period_id,
|
|
time_period_id: this.infodata.time_period_id,
|
|
nurse_ids: JSON.stringify(this.infodata.nurse_ids),
|
|
nurse_ids: JSON.stringify(this.infodata.nurse_ids),
|
|
payment_type: this.infodata.payment_type,
|
|
payment_type: this.infodata.payment_type,
|
|
- pay_password: this.password
|
|
|
|
|
|
+ pay_password: this.password,
|
|
|
|
+ user_coupon_id:this.couponid
|
|
})
|
|
})
|
|
console.log(res)
|
|
console.log(res)
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|