shish 2 ماه پیش
والد
کامیت
7c7d78f82e

+ 13 - 4
ghsApp/src/admin/billing/result.vue

@@ -75,12 +75,15 @@ export default {
 		...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo" }),
 	},
 	onShareAppMessage(res) {
-		console.log("pagesOrder/showOrder?id="+this.detailInfo.id)
+		const purchaseId = this.detailInfo.purchaseId || 0
+		const salt = this.detailInfo.cgSalt || (this.detailInfo.cgInfo && this.detailInfo.cgInfo.salt) || ''
+		const path = purchaseId && salt ? 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt : 'pagesOrder/showOrder'
+		console.log(path)
 		return {
 			title: this.title,
 			desc: "",
       imageUrl: IMGHOST+'/custom/order_share.jpg',
-			path: "pagesOrder/showOrder?id="+this.detailInfo.id,
+			path: path,
 		}
 	},
   methods: {
@@ -126,7 +129,13 @@ export default {
       })
     },
 		shareOrder(){
-			console.log("pagesOrder/showOrder?id="+this.detailInfo.id)
+			const purchaseId = this.detailInfo.purchaseId || 0
+			const salt = this.detailInfo.cgSalt || (this.detailInfo.cgInfo && this.detailInfo.cgInfo.salt) || ''
+			if (!purchaseId || !salt) {
+				this.$msg('暂无可分享订单')
+				return false
+			}
+			const path = 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt
 			let that = this
 			let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.ghs ? that.dictInfo.miniOriginalId.current.ghs : ''
 			uni.share({
@@ -138,7 +147,7 @@ export default {
 				imageUrl: IMGHOST+'/custom/order_share.jpg',//图片一定要有,不然会分享失败
 				miniProgram: {
 					id: miniOriginalId,//小程序原始id,发起分享的 App 与小程序属于同一微信开放平台账号
-					path: "pagesOrder/showOrder?id="+this.detailInfo.id,
+					path: path,
 					type: 0,// 0-正式版; 1-测试版; 2-体验版
 					webUrl: 'https://www.wixhb.com'
 				},

+ 13 - 4
ghsApp/src/admin/billing/toPay.vue

@@ -121,17 +121,26 @@ export default {
 		...mapGetters({dictInfo:"getDictionariesInfo" }),
 	},
 	onShareAppMessage(res) {
-		console.log("pagesOrder/showOrder?id="+this.orderInfo.id)
+		const purchaseId = this.orderInfo.purchaseId || 0
+		const salt = this.orderInfo.cgSalt || (this.orderInfo.cgInfo && this.orderInfo.cgInfo.salt) || ''
+		const path = purchaseId && salt ? 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt : 'pagesOrder/showOrder'
+		console.log(path)
 		return {
 			title: this.title,
 			desc: "",
 			imageUrl: IMGHOST+'/custom/order_share.jpg',
-			path: "pagesOrder/showOrder?id="+this.orderInfo.id,
+			path: path,
 		}
 	},
   methods: {
 		shareOrder(){
-			console.log("pagesOrder/showOrder?id="+this.orderInfo.id)
+			const purchaseId = this.orderInfo.purchaseId || 0
+			const salt = this.orderInfo.cgSalt || (this.orderInfo.cgInfo && this.orderInfo.cgInfo.salt) || ''
+			if (!purchaseId || !salt) {
+				this.$msg('暂无可分享订单')
+				return false
+			}
+			const path = 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt
 			let that = this
 			let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.ghs ? that.dictInfo.miniOriginalId.current.ghs : ''
 			uni.share({
@@ -143,7 +152,7 @@ export default {
 				imageUrl: IMGHOST+'/custom/order_share.jpg',//图片一定要有,不然会分享失败
 				miniProgram: {
 					id: miniOriginalId,//小程序原始id,发起分享的 App 与小程序属于同一微信开放平台账号
-					path: "pagesOrder/showOrder?id="+this.orderInfo.id,
+					path: path,
 					type: 0,// 0-正式版; 1-测试版; 2-体验版
 					webUrl: 'https://www.wixhb.com'
 				},

+ 14 - 4
ghsApp/src/admin/home/order.vue

@@ -229,12 +229,16 @@ export default {
   },
   onShareAppMessage(res) {
     this.fromDetail.status = 1;
-    console.log('pagesOrder/showOrder?id=' + this.currentInfo.id);
+    const info = this.currentInfo || {}
+    const purchaseId = info.purchaseId || 0
+    const salt = info.cgSalt || (info.cgInfo && info.cgInfo.salt) || ''
+    const path = purchaseId && salt ? 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt : 'pagesOrder/showOrder'
+    console.log(path);
     return {
       title: this.currentTitle,
       desc: '',
       imageUrl: IMGHOST + '/custom/order_share.jpg',
-      path: 'pagesOrder/showOrder?id=' + this.currentInfo.id
+      path: path
     };
   },
   methods: {
@@ -250,9 +254,15 @@ export default {
       });
     },
     shareOrder(info) {
+      const purchaseId = info.purchaseId || 0
+      const salt = info.cgSalt || (info.cgInfo && info.cgInfo.salt) || ''
+      if (!purchaseId || !salt) {
+        this.$msg('暂无可分享订单');
+        return false;
+      }
+      const path = 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt
       this.currentInfo = info;
       this.fromDetail.status = 1;
-      console.log('pagesOrder/showOrder?id=' + info.id);
       let that = this;
       let miniOriginalId =
         that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.ghs
@@ -278,7 +288,7 @@ export default {
         imageUrl: IMGHOST + '/custom/order_share.jpg', //图片一定要有,不然会分享失败
         miniProgram: {
           id: miniOriginalId, //小程序原始id,发起分享的 App 与小程序属于同一微信开放平台账号
-          path: 'pagesOrder/showOrder?id=' + info.id,
+          path: path,
           type: 0, // 0-正式版; 1-测试版; 2-体验版
           webUrl: 'https://www.wixhb.com'
         },

+ 0 - 2
ghsApp/src/api/order/index.js

@@ -291,5 +291,3 @@ export const modifyAddress = data => {
 export const getTree = data => https.get("/order-tree/get-tree", data);
 
 export const getMergeOrderList = data => https.get("/order/merge-order-list", data);
-
-export const getCgSalt = data => https.get("/order/cg-salt", data);

+ 13 - 4
ghsApp/src/pagesOrder/detail.vue

@@ -759,12 +759,15 @@ export default {
 		...mapGetters({ loginInfo: "getLoginInfo",dictInfo:"getDictionariesInfo" }),
 	},
 	onShareAppMessage(res) {
-		console.log("pagesOrder/showOrder?id="+this.detailInfo.id)
+		const purchaseId = this.detailInfo.purchaseId || 0
+		const salt = this.detailInfo.cgSalt || (this.detailInfo.cgInfo && this.detailInfo.cgInfo.salt) || ''
+		const path = purchaseId && salt ? 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt : 'pagesOrder/showOrder'
+		console.log(path)
 		return {
 			title: this.title,
 			desc: "",
 			imageUrl: IMGHOST+'/custom/order_share.jpg',
-			path: "pagesOrder/showOrder?id="+this.detailInfo.id,
+			path: path,
 		}
 	},
 	methods: {
@@ -1304,7 +1307,13 @@ export default {
 			uni.previewImage({ urls: [url] })
 		},
 		shareOrder(){
-			console.log("pagesOrder/showOrder?id="+this.detailInfo.id)
+			const purchaseId = this.detailInfo.purchaseId || 0
+			const salt = this.detailInfo.cgSalt || (this.detailInfo.cgInfo && this.detailInfo.cgInfo.salt) || ''
+			if (!purchaseId || !salt) {
+				this.$msg('暂无可分享订单')
+				return false
+			}
+			const path = 'pagesOrder/showOrder?id=' + purchaseId + '&salt=' + salt
 			let that = this
 			let miniOriginalId = that.dictInfo.miniOriginalId && that.dictInfo.miniOriginalId.current && that.dictInfo.miniOriginalId.current.ghs ? that.dictInfo.miniOriginalId.current.ghs : ''
 			uni.share({
@@ -1316,7 +1325,7 @@ export default {
 				imageUrl: IMGHOST+'/custom/order_share.jpg',//图片一定要有,不然会分享失败
 				miniProgram: {
 					id: miniOriginalId,//小程序原始id,发起分享的 App 与小程序属于同一微信开放平台账号
-					path: "pagesOrder/showOrder?id="+this.detailInfo.id,
+					path: path,
 					type: 0,// 0-正式版; 1-测试版; 2-体验版
 					webUrl: 'https://www.wixhb.com'
 				},

+ 17 - 72
ghsApp/src/pagesOrder/showOrder.vue

@@ -3,7 +3,7 @@
 		<view class="billing_box_bg">
 			<view class="top-view"> </view>
 			<view class="result-view">
-				<view style="text-align:center;margin-top:20upx;margin-bottom:60upx;font-size:30upx;">编号:{{id}}</view>
+				<view style="text-align:center;margin-top:20upx;margin-bottom:60upx;font-size:30upx;">编号:{{purchaseId}}</view>
                 <button v-if="showButton" class="admin-button-com big blue" style="width:45vw;" @click="showCgOrder()">点击查看订单</button>
 			</view>
 		</view>
@@ -11,98 +11,43 @@
 </template>
 <script>
 import { getWeixinId } from "@/api/invite/index"
-import { getCgSalt } from "@/api/order"
 export default {
     name: "showCgOrder",
 	data() {
 		return {
 			getAppIdList:{},
 			showButton:false,
-			id:0,
 			purchaseId:0,
-			cgSalt:'',
-			saltRequestId:0,
-			saltPromise:null,
-			loadedOptionId:0,
-			ignoreNextShowId:0
+			cgSalt:''
 		};
 	},
-	onLoad(option) {
-		this.setOptionInfo(option || this.option || {}, true)
-		this.ignoreNextShowId = this.id
-		let that = this
+	onLoad() {
+		this.parseOption()
 		getWeixinId().then(res => {
-			that.getAppIdList = res.data
-			that.showButton = true
+			this.getAppIdList = res.data
+			this.showButton = true
 		})
 	},
-	onShow() {
-		const option = this.option || {}
-		const id = option.id || 0
-		if(id && this.ignoreNextShowId == id){
-			this.ignoreNextShowId = 0
-			this.setOptionInfo(option)
-			return false
-		}
-		this.setOptionInfo(option, true)
-	},
 	methods: {
 		init(){
-			this.setOptionInfo(this.option || {}, true)
+			this.parseOption()
 		},
-		setOptionInfo(option, refreshSalt = false){
-			const id = option.id || 0
-			if(!id){
-				return false
-			}
-			if(this.id != id){
-				this.cgSalt = ''
-				this.purchaseId = 0
-				this.saltRequestId = 0
-				this.saltPromise = null
-			}
-			this.id = id
-			if(refreshSalt || this.loadedOptionId != id){
-				this.loadedOptionId = id
-				this.getCgSaltInfo()
-			}
+		parseOption() {
+			const option = this.option || {}
+			this.purchaseId = option.id || 0
+			this.cgSalt = option.salt || ''
 		},
-		getCgSaltInfo(){
-			if(!this.id){
-				return Promise.resolve(false)
-			}
-			if(this.saltPromise && this.saltRequestId == this.id){
-				return this.saltPromise
-			}
-			this.saltRequestId = this.id
-			this.saltPromise = getCgSalt({id:this.id}).then(res => {
-				this.purchaseId = res.data.purchaseId || 0
-				this.cgSalt = res.data.cgSalt || ''
-				this.saltPromise = null
-				return this.cgSalt
-			}).catch(err => {
-				this.saltPromise = null
-				throw err
-			})
-			return this.saltPromise
-		},
-		async showCgOrder() {
-			let that = this
-			if(!that.cgSalt){
-				await that.getCgSaltInfo()
-			}
-			const salt = that.cgSalt || ''
-			const purchaseId = that.purchaseId || 0
-			if(!purchaseId || !salt){
-				that.$msg('订单信息获取失败')
+		showCgOrder() {
+			const purchaseId = this.purchaseId || 0
+			const salt = this.cgSalt || ''
+			if (!purchaseId || !salt) {
+				this.$msg('订单信息无效')
 				return false
 			}
 			console.log('pagesPurchase/purDetails?id='+purchaseId+'&salt='+salt)
 			uni.navigateToMiniProgram({
-				//姜枫-2021.04.13
-				appId: that.getAppIdList.hd.miniAppId,
+				appId: this.getAppIdList.hd.miniAppId,
 				path: 'pagesPurchase/purDetails?id='+purchaseId+'&salt='+salt,
-				//develop 开发版 trial 体验版 release 正式版
 				envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
 				extraData: {
 					'id': purchaseId,

+ 5 - 2
hdApp/src/mixins/globalMixins.js

@@ -41,10 +41,11 @@ export default {
 			//微信小程序第一次打开小程序时尝试登录一次
 			var pages = getCurrentPages()
 			let currentRoute  = pages[pages.length-1].route;
+			const shareGuestRoute = option && option.salt && currentRoute == 'pagesPurchase/purDetails'
 			if(this.$util.isEmpty(token)){
 				//首页、花店采购页、欠款单列表页、结账单详情页、花材详情页等
-				if(currentRoute == 'admin/home/workbench' || currentRoute == 'pagesPurchase/ghsProduct' || currentRoute == 'pagesPurchase/gathering' || currentRoute == 'admin/clear/info' || currentRoute == 'pagesPurchase/purDetails' || 
-				currentRoute == 'admin/ghsProduct/detail' || currentRoute == 'admin/ljh/info' || currentRoute == 'pagesPurchase/shopping' || currentRoute == 'pagesPurchase/order' || currentRoute == 'pagesPurchase/wechatPay' || currentRoute == 'admin/ghs/pay'){
+				if(!shareGuestRoute && (currentRoute == 'admin/home/workbench' || currentRoute == 'pagesPurchase/ghsProduct' || currentRoute == 'pagesPurchase/gathering' || currentRoute == 'admin/clear/info' || currentRoute == 'pagesPurchase/purDetails' || 
+				currentRoute == 'admin/ghsProduct/detail' || currentRoute == 'admin/ljh/info' || currentRoute == 'pagesPurchase/shopping' || currentRoute == 'pagesPurchase/order' || currentRoute == 'pagesPurchase/wechatPay' || currentRoute == 'admin/ghs/pay')){
 					wxLoginFn(true).then(res => {
 						let token = res.data.token || ''
 						//用于开启小程序自动登录
@@ -58,6 +59,8 @@ export default {
 						this.init()
 						
 					})
+				} else if (shareGuestRoute) {
+					this.init()
 				}
 			}else{
 				hasTokenAutoLogin().then(subRes=>{

+ 6 - 3
hdApp/src/pagesPurchase/purDetails.vue

@@ -399,11 +399,13 @@ export default {
     };
   },
   onShareAppMessage(res) {
-    console.log("pagesPurchase/purDetails?id="+this.detailInfo.id)
+    const salt = this.option.salt ? this.option.salt : ''
+    const path = 'pagesPurchase/purDetails?id=' + this.detailInfo.id + (salt ? '&salt=' + salt : '')
+    console.log(path)
 		return {
 			title: '订单 '+this.detailInfo.addTime.substr(5,5)+' ¥'+this.detailInfo.actPrice,
 			desc: "",
-			path: "pagesPurchase/purDetails?id="+this.detailInfo.id,
+			path: path,
 		}
 	},
   onPullDownRefresh() {
@@ -604,7 +606,8 @@ export default {
         that.settlePrice = parseFloat(that.settlePrice.toFixed(2))
         that.afterSale = res.data.afterSale
         that.$forceUpdate()
-        if (!this.$util.isEmpty(that.detailInfo.fhWlSn)){
+        const token = uni.getStorageSync('token')
+        if (!this.$util.isEmpty(token) && !this.$util.isEmpty(that.detailInfo.fhWlSn)){
           //获取运单轨迹
           getCgExpressTrack({id:id}).then(result=>{ 
             that.trackList = []