Browse Source

支持分享付款

shish 3 years ago
parent
commit
366bd02722

+ 31 - 24
ghsApp/src/admin/billing/result.vue

@@ -3,50 +3,57 @@
 	<button v-if="option.title != '报损成功'" class="admin-button-com big" @click="gotoOrderDetail">订单详情</button>
 	<button class="admin-button-com big" @click="goBackHome">返回首页</button>
   <!-- #ifdef MP-WEIXIN -->
-  <button v-if="option.title != '报损成功'" class="admin-button-com big"  open-type="share">分享给{{customName}}</button>
+  <button v-if="option.title != '报损成功'" class="admin-button-com big" @click="shareTo">分享给{{customName}}</button>
   <!-- #endif -->
   </appResult>
 </template>
 <script>
 import appResult from "@/components/app-result";
 import { getDetail} from "@/api/order/index";
-import BLE from "@/mixins/BLE";
+import { getWeixinId } from "@/api/invite/index";
 export default {
   name: "BillingResult",
   components: {
     appResult,
   },
-  mixins: [BLE],
+  mixins: [],
   data() {
     return {
       detailInfo: {},
-      customName:'客户'
+      customName:'客户',
+      getappIdList: {}
     };
   },
-  onShareAppMessage(res) {
-		console.log("pagesOrder/info?id="+this.detailInfo.id)
-		let price = this.detailInfo.orderPrice ? parseFloat(this.detailInfo.orderPrice):0
-		return {
-			title: this.detailInfo.addTime.substr(5,5)+' ¥'+price,
-			desc: "",
-			path: "pagesOrder/info?id="+this.detailInfo.id,
-		}
-	},
   methods: {
-    //打印订单
-    printOrder() {
-      let BleVal = JSON.parse(this.detailInfo.printData);
-      switch (uni.getSystemInfoSync().platform) {
-        case "android":
-          this.destroyed(BleVal);
-          break;
-        case "ios":
-          this.autoLinkBle(BleVal);
-          break;
-      }
+    shareTo(){
+        // #ifdef APP-PLUS
+        this.$msg('暂时只支持小程序')
+        // #endif
+        if(this.$util.isEmpty(this.detailInfo)){
+          this.$msg('稍等3秒再点')
+          return false
+        }
+        let that = this
+        console.log('pagesPurchase/purDetails?id='+ that.detailInfo.purchaseId)
+        // #ifdef MP-WEIXIN
+        uni.navigateToMiniProgram({
+					appId: that.getappIdList.hd.miniAppId,
+					path: 'pagesPurchase/purDetails?id='+ that.detailInfo.purchaseId,
+					//develop 开发版 trial 体验版 release 正式版
+					envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
+					extraData: {},
+          success (res) {
+          }
+        })
+        // #endif
     },
     async init() {
       if (this.option.title != "报损成功") {
+
+        getWeixinId().then(res => {
+          this.getappIdList = res.data
+        })
+
         const res = await getDetail({
           id: this.option.orderId,
         });

+ 31 - 11
ghsApp/src/pagesOrder/detail.vue

@@ -223,7 +223,7 @@
 		</view>
 		<div class="app-footer">
 			<!-- #ifdef MP-WEIXIN -->
-			<button class="admin-button-com default" v-if="detailInfo.status == 4" open-type="share">分享给客户</button>
+			<button class="admin-button-com default" v-if="detailInfo.status == 4" @click="shareTo()">打开并分享</button>
 			<!-- #endif -->
 			<button @click="cancelOrderFn(detailInfo)" v-if="detailInfo.status == 1" class="admin-button-com default" :class="active">取消</button>
 			<template v-for="s in detailInfo.buttonList">
@@ -256,6 +256,7 @@ import { ORDER_STATUS } from "@/utils/declare";
 import BLE from "@/mixins/BLE";
 import { cloudPrintOrder, cancelOrder } from "@/api/order";
 import { hasHitNavigate } from "@/api/map";
+import { getWeixinId } from "@/api/invite/index";
 export default {
 	name: "orderDetail",
 	components: {
@@ -278,7 +279,8 @@ export default {
 			freeShipModal: false,
 			loading: false,
 			settlePrice:0,
-			showCancelBtn: true
+			showCancelBtn: true,
+			getappIdList: {}
 		};
 	},
 	onPullDownRefresh() {
@@ -286,22 +288,40 @@ export default {
 		uni.stopPullDownRefresh()
 		})
 	},
-  	onShareAppMessage(res) {
-		console.log("pagesOrder/info?id="+this.detailInfo.id)
-		let price = this.detailInfo.orderPrice ? parseFloat(this.detailInfo.orderPrice):0
-		return {
-			title: this.detailInfo.addTime.substr(5,5)+' ¥'+price,
-			desc: "",
-			path: "pagesOrder/info?id="+this.detailInfo.id,
-		}
-	},
 	onShow() {
+
+        getWeixinId().then(res => {
+          this.getappIdList = res.data
+        })
+
 		this.init();
 	},
 	computed: {
 		...mapGetters({ loginInfo: "getLoginInfo" }),
 	},
 	methods: {
+		shareTo(){
+			// #ifdef APP-PLUS
+			this.$msg('暂时只支持小程序')
+			// #endif
+			if(this.$util.isEmpty(this.detailInfo)){
+				this.$msg('稍等3秒再点')
+				return false
+			}
+			let that = this
+			console.log('pagesPurchase/purDetails?id='+ that.detailInfo.purchaseId)
+			// #ifdef MP-WEIXIN
+			uni.navigateToMiniProgram({
+				appId: that.getappIdList.hd.miniAppId,
+				path: 'pagesPurchase/purDetails?id='+ that.detailInfo.purchaseId,
+				//develop 开发版 trial 体验版 release 正式版
+				envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
+				extraData: {},
+				success (res) {
+				}
+			})
+			// #endif
+		},
 		goRefund(){
 			if(this.detailInfo.payWay == 1){
 				this.$msg('支付宝订单暂不支持退款,请线下退款')

+ 1 - 1
hdApp/src/mixins/globalMixins.js

@@ -42,7 +42,7 @@ export default {
 			let currentRoute  = pages[pages.length-1].route;
 			if(this.$util.isEmpty(token)){
 				//首页、花店采购页、欠款单列表页、结账单详情页
-				if(currentRoute == 'admin/home/workbench' || currentRoute == 'pagesPurchase/ghsProduct' || currentRoute == 'pagesPurchase/gathering' || currentRoute == 'admin/clear/info'){
+				if(currentRoute == 'admin/home/workbench' || currentRoute == 'pagesPurchase/ghsProduct' || currentRoute == 'pagesPurchase/gathering' || currentRoute == 'admin/clear/info' || currentRoute == 'pagesPurchase/purDetails'){
 					wxLoginFn(true).then(res => {
 						let token = res.data.token || ''
 						//用于开启小程序自动登录

+ 23 - 7
hdApp/src/pagesPurchase/purDetails.vue

@@ -211,18 +211,20 @@
     </view>
     <view class="app-footer open_btn">
 
+      <button class="admin-button-com blue big" open-type="share" style="margin-right:80upx;padding-left:50upx;padding-right:50upx;">分享</button>
+
       <block v-if="detailInfo.status == 1">
         <button class="admin-button-com blue big" @click="toPay">去付款</button>
       </block>
       <block v-else>
-        <button class="admin-button-com blue big" @click="clearOrder" v-if="detailInfo.debt == 1">付款</button>
+        <button class="admin-button-com blue big" @click="clearOrder" v-if="detailInfo.debt == 1">付款结清</button>
       </block>
 
 		</view>
   </view>
 </template>
 <script>
-import { purchaseDetail, purchaseDebtPay } from "@/api/purchase";
+import { purchaseDetail, purchaseDebtPay,purchaseClearCreateOrder } from "@/api/purchase";
 import TuiListCell from "@/components/plugin/list-cell";
 export default {
   name: "info",
@@ -250,17 +252,31 @@ export default {
       settlePrice:0
     };
   },
-  onShow () {
-
-  },
+  onShareAppMessage(res) {
+    console.log("pagesPurchase/purDetails?id="+this.detailInfo.id)
+		return {
+			title: '订单 '+this.detailInfo.addTime.substr(5,5)+' ¥'+this.detailInfo.actPrice,
+			desc: "",
+			path: "pagesPurchase/purDetails?id="+this.detailInfo.id,
+		}
+	},
   onPullDownRefresh() {
 			this.initData().then(res => {
 				uni.stopPullDownRefresh()
 			})
-		},
+	},
   methods: {
     clearOrder(){
-
+      let arr = []
+      arr.push(this.detailInfo.id)
+      let that = this
+      uni.showLoading({mask:true})
+      purchaseClearCreateOrder({ purchaseIds:arr.join(','),ghsId:this.detailInfo.ghsId }).then(res => {
+        if(res.code == 1) {
+            uni.hideLoading()
+            that.pageTo({ url: '/pagesPurchase/gatherPay?orderSn=' + res.data.orderSn + '&actPrice=' + res.data.actPrice+'&remainSecond='+res.data.remainSecond, type: 2 })
+        }
+      })
     },
 		navigate(latitude, longitude, address) {   
 			// 将经纬度转换成Number