zs 2 years ago
parent
commit
30088566b0
1 changed files with 10 additions and 18 deletions
  1. 10 18
      pages/my/index.vue

+ 10 - 18
pages/my/index.vue

@@ -127,24 +127,16 @@
 				let user = that.user;
 				if (config) {
 					if (user && user._id) {
-						for (let val of config.my_orderList) {
-							let res;
-							if (val.status == '0') {
-								res = await that.$api(`/order`, 'GET', {
-									status: val.status,
-									customer: user._id,
-									limit: 1
-								});
-							} else {
-								res = await that.$api(`/orderDetail`, 'GET', {
-									status: val.status,
-									customer: user._id,
-									limit: 1
-								});
-							}
-							if (res.errcode == '0') {
-								val.num = res.total
-								that.$forceUpdate()
+						let res = await that.$api(`/viewUser/toDeal`, 'GET');
+						if (res.errcode == '0') {
+							for (let val of config.my_orderList) {
+								if (val.type == "order") {
+									if (val.status == '0') val.num = res.data.notPay
+									if (val.status == '1') val.num = res.data.isPay
+									if (val.status == '2') val.num = res.data.allSend
+								} else {
+									val.num = res.data.afterSale;
+								}
 							}
 						}
 					}