李志伟 3 年 前
コミット
3f50c4a268
共有1 個のファイルを変更した42 個の追加27 個の削除を含む
  1. 42
    27
      src/components/CompoentsOrder/OrderCard/index.jsx

+ 42
- 27
src/components/CompoentsOrder/OrderCard/index.jsx ファイルの表示

@@ -1,10 +1,12 @@
1 1
 import Taro from "@tarojs/taro";
2 2
 import { View, Text } from '@tarojs/components'
3
+import { compressImage } from '@/utils'
4
+import { parseQueryString } from '@/utils/index'
3 5
 import formatTime from "@/utils/formatTime";
4 6
 import SlideView from '@/components/SlideView';
5 7
 import CouponCard from '@/components/CouponCard'
8
+import { getQrcode } from '@/services/miniapp'
6 9
 import QRcode from "@/assets/icons/UserCenter/QRcode.png";
7
-import { compressImage } from '@/utils'
8 10
 import refund from "@/assets/icons/GuideCheck/refund.png";
9 11
 import Cancel from "@/assets/icons/UserCenter/Cancel.png";
10 12
 import Pay from "@/assets/icons/GuideCheck/Pay_logo.png";
@@ -34,10 +36,23 @@ export default (props) => {
34 36
     Taro.scanCode({
35 37
       onlyFromCamera: true,
36 38
       success: (res) => {
39
+
37 40
         if (res.path) {
38
-          Taro.navigateTo({
39
-            url: `/${res.path}&subOrderId=${item.subOrderId}`,
40
-          });
41
+          getQrcode(parseQueryString(res.path.split('?')[1]).scene).then((res2) => {
42
+            const maid = res2.scene.split('=')[1].split('&')[0] //二维码的商铺id
43
+            if (maid == item.shopId) {
44
+              Taro.navigateTo({
45
+                url: `/${res.path}&subOrderId=${item.subOrderId}`,
46
+              });
47
+            }else{
48
+              Taro.showToast({
49
+                title: "非当前店铺套餐",
50
+                icon: "none",
51
+                duration: 2000,
52
+              });
53
+            }
54
+          })
55
+
41 56
         } else {
42 57
           Taro.showToast({
43 58
             title: "非当前小程序生成二维码",
@@ -72,27 +87,27 @@ export default (props) => {
72 87
   //                 item.isVerified == true && item.isEvaluated > 0 ? <Action.Image image={Evaluated} /> ://已评价
73 88
   //                   item.isVerified == true ? <Action.Icon icon={Evaluation} text='评价' onClick={() => evaluation(item)} /> : null//待评价
74 89
 
75
-  let PayAction=null
76
-  if (kkp=='1') {//空卡片用于售后详情页面
77
-    PayAction=null
78
-  }else if (sh=='1') {//售后页面卡片
79
-     PayAction=<Action.Icon icon={Refund} text='售后/退款' onClick={() => handleRefund(item)} />
80
-  }else if (item.status===0) {//待支付
81
-     PayAction=<Action.Icon icon={Pay} text='支付' onClick={handleDetail} />
82
-  }else if (item.status === 1 && item.isVerified == false) {//待核销
83
-     PayAction=<Action.Icon icon={QRcode} text='扫码核销' onClick={() => onWriteOff(item)} />
84
-  }else if (item.status === 2 && item.isVerified == false) {//已退费
85
-     PayAction=<Action.Image image={refund} />
86
-  }else if (item.status === 7 && item.isVerified == false) {//已取消
87
-     PayAction=<Action.Image image={Cancel} />
88
-  }else if(item.status === 9){//已过期
89
-     PayAction=<Action.Image image={Null} />
90
-  }else if (item.isVerified == true && item.isEvaluated > 0) {//已评价
91
-     PayAction=<Action.Image image={Evaluated} />
92
-  }else if (item.isVerified == true) {//待评价
93
-     PayAction=<Action.Icon icon={Evaluation} text='评价' onClick={() => evaluation(item)} />
94
-  }else{
95
-    PayAction=null
90
+  let PayAction = null
91
+  if (kkp == '1') {//空卡片用于售后详情页面
92
+    PayAction = null
93
+  } else if (sh == '1') {//售后页面卡片
94
+    PayAction = <Action.Icon icon={Refund} text='售后/退款' onClick={() => handleRefund(item)} />
95
+  } else if (item.status === 0) {//待支付
96
+    PayAction = <Action.Icon icon={Pay} text='支付' onClick={handleDetail} />
97
+  } else if (item.status === 1 && item.isVerified == false) {//待核销
98
+    PayAction = <Action.Icon icon={QRcode} text='扫码核销' onClick={() => onWriteOff(item)} />
99
+  } else if (item.status === 2 && item.isVerified == false) {//已退费
100
+    PayAction = <Action.Image image={refund} />
101
+  } else if (item.status === 7 && item.isVerified == false) {//已取消
102
+    PayAction = <Action.Image image={Cancel} />
103
+  } else if (item.status === 9) {//已过期
104
+    PayAction = <Action.Image image={Null} />
105
+  } else if (item.isVerified == true && item.isEvaluated > 0) {//已评价
106
+    PayAction = <Action.Image image={Evaluated} />
107
+  } else if (item.isVerified == true) {//待评价
108
+    PayAction = <Action.Icon icon={Evaluation} text='评价' onClick={() => evaluation(item)} />
109
+  } else {
110
+    PayAction = null
96 111
   }
97 112
 
98 113
   return (
@@ -104,7 +119,7 @@ export default (props) => {
104 119
       {
105 120
         //待支付可以左滑删除
106 121
         item.status === 0 ? <SlideView del onDelete={() => handeDelete(item)} >
107
-          <CouponCard onClick={() => { Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` })}} action={PayAction}>
122
+          <CouponCard onClick={() => { Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` }) }} action={PayAction}>
108 123
             <CouponMedia>
109 124
               <CouponMedia.Header
110 125
                 cashback={item.cashback}
@@ -138,7 +153,7 @@ export default (props) => {
138 153
           </CouponCard>
139 154
         </SlideView>
140 155
           :
141
-          <CouponCard onClick={() => { Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` })}} action={PayAction} >
156
+          <CouponCard onClick={() => { Taro.navigateTo({ url: `/pages/details/foodDetails/foodDetails?id=${item.shopId}` }) }} action={PayAction} >
142 157
             <CouponMedia>
143 158
               <CouponMedia.Header
144 159
                 cashback={item.cashback}