Coupon flow completed

This commit is contained in:
Vion 2022-01-24 15:28:57 +08:00
parent fdac7a62b1
commit ab70862f63
4 changed files with 164 additions and 19 deletions

View File

@ -26,7 +26,6 @@ aside div[data-js-modal-menu] {
.fade-leave-active { .fade-leave-active {
opacity: 0; opacity: 0;
} }
.ts-no-data { .ts-no-data {
text-align: center; text-align: center;
margin: 3rem 0; margin: 3rem 0;
@ -818,7 +817,11 @@ picture {
margin: 0 auto; margin: 0 auto;
.el-dialog{ .el-dialog{
width: 100%; width: 100%;
}
.el-dialog__body{
max-height:50vh;
overflow-x:hidden;
overflow-y:auto;
} }
} }
#tns2-iw { #tns2-iw {

View File

@ -6,13 +6,89 @@ ul li ol li em strong i {
.rc-header { .rc-header {
width: 100%; width: 100%;
} }
.settlement { .settlement {
} }
.rc-discount {
position: relative;
width: 100%;
img {
display: block;
width: 100%;
height: 100%;
}
.rc-contair {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.rc-left {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
color: #e1001a;
width: 34%;
float: left;
height: 100%;
i {
font-style: normal;
font-size: 12px;
}
span {
font-size: 26px;
}
strong {
font-style: normal;
font-size: 12px;
display: block;
margin-top: 8px;
}
}
.rc-right {
display: flex;
flex-direction: column;
padding: 5px 10px;
justify-content: center;
height: 100%;
i {
font-style: normal;
font-size: 16px;
color: #e1001a;
}
.rc-main {
color: #999999;
font-size: 12px;
}
span {
display: block;
margin-top: 2px;
}
em {
font-style: normal;
}
}
.rc-footer {
display: flex;
justify-content: flex-end;
margin-right: 10px;
span {
width: 72px;
height: 25px;
background: #e2001a;
text-align: center;
line-height: 25px;
font-size: 12px;
color: #ffffff;
margin-bottom: 8px;
border-radius: 100px;
margin-right: 8px;
cursor: pointer;
}
}
}
.rc-main { .rc-main {
width: 92%; width: 92%;
@ -255,7 +331,7 @@ ul li ol li em strong i {
} }
ul { ul {
width: 25%; width: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;

View File

@ -65,12 +65,12 @@
<span>配送方式:</span> <span>配送方式:</span>
<i>{{ shopprice.price }}</i> <i>{{ shopprice.price }}</i>
</li> </li>
<!--
<li> <li>
<span> 活动促销:</span> <span> 活动促销:</span>
<i>{{ shopprice.distribution }}</i> <i class="ts-right-arr ts-right-arr--two" @click="userget()">{{ curCoupon.couponName }}</i>
</li> </li>
-->
<li> <li>
<span>商品总价:</span> <span>商品总价:</span>
<i class="red">{{ sumPrice }}</i> <i class="red">{{ sumPrice }}</i>
@ -147,12 +147,43 @@
</div> </div>
</div> </div>
</el-dialog> </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> </div>
</template> </template>
<script> <script>
import Myheader from "~/components/header.vue"; 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 tabs from "@/components/tabs.vue";
import myAddress from "~/components/address.vue"; import myAddress from "~/components/address.vue";
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
@ -170,6 +201,10 @@ export default {
path:'/personal/settlement' path:'/personal/settlement'
} }
], ],
userimage: require("../../assets/image/unused.png"),
curCoupon:{couponName:'未选择可用优惠券'},
drawlist:[],
dialogInfo1:false,
goldmedal: [], goldmedal: [],
dialogAddTitle: "", dialogAddTitle: "",
addressstype: null, addressstype: null,
@ -210,7 +245,6 @@ export default {
// //
sumPrice() { sumPrice() {
return this.goldmedal.reduce((pre, cur) => { return this.goldmedal.reduce((pre, cur) => {
console.log(pre);
return pre + cur.buyCount * cur.productPrice; return pre + cur.buyCount * cur.productPrice;
}, 0); }, 0);
}, },
@ -229,6 +263,35 @@ export default {
}); });
this.useraddress = data; 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) { editAddress(item) {
this.dialogAddTitle = "修改收货地址"; this.dialogAddTitle = "修改收货地址";
this.editAddressData = { this.editAddressData = {
@ -331,6 +394,13 @@ export default {
addressDetailInfo: orderAddress[0].detailAddress, 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); postData.push(oneProduct);
}); });
// let postData = [ // let postData = [
@ -405,9 +475,6 @@ export default {
}, },
async canceldanhao(orderNumber) { async canceldanhao(orderNumber) {
let data = await userin(orderNumber); let data = await userin(orderNumber);
console.log(data);
// this.goldmedal=data;
console.log(this.goldmedal);
}, },
}, },
mounted() { mounted() {

View File

@ -209,6 +209,7 @@
<Myfooter v-on:litentop="showmesg"></Myfooter> <Myfooter v-on:litentop="showmesg"></Myfooter>
</div> </div>
<el-dialog :visible.sync="dialogInfo1" @close="userclose" class="pop_coupon"> <el-dialog :visible.sync="dialogInfo1" @close="userclose" class="pop_coupon">
<div class="ts-no-data" v-if="usernewlist.length<=0">您还没有优惠券可在商品的详情页面中领取</div>
<div class="rs-dis"> <div class="rs-dis">
<div <div
class="rc-discount" class="rc-discount"
@ -226,7 +227,7 @@
<i> <i>
{{ item.couponDesc }} {{ item.couponDesc }}
</i> </i>
<div> <div v-show="item.validTo">
<span>有效期</span> <span>有效期</span>
<em>{{ item.validTo }}</em> <em>{{ item.validTo }}</em>
</div> </div>
@ -528,9 +529,7 @@ export default {
userlist.filter((item) => { userlist.filter((item) => {
item.productCodes = item.productCodes.split(","); item.productCodes = item.productCodes.split(",");
item.productCodes.forEach((element) => { item.productCodes.forEach((element) => {
if (element == this.productCode && item.activityId !== 10) { if (element == this.curItem.productCode && item.activityId !== 10) {
console.log(element);
console.log(this.productCode);
menualist.push(item); menualist.push(item);
} }
}); });