mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 10:27:01 +08:00
Coupon flow completed
This commit is contained in:
@@ -65,12 +65,12 @@
|
||||
<span>配送方式:</span>
|
||||
<i>{{ shopprice.price }}</i>
|
||||
</li>
|
||||
<!--
|
||||
|
||||
<li>
|
||||
<span> 活动促销:</span>
|
||||
<i>{{ shopprice.distribution }}</i>
|
||||
<i class="ts-right-arr ts-right-arr--two" @click="userget()">{{ curCoupon.couponName }}</i>
|
||||
</li>
|
||||
-->
|
||||
|
||||
<li>
|
||||
<span>商品总价:</span>
|
||||
<i class="red">{{ sumPrice }}</i>
|
||||
@@ -147,12 +147,43 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="dialogInfo1" class="pop_coupon">
|
||||
<div class="ts-no-data" v-if="drawlist.length<=0">您还没有优惠券,可在商品的详情页面中领取</div>
|
||||
<div class="rs-dis">
|
||||
<div
|
||||
class="rc-discount"
|
||||
v-for="(item, index) in drawlist"
|
||||
:key="index"
|
||||
>
|
||||
<img :src="userimage" alt="" />
|
||||
<div class="rc-contair">
|
||||
<div class="rc-left">
|
||||
<div v-if="item.couponAmount">
|
||||
<i>¥</i><span>{{ item.couponAmount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rc-right">
|
||||
<i>
|
||||
{{ item.couponDesc }}
|
||||
</i>
|
||||
<div v-show="item.validTo">
|
||||
<span>有效期</span>
|
||||
<em>{{ item.validTo }}</em>
|
||||
</div>
|
||||
<div class="rc-footer">
|
||||
<span @click="pickCoupon(item)">立即使用</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Myheader from "~/components/header.vue";
|
||||
import { userin, memberAddress, generateOrderWX } from "../../ajax/getData";
|
||||
import { userin, memberAddress, generateOrderWX, getdraw } from "../../ajax/getData";
|
||||
import tabs from "@/components/tabs.vue";
|
||||
import myAddress from "~/components/address.vue";
|
||||
import { mapMutations } from "vuex";
|
||||
@@ -170,6 +201,10 @@ export default {
|
||||
path:'/personal/settlement'
|
||||
}
|
||||
],
|
||||
userimage: require("../../assets/image/unused.png"),
|
||||
curCoupon:{couponName:'未选择可用优惠券'},
|
||||
drawlist:[],
|
||||
dialogInfo1:false,
|
||||
goldmedal: [],
|
||||
dialogAddTitle: "",
|
||||
addressstype: null,
|
||||
@@ -210,7 +245,6 @@ export default {
|
||||
// 总价计算
|
||||
sumPrice() {
|
||||
return this.goldmedal.reduce((pre, cur) => {
|
||||
console.log(pre);
|
||||
return pre + cur.buyCount * cur.productPrice;
|
||||
}, 0);
|
||||
},
|
||||
@@ -229,6 +263,35 @@ export default {
|
||||
});
|
||||
this.useraddress = data;
|
||||
},
|
||||
userget(){
|
||||
let user = this.$store.state.userInfo;
|
||||
if (user) {
|
||||
this.userdraw(user.data.mobile);
|
||||
this.dialogInfo1 = true;
|
||||
} else {
|
||||
this.$router.push({
|
||||
path: "/userlogin/login",
|
||||
});
|
||||
}
|
||||
},
|
||||
//获取用户领取的优惠券
|
||||
async userdraw(mobile) {
|
||||
let data = await getdraw(mobile);
|
||||
let _self = this;
|
||||
if (data) {
|
||||
//TODO check status = 0
|
||||
this.drawlist=[];
|
||||
data.data.forEach((item) => {
|
||||
if(item.status==0) {
|
||||
_self.drawlist.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
pickCoupon(item){
|
||||
this.curCoupon = item;
|
||||
this.dialogInfo1 = false;
|
||||
},
|
||||
editAddress(item) {
|
||||
this.dialogAddTitle = "修改收货地址";
|
||||
this.editAddressData = {
|
||||
@@ -331,6 +394,13 @@ export default {
|
||||
addressDetailInfo: orderAddress[0].detailAddress,
|
||||
},
|
||||
};
|
||||
if(this.curCoupon.couponId) {
|
||||
oneProduct.couponId = this.curCoupon.couponId;
|
||||
oneProduct.couponTypeId = this.curCoupon.couponTypeId;
|
||||
oneProduct.couponName = this.curCoupon.couponName;
|
||||
oneProduct.couponCode = this.curCoupon.couponCode;
|
||||
oneProduct.couponAmount = (this.curCoupon.couponAmount?this.curCoupon.couponAmount:this.curCoupon.discount);
|
||||
}
|
||||
postData.push(oneProduct);
|
||||
});
|
||||
// let postData = [
|
||||
@@ -405,9 +475,6 @@ export default {
|
||||
},
|
||||
async canceldanhao(orderNumber) {
|
||||
let data = await userin(orderNumber);
|
||||
console.log(data);
|
||||
// this.goldmedal=data;
|
||||
console.log(this.goldmedal);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
Reference in New Issue
Block a user