Selaa lähdekoodia

Merge branch 'main' of https://gitlab.com/tea28/client

hejie 3 vuotta sitten
vanhempi
sitoutus
21f9704c34
2 muutettua tiedostoa jossa 93 lisäystä ja 64 poistoa
  1. 92 63
      src/pages/szw-order-list/index.vue
  2. 1 1
      src/pages/to-pay-list/index.vue

+ 92 - 63
src/pages/szw-order-list/index.vue

@@ -14,6 +14,19 @@
                 <view class="a-order">
                     <view class="overflow" :data-id="li.id">
                         <view class="list-title flex_r flex_ac flex_jb ellipsis">
+                            <view class="fz_text">{{
+                                li.type == 1
+                                ? "零售专区"
+                                : li.type == 2
+                                ? "批发专区"
+                                : li.type == 3
+                                ? "精品专区"
+                                : li.type == 4
+                                ? "今日值得买"
+                                : li.type == 5
+                                ? "茶宝兑换"
+                                : ""
+                                }}</view>
                             <view class="fz_text">{{ tidyStatus([li.pay_status, li.order_status]) }}</view>
                         </view>
                         <view class="goods-info flex_r flex_ac flex_jb" :data-type="li.type" @tap="toDetails(li)">
@@ -31,7 +44,7 @@
                     </view>
                     <view class="price-box flex_r flex_ac">
                         <view class="btn cancel-btn" @tap="toCancel(li)" v-if="li.pay_status === 0">取消订单</view>
-                        <view class="btn topay-btn" @tap="toPay" v-if="li.pay_status === 0">立即支付</view>
+                        <view class="btn topay-btn" @tap="toPay(li)" v-if="li.pay_status === 0">立即支付</view>
                         <view class="btn cancel-btn" @click="toDetails(li)" v-if="li.pay_status != 0">查看订单</view>
                         <view class="btn topay-btn" @tap="toTake(li)" v-if="[0, 1].includes(li.order_status)">确认收货</view>
                     </view>
@@ -42,17 +55,14 @@
         <view class="loading-indicator" :class="loadingMoreHidden ? 'opacity' : ''">{{ loadingTip }}</view>
     </view>
 </template>
-
 <script>
-// var reqApi = new ReqApi();
-// var toPayOpre = new ToPayOpre();
+var page = 1;
 var app = getApp();
 var appEv = app.$vm.$options;
-var page = 1;
 import notGoods from "@/components/not-goods/index";
 import { get, post, u_post } from "@/request/api.js";
-// import terraceTagbar from '@/components/terrace-tagbar/index'
-// import { ReqApi, ToPayOpre } from "../../utils/reqTools.js";
+import { ToPayOpre } from "@/utils/reqTools.js";
+var toPayOpre = new ToPayOpre();
 export default {
     components: {
         notGoods,
@@ -84,9 +94,6 @@ export default {
         this.loadData();
     },
     methods: {
-        returnBtn: function() {
-            uni.navigateBack({});
-        },
         clearData(isclearCat = true, callBack) {
             page = 1;
             this.orderList = [];
@@ -110,12 +117,12 @@ export default {
 
             post("my/order", data).then((res) => {
                 if (res.code === 0) {
-                        uni.hideLoading();
-                        uni.stopPullDownRefresh();
-                        let da = res.data.data.data;
+                    uni.hideLoading();
+                    uni.stopPullDownRefresh();
+                    let da = res.data.data.data;
 
-                        if(page == 1) this.orderList = []
-                        this.orderList = [...da,...this.orderList]
+                    if (page == 1) this.orderList = []
+                    this.orderList = [...da, ...this.orderList]
 
                 } else {
                     appEv.errTips(res.msg || "");
@@ -129,38 +136,33 @@ export default {
 
         // 立即支付
         toPay(e) {
-            var orderDetailIds = e.currentTarget.dataset.id;
-            var index = e.currentTarget.dataset.index;
-            var price = this.orderList[index].data.totalPrice;
-            var type = this.orderList[index].data.patType;
-            var teaIntegral = this.orderList[index].data.totalTeaInt;
-            var pfIntegral = this.orderList[index].data.totalPfInt;
-            var xfIntegral = this.orderList[index].data.totalXfInt;
-            var totalAccount = this.orderList[index].data.totalAccount;
-            var orderNo = this.orderList[index].data.orderNo;
-            let data = {
-                orderDetailIds: orderDetailIds,
-                types: 1,
-                price: price,
-                account: totalAccount,
-                teaIntegral: teaIntegral,
-                pfIntegral: pfIntegral,
-                xfIntegral: xfIntegral,
-                zfType: type,
-                ojsType: e.currentTarget.dataset.ojstype,
-            };
-            var info;
-            info = reqApi.payOrder(data);
-            var that = this;
-            if (info) {
-                info.then((res) => {
-                    if (res.data.status == 200) {
-                        toPayOpre.toPay(res.data.payParam);
-                    } else {
-                        appEv.errTips(res.data.msg || "支付失败");
-                    }
-                });
-            }
+            // #ifdef  H5
+            let type = "H5";
+            // #endif
+            // #ifdef  APP
+            let type = "app";
+            // #endif
+            // #ifdef  MP-WEIXIN
+            let type = "jsapi";
+            // #endif
+            post('goods/payOrder', {
+                id: e.order_id,
+                trade_type: type
+            }).then(res => {
+                if (res.code === 0) {
+                    toPayOpre.toPay(res.data.data, (da) => {
+                        if (!da) {
+                            // 支付成功
+                            appEv.errTips('支付成功')
+                        } else {
+                            // 支付失败
+                            appEv.errTips('支付已取消')
+                        }
+                        // appEv.errTips('支付成功');
+                        this.loadData();
+                    })
+                }
+            })
         },
         // 取消订单
         toCancel(e) {
@@ -173,10 +175,10 @@ export default {
                 confirmColor: "#f02f2f",
                 success(res) {
                     if (res.confirm) {
-                        post("my/orderCancel",{
+                        post("my/orderCancel", {
                             order_id: e.order_id
                         }).then(res => {
-                            if(res.code === 0){
+                            if (res.code === 0) {
                                 appEv.errTips(res.msg);
                                 that.loadData();
                             }
@@ -196,10 +198,10 @@ export default {
                 cancelColor: "#bbb",
                 success(res) {
                     if (res.confirm) {
-                        post("goods/confirmOrder",{
+                        post("goods/confirmOrder", {
                             order_id: e.order_id
                         }).then(res => {
-                            if(res.code === 0){
+                            if (res.code === 0) {
                                 appEv.errTips(res.msg);
                                 that.loadData();
                             }
@@ -208,15 +210,6 @@ export default {
                 },
             });
         },
-        // 整理数据
-        arrangeData(data = appEv.parameter("data")) {
-            var statusType = this.data.statusType;
-            statusType[0][2] = data.wholeCount;
-            statusType[1][2] = data.AlreadyPaymentCount;
-            statusType[2][2] = data.AlreadyCompleteCount;
-            statusType[3][2] = data.AlreadySettlementCount;
-            this.statusType = statusType;
-        },
         //菜单切换
         statusTap(e) {
             //重置数据
@@ -237,6 +230,14 @@ export default {
                 if (da[1] == 5) return "已作废";
             };
         },
+        // tidyTpye() {
+        //     return (da) => {
+        //         switch(da) {
+        //             1: return "待支付";
+        //             break;
+        //         }
+        //     };
+        // },
     },
     //上拉加载事件
     onReachBottom() {
@@ -256,7 +257,8 @@ export default {
             that.loadData();
         });
     },
-    onUnload(){
+    // 监听卸载页面  同等于  返回拦截
+    onUnload() {
         // #ifdef  H5 || APP-PLUS
         this.goto("/pages/my/index");
         // #endif
@@ -269,26 +271,31 @@ export default {
 
 };
 </script>
-
 <style lang="scss">
 page {
     background-color: #f3f5f7;
 }
+
 .container {
     width: 100%;
 }
+
 .fl {
     float: left;
 }
+
 .fr {
     float: right;
 }
+
 .overflow {
     overflow: hidden;
 }
+
 .r_color {
     color: #fa2f2e;
 }
+
 .loading-indicator {
     width: 100%;
     text-align: center;
@@ -297,13 +304,16 @@ page {
     margin: 20rpx 0;
     line-height: 1.5;
 }
+
 .opacity {
     opacity: 0;
     display: none;
 }
+
 .terraceComp {
     height: 84rpx;
 }
+
 .terraceComp_fix {
     position: fixed;
     top: -12rpx;
@@ -311,10 +321,12 @@ page {
     right: 0;
     z-index: 15;
 }
+
 .status-box {
     width: 100%;
     height: 94rpx;
 }
+
 .status_tap_box {
     position: fixed;
     left: 0;
@@ -329,6 +341,7 @@ page {
     z-index: 300;
     box-shadow: 0rpx 8rpx 8rpx rgba(0, 0, 0, 0.025);
 }
+
 .status-box .status-label {
     flex-grow: 1;
     height: 100%;
@@ -368,6 +381,7 @@ page {
     font-size: 26rpx;
     color: #fa2f2e;
 }
+
 .order-list .a-order .order-date text.r_color {
     font-weight: 600;
 }
@@ -376,12 +390,14 @@ page {
     width: 100%;
     overflow: hidden;
 }
+
 .a-order .list-title {
     font-size: 28rpx;
     font-weight: 600;
     color: #000;
     padding: 16rpx 24rpx;
 }
+
 .avaImgs {
     width: 54rpx;
     height: 54rpx;
@@ -401,9 +417,11 @@ page {
     background-color: #f3f5f7;
     box-sizing: border-box;
 }
+
 .goods-info-bar {
     width: calc(100% - 190rpx);
 }
+
 .goods-info .img-box {
     width: 172rpx;
     height: 120rpx;
@@ -412,11 +430,13 @@ page {
     border-radius: 12rpx;
     margin-right: 20rpx;
 }
+
 .goods-info .img-box .goods-img {
     width: 100%;
     display: block;
     height: 100%;
 }
+
 .goods-img-container {
     overflow: hidden;
     box-sizing: border-box;
@@ -424,34 +444,41 @@ page {
     height: 172rpx;
     white-space: nowrap;
 }
+
 .goods-img-container .img-box {
     display: inline-block;
 }
+
 .goods-img-container .img-box:last-of-type {
     margin-right: 0;
 }
+
 .goods-info .goods_name {
     width: calc(100% - 192rpx);
     font-size: 28rpx;
     font-weight: 500;
     color: #121212;
 }
+
 .goodsDetail_info {
     overflow: hidden;
     width: 180rpx;
     line-height: 1.5;
     text-align: right;
 }
+
 .goodsDetail_info .unimport {
     font-size: 24rpx;
     color: #999;
 }
+
 .goodsDetail_info .goods_price {
     font-size: 26rpx;
     line-height: 1.2;
     font-weight: 600;
     margin-bottom: 10rpx;
 }
+
 .goodsDetail_info .goods_price text {
     font-size: 36rpx;
 }
@@ -474,6 +501,7 @@ page {
     border: 1rpx solid #ccc;
     padding: 12rpx 24rpx;
 }
+
 .order-list .a-order .price-box .total-price {
     color: #e05f0b;
 }
@@ -494,10 +522,11 @@ page {
     // float: left;
     margin-left: auto;
 }
+
 .ptz {
     color: #18bb88;
     font-size: 30rpx;
     position: absolute;
     left: 30rpx;
 }
-</style>
+</style>

+ 1 - 1
src/pages/to-pay-list/index.vue

@@ -190,7 +190,7 @@ export default {
             // this.goto("/pages/xghc-addrress/userAddress");
         },
         // 支付
-        payment: function() {
+        payment() {
             // #ifdef  H5
             let type = "H5";
             // #endif