Kaynağa Gözat

更新支付和自提

vaecebyZ 1 yıl önce
ebeveyn
işleme
506601e86b
6 değiştirilmiş dosya ile 265 ekleme ve 34 silme
  1. 74 21
      my/order/detail.vue
  2. 6 0
      pages.json
  3. 1 1
      pages/index/index.vue
  4. 1 1
      pages/index/searchResult.vue
  5. 100 11
      pay/pay.vue
  6. 83 0
      pay/remark.vue

+ 74 - 21
my/order/detail.vue

@@ -31,14 +31,6 @@
       <view class="progress-desc"> 查看退款详情 </view>
     </view>
 
-    <!-- <view class="content shop-box"  v-if="!isVisual">
-				<view class="shop-name">
-					{{info.shopInfo.shopName}}
-				</view>
-				<view class="address">
-					{{info.shopInfo.address}}
-				</view>
-			</view> -->
 
     <view class="content info">
       <view class="order-info">
@@ -68,6 +60,17 @@
       </view>
     </view>
 
+  
+    <view class="input-box-address" @click="toMap()">
+      <view class="label"> 到店自取地址 </view>
+      <view class="value">
+        <!-- {{ info.address }} -->
+        印象贵大文创店
+      </view>
+      <view class="label"> 贵州大学西校区西一区体育场楼下</view>
+    </view>
+
+
     <view
       class="content code-box"
       v-if="
@@ -146,6 +149,15 @@
           {{ $u.timeFormat(info.payment.paymentTime, "yyyy-mm-dd hh:MM:ss") }}
         </view>
       </view>
+
+      <view class="item">
+        <view class="label"> 订单备注 </view>
+        <view class="value">
+          {{
+           info.extend.remark || "无"
+          }}
+        </view>
+      </view>
     </view>
 
     <view class="content">
@@ -248,6 +260,7 @@
 <script>
 import { qrCode } from "@/api/order.js";
 import { payDetails, queryPayOrder, unRefund } from "@/api/payment.js";
+import { encodeURI } from "js-base64";
 export default {
   data() {
     return {
@@ -263,6 +276,7 @@ export default {
         payment: {
           paymentWay: "",
         },
+        extend: "",
       },
       isNotTime: false,
     };
@@ -378,15 +392,15 @@ export default {
     payDetails(orderNo) {
       payDetails(orderNo).then((res) => {
         this.info = res.content;
-        try {
-          let extend = JSON.parse(this.info.extend);
-          if (extend.account) {
-            this.isVisual = true;
-          }
-        } catch (e) {
-          //TODO handle the exception
-        }
-
+        // try {
+        //   let extend = JSON.parse(this.info.extend);
+        //   if (extend.account) {
+        //     this.isVisual = true;
+        //   }
+        // } catch (e) {
+        //   //TODO handle the exception
+        // }
+        this.info.extend = JSON.parse(this.info.goodsList[0].extend);
         // 跳转了但是没支付
         if(this.isJumped && this.info.goodsList[0].goodsState == "WAIT_PAYMENT"){
           this.btnLoading = false;
@@ -399,6 +413,14 @@ export default {
         }
       });
     },
+    toMap() {
+      uni.openLocation({
+        latitude: 26.4401,
+        longitude: 106.664,
+        name: "印象贵大文创店",
+        address: "贵州大学西校区西一区体育场楼下",
+      });
+    },
     // 支付
     pay() {
       if (this.btnLoading) return;
@@ -409,10 +431,19 @@ export default {
       let that = this;
       let miniPayRequest = this.info.payment.miniPayRequest;
       miniPayRequest = JSON.parse(miniPayRequest);
-			// 打开慧研学
+      let query = encodeURIComponent(JSON.stringify({
+        sign: miniPayRequest.sign,
+        prepayid: miniPayRequest.prepayid,
+      }))
+
+      console.log('prepayid :>> ', miniPayRequest.prepayid);
+      console.log('sign',miniPayRequest.sign);
+      console.log('path+query :>> ', `${miniPayRequest.minipath}?appPayReqest=${query}`);
+      console.log('appId', miniPayRequest.miniuser)
+			// 打开银联小程序
       uni.navigateToMiniProgram({
-        appId: "wx3be1d6d84d46cdf7",
-        path: "pages/index/index",
+        appId: miniPayRequest.miniuser,
+        path: `${miniPayRequest.minipath}?appPayRequest=${query}`,
         success: (res) => {
           // 打开成功
           // console.log("打开成功", res);
@@ -504,7 +535,7 @@ export default {
 .order-detail {
   background: #f9f9f9;
   min-height: 100vh;
-  padding-bottom: 100rpx;
+  // padding-bottom: 100rpx;
   .status-box {
     padding: 24rpx 24rpx 4rpx;
     display: flex;
@@ -631,6 +662,28 @@ export default {
     }
   }
 
+  .input-box-address {
+    margin: 20rpx 30rpx;
+    padding: 28rpx 24rpx;
+    background: #ffffff;
+    border-radius: 16rpx 16rpx 16rpx 16rpx;
+    // display: flex;
+    // align-items: center;
+    // justify-content: space-between;
+
+    .value {
+      color: #222;
+      font-size: 28rpx;
+    }
+
+    .label {
+      font-size: 28rpx;
+      margin: 10rpx 0;
+      color: #aaaaaa;
+    }
+  }
+
+
   .content {
     margin: 20rpx 30rpx;
     padding: 28rpx 24rpx;

+ 6 - 0
pages.json

@@ -466,6 +466,12 @@
 					"style": {
 						"navigationBarTitleText": "优惠券"
 					}
+				},
+				{
+					"path": "remark",
+					"style": {
+						"navigationBarTitleText": "添加备注"
+					}
 				}
 		
 			]

+ 1 - 1
pages/index/index.vue

@@ -202,7 +202,7 @@ export default {
   methods: {
     goGoodsDetail(item) {
       uni.setStorageSync("shopInfo", JSON.stringify(item));
-      uni.reLaunch({
+      uni.navigateTo({
         url: `../../detail/goodsDetail/index?id=${item.goodsId}`,
       });
     },

+ 1 - 1
pages/index/searchResult.vue

@@ -98,7 +98,7 @@ export default {
     },
     goGoodsDetail(item, i) {
       uni.setStorageSync("shopInfo", JSON.stringify(item));
-      uni.reLaunch({
+      uni.navigateTo({
         url: `/detail/goodsDetail/index?id=${item.goodsId}`,
       });
     },

+ 100 - 11
pay/pay.vue

@@ -28,11 +28,7 @@
 
       <view class="coupon">
         <view class="label"> 优惠券 </view>
-        <view
-          class="choose-coupon"
-          :class="[payInfo.offset ? '' : 'none']"
-          @click="choose"
-        >
+        <view class="choose-coupon" :class="[payInfo.offset ? '' : 'none']" @click="choose">
           <!-- {{payInfo.goodsCouponName}}-¥{{payInfo.offset}} -->
           {{ payInfo.offset ? "-¥" + payInfo.offset : "暂无可用" }}
           <image class="icon" src="../static/jiantou-icon.png" mode=""></image>
@@ -51,6 +47,15 @@
 			</view> -->
     </view>
 
+    <view class="input-box">
+      <view class="label"> 备注 </view>
+      <view class="choose-coupon"  @click="chooseRemark">
+        {{ info.extend.remark ?  info.extend.remark : "请输入您的需求" }}
+        <image class="icon" src="../static/jiantou-icon.png" mode=""></image>
+      </view>
+    </view>
+
+
     <view class="input-box" v-if="isVisual">
       <view class="label"> 充值账号 </view>
       <view class="value">
@@ -58,6 +63,15 @@
       </view>
     </view>
 
+    <view class="input-box-address" @click="toMap()">
+      <view class="label"> 到店自取地址 </view>
+      <view class="value">
+        <!-- {{ info.address }} -->
+        印象贵大文创店
+      </view>
+      <view class="label"> 贵州大学西校区西一区体育场楼下</view>
+    </view>
+
     <view class="btn-box">
       <view class="total-price">
         <view class="label"> 合计: </view>
@@ -104,7 +118,8 @@ export default {
         },
       },
       query: {
-        msgType: "wx.unifiedOrder",
+        // msgType: "wx.unifiedOrder",
+        msgType: "wx.miniPreOrder",
         orderDesc: "测试",
         orderNo: "",
         subOpenId: "",
@@ -166,6 +181,29 @@ export default {
         },
       });
     },
+    chooseRemark() {
+      let that = this;
+      uni.navigateTo({
+        url: "./remark",
+        success: function (res) {
+          // 通过eventChannel向被打开页面传送数据
+          res.eventChannel.emit("remark", that.info);
+        },
+      });
+    },
+    toMap() {
+      uni.openLocation({
+        latitude: 26.4401,
+        longitude: 106.664,
+        name: "印象贵大文创店",
+        address: "贵州大学西校区西一区体育场楼下",
+      });
+    },
+    setRebackValue(value) {
+      // console.log('value', value);
+      this.info.extend.remark = value;
+      this.$forceUpdate();
+    },
     //创建订单
     creat() {
       if (this.loading) return;
@@ -180,11 +218,15 @@ export default {
         let extend = {};
         if (!this.info.extend) {
           this.info.extend = JSON.stringify({ channel: "GZU" });
+        }else{
+          this.info.extend.channel = "GZU";
         }
         console.log("this.info.extend", this.info.extend);
         try {
-          if (JSON.parse(this.info.extend)) {
+          if(typeof this.info.extend == 'string'){
             extend = this.info.extend;
+          }else{
+            extend = JSON.stringify(this.info.extend);
           }
         } catch (e) {
           console.log("e", e);
@@ -219,7 +261,7 @@ export default {
 
               creatPayOrder({
                 ...this.query,
-                subAppId: "wx3be1d6d84d46cdf7",
+                subAppId: "wxbc64403830bb13c5",
               }).then((data) => {
                 that.payData = JSON.parse(data.content.miniPayRequest);
 
@@ -327,7 +369,7 @@ export default {
       }
     },
   },
-  onReady() {},
+  onReady() { },
   onLoad() {
     let userInfo = JSON.parse(uni.getStorageSync("userInfo"));
     this.query.userId = userInfo.userId;
@@ -336,6 +378,10 @@ export default {
     eventChannel.on("pay", function (data) {
       that.info = data;
       try {
+        // 初始化备注
+        that.info.extend = {
+          remark:''
+        };
         let extend = JSON.parse(that.info.extend);
         if (extend.account) {
           that.isVisual = true;
@@ -344,7 +390,8 @@ export default {
       } catch (e) {
         //TODO handle the exception
       }
-      console.log("data", data);
+      console.log("data", data,that.info);
+      
       that.calculate(that.info.goodsId, that.info.shopId);
     });
   },
@@ -430,7 +477,7 @@ export default {
       display: flex;
       align-items: center;
       justify-content: space-between;
-      border-bottom: 2rpx dashed #f3f3f3;
+      // border-bottom: 2rpx dashed #f3f3f3;
       padding: 28rpx 0;
 
       .label {
@@ -441,6 +488,7 @@ export default {
       .choose-coupon.none {
         color: #aaaaaa;
       }
+
       .choose-coupon {
         color: #ff4848;
         font-size: 28rpx;
@@ -493,6 +541,7 @@ export default {
     display: flex;
     align-items: center;
     justify-content: space-between;
+
     .label {
       color: #222;
       font-size: 28rpx;
@@ -504,6 +553,27 @@ export default {
     }
   }
 
+  .input-box-address {
+    margin: 20rpx 30rpx;
+    padding: 28rpx 24rpx;
+    background: #ffffff;
+    border-radius: 16rpx 16rpx 16rpx 16rpx;
+    // display: flex;
+    // align-items: center;
+    // justify-content: space-between;
+
+    .value {
+      color: #222;
+      font-size: 28rpx;
+    }
+
+    .label {
+      font-size: 28rpx;
+      margin: 10rpx 0;
+      color: #aaaaaa;
+    }
+  }
+
   .btn-box {
     position: fixed;
     bottom: 0%;
@@ -549,4 +619,23 @@ export default {
     }
   }
 }
+
+.label {
+  color: #222222;
+  font-size: 28rpx;
+}
+
+.choose-coupon {
+  color: #aaaaaa;
+  font-size: 28rpx;
+  display: flex;
+  align-items: center;
+
+  .icon {
+    width: 28rpx;
+    height: 28rpx;
+    display: block;
+    margin-left: 10rpx;
+  }
+}
 </style>

+ 83 - 0
pay/remark.vue

@@ -0,0 +1,83 @@
+<template>
+  <view class="page">
+    <view class="text">
+      <u--textarea :height="300" :maxlength="255" v-model="value" placeholder="请输入内容" count></u--textarea>
+    </view>
+    <view class="btn-box">
+      <button class="save-btn" type="default" @click="save">确定</button>
+    </view>
+  </view>
+</template>
+
+<script>
+
+export default {
+  onLoad() {
+    // this.value = options.remark;
+    const that = this
+    const eventChannel = this.getOpenerEventChannel();
+    eventChannel.on('remark', function (data) {
+      // console.log(data, data.extend.remark)
+      that.value = data.extend.remark
+    })
+  },
+  data() {
+    return {
+      value: '1'
+    };
+  },
+  methods: {
+    save() {
+      let pages = getCurrentPages()
+      let prevPage = pages[pages.length - 2]
+      console.log('prevPage',prevPage);
+      prevPage.$vm.setRebackValue(this.value)
+      uni.navigateBack({
+        delta: 1,
+      });
+    }
+  },
+
+};
+</script>
+
+<style lang="scss" scoped>
+.page {
+  background: #FFFFFF;
+  min-height: 100vh;
+  padding-top: 20rpx;
+
+  .text {
+    margin: 20rpx 20rpx;
+  }
+
+  .btn-box {
+    position: fixed;
+    left: 0;
+    bottom: 0;
+    width: 100%;
+    box-sizing: border-box;
+    background: #fff;
+    padding: 20rpx 0 40rpx;
+
+    .save-btn {
+      margin: 0 auto;
+      width: 690rpx;
+      height: 80rpx;
+      line-height: 80rpx;
+      border-radius: 40rpx;
+      background: $uni-color-primary;
+      color: #fff;
+    }
+  }
+}
+
+::v-deep .u-textarea {
+  background-color: #FAFAFA !important;
+  border: none;
+
+  .u-textarea__count {
+    background-color: transparent !important;
+  }
+}
+</style>