This commit is contained in:
952108534@qq.com
2022-01-22 19:22:17 +08:00
parent 38792ccbd6
commit 95614b9c66
4 changed files with 318 additions and 46 deletions

View File

@@ -1,6 +1,7 @@
<template>
<div>
<div class="user-main">
<Myheader></Myheader>
<div class="rc-top"></div>
<div class="rc-main" v-for="(item,index) in goldmedal" :key="item.id" >
<div class="rc-receiving" >
<em>{{item.status=='0'?'待付款':item.status=='1'?'待收货':item.status=='2'?'已完成':item.status=='3'?'已取消':'异常订单'}}</em>
@@ -53,11 +54,11 @@
<span>数量:{{ item.pcs }}</span>
<i>{{ item.ecPrice }}</i>
<div class="rc-bottom">
<span>联系客服申请售后</span>
<span @click="userpay()">{{customer}}</span>
</div>
</div>
<div class="rc-bottomm">
<span>联系客服申请售后</span>
<span @click="userpay()">{{customer}}</span>
</div>
<!-- <div class="rc-userbottomm">
<i>{{ item.userprice }}</i>
@@ -109,8 +110,8 @@
<li>
<span>快递单号:</span>
<div class="u-trackingnumber">
<!-- <i>{{ userlist.logisticsNumber }}
</i> -->
<i>{{ logisticsNumber }}
</i>
<!-- <img :src="information.catimage" alt=""> -->
</div>
</li>
@@ -122,33 +123,49 @@
<div class="rc-foo">
<div style="padding-top:55px">
<i>合计金额:</i>
<em>167.00</em>
<em>{{usersalesAmount}}</em>
</div>
<div style="padding-bottom:40px">
<span>再次购买</span>
<span @click="onceagain">再次购买</span>
</div>
</div>
</div>
</div>
</div>
<div class="rc-full-width rc-margin-y--md">
<i class="ts-standard-btn ts-standard-btn--two center" @click="onceagain">
{{payorsucess}}
</i>
</div>
<MyFooter></MyFooter>
</div>
</template>
<script>
import Myheader from "~/components/header.vue";
import { userin} from "../../ajax/getData";
import {selectaddress} from "../../ajax/getData";
import MyFooter from '~/components/rc-footer.vue'
import {selectaddress,canceldanhao,generateOrderWX} from "../../ajax/getData";
export default {
data() {
return {
goldmedal:[],
userproductId:'',
userphone:'',
logisticsNumber:'',
customer:'',//联系客服或者取消订单
payorsucess:'', //立即支付或者再次购买,
addressstype: null,
addressUserName:'',
orderstatus: '',
goldastates:'',
userisdelivery:'待收货',
userdelivery: "派送中",
isshow:true,
usersalesAmount:'',
leftico: require("../../assets/image/rc-left.png"),
orderNumber:'',
usermessage:null,
@@ -180,19 +197,106 @@ export default {
},
methods: {
async canceldanhao(orderNumber){
let data=await userin(orderNumber);
this.goldmedal=data;
console.log(this.goldmedal[0].orderDetailList);
for(let i =0;i<this.goldmedal[i].length;i++){
console.log(this.goldmedal[i].orderDetailList);
// this.useralllist.push(this.goldmedal[i].orderDetailList);
//取消订单
async canceldanhao(orderNumber) {
let data = await canceldanhao(this.userphone,this.orderNumber);
if (data) {
this.$message({
type: "warning",
message: "取消订单成功",
});
setTimeout(() => {
this.$router.push({
path: "/personal/useraddress",
query: {
stype: 1,
},
});
}, 500);
}
},
userpay(){
console.log('---');
if(this.goldastates==0){
this.canceldanhao();
}
console.log(this.useralllist);
},
//查询人的所有地址
async editaddress(user) {
//订单支付和再次购买
onceagain(){
console.log(this.payorsucess);
if(this.payorsucess=='立即支付'){
console.log('----')
this.getwei();
}else{
this.$router.push({
path: "/productdetails/producted",
query: {
stype: 1,
productCode: this.userproductId
},
});
console.log('不是立即支付');
}
},
async orderquantity(orderNumber){
let data=await userin(orderNumber);
if(data){
this.goldmedal=data;
for(let i=0;i<this.goldmedal.length;i++){
this.goldmedal[i].status=0
this.goldastates=this.goldmedal[i].status;
this.userproductId=this.goldmedal[i].orderDetailList[0].productId;
this.logisticsNumber=this.goldmedal[i].orderDetailList[0].logisticsNumber;
this.orderNumber=this.goldmedal[i].orderNumber
this.usersalesAmount=this.goldmedal[i].salesAmount;
this.addressUserName=this.goldmedal[i].addressUserName;
}
console.log(this.goldmedal,this.userproductId,this.usersalesAmount);
}
},
//订单立即支付
async getwei(user) {
let postData = [];
let oneProduct = {
productName: item.productName,
buyCount: item.buyCount,
productId: item.productCode,
payAmount: item.productPrice,
memberId: item.memberId,
phoneNumber: item.mobile,
orderAddress: {
addressPhoneNumber: orderAddress[0].recipientPhone,
addressUserName: orderAddress[0].recipient,
addressProvinceName: orderAddress[0].provinceName,
addressCityName: orderAddress[0].cityName,
addressCountyName: orderAddress[0].districtName,
addressDetailInfo: orderAddress[0].detailAddress,
},
};
let res = await generateOrderWX(postData);
let userPayData = {
orderId: res.data,
userprice: this.usersalesAmount, //订单总价
userinformation:
this.addressUserName+ //姓名
" " +
this.userphone, //电话
wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz",
};
this.$router.push({
path: "/personal/userpay",
query: {
userPayData:JSON.stringify(userPayData),
},
});
},
async editaddress(user) {
// user.data.id=844350;
let data = await selectaddress(this.userid);
console.log(data);
@@ -205,6 +309,7 @@ export default {
}
this.useraddress=list;
console.log(list);
console.log(this.goldmedal);
// console.log(this.list);
},
@@ -214,36 +319,44 @@ export default {
mounted() {
this.usermessage = JSON.parse(localStorage.getItem("userInfo"));
this.userid = this.usermessage.data.id;
console.log(this.userid);
this.userphone=this.usermessage.data.mobile;
this.editaddress(this.userid);
this.addressstype = this.$route.query.stype;
this.orderNumber=this.$route.query.orderNumber;
this.canceldanhao(this.orderNumber)
console.log(this.orderNumber);
this.orderquantity(this.orderNumber)
if(this.addressstype==2){
this.orderstatus='您的订单已付款成功请耐心等候我们会尽快安排给您发货';
this.orderstatus='您的订单已完成';
this.isshow=false;
this.userisdelivery='待发货';
this.customer='联系客服申请售后'
this.payorsucess='再次购买'
console.log( this.orderstatus);
}else if(this.addressstype==0){
this.orderstatus='您的订单尚未支付';
this.orderstatus='您的订单还未付款请尽快付款';
this.isshow=false;
this.userisdelivery='待付款';
this.customer='取消订单'
this.payorsucess='立即支付'
}
else if(this.addressstype==1){
this.orderstatus='您的订单发货耐心等候';
this.orderstatus='您的订单已发出请耐心等候';
this.isshow=true;
this.userisdelivery='待收货';
this.customer='联系客服申请售后'
this.payorsucess='再次购买'
}
else if(this.addressstype==3){
this.orderstatus='您的订单已取消';
this.isshow=false;
this.userisdelivery='已取消';
this.customer='联系客服申请售后'
this.payorsucess='再次购买'
}
console.log(this.addressstype);
},
components: {
Myheader,
MyFooter,
},
};
</script>