|
|
@@ -4,10 +4,10 @@
|
|
|
<block v-if="!$util.isEmpty(list.data)">
|
|
|
<div class="list" v-for="(item, index) in list.data" :key="index">
|
|
|
<div v-if="!$util.isEmpty(item.orderInfo)">
|
|
|
- <OrderItem :item="item.orderInfo" @printOrder="printOrder"></OrderItem>
|
|
|
+ <OrderItem :item="item.orderInfo" @printOrder="printOrder" @shareOrder="shareSingleOrder"></OrderItem>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
- <OrderItem :ref="`orderRef${item.id}`" :item="item" @printOrder="printOrder" @directFh="directFh" @fillNoFh="fillNoFh" :moreOrderRemind="false"></OrderItem>
|
|
|
+ <OrderItem :ref="`orderRef${item.id}`" :item="item" @printOrder="printOrder" @directFh="directFh" @fillNoFh="fillNoFh" @shareOrder="shareSingleOrder" :moreOrderRemind="false"></OrderItem>
|
|
|
</div>
|
|
|
</div>
|
|
|
</block>
|
|
|
@@ -18,7 +18,12 @@
|
|
|
|
|
|
<view class="bottom-bar-view" v-if="!$util.isEmpty(ids)">
|
|
|
<view class="bar-content">
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
<button class="admin-button-com big blue" open-type="share" @click="shareAllOrder()">全部分享</button>
|
|
|
+ <!-- #endif -->
|
|
|
+ <!-- #ifdef APP-PLUS -->
|
|
|
+ <button class="admin-button-com big blue" @click="shareAllOrder()">全部分享</button>
|
|
|
+ <!-- #endif -->
|
|
|
<button class="admin-button-com big blue" style="margin-left: 50upx;" @click="batchFh()">全部发货</button>
|
|
|
<button class="admin-button-com big blue" style="margin-left: 50upx;" @click="batchPrint()">合并打印</button>
|
|
|
</view>
|
|
|
@@ -54,6 +59,16 @@ import orderMixin from "@/mixins/order";
|
|
|
import OrderItem from "../home/components/OrderItem"
|
|
|
import { getMergeOrderList,cloudPrintOrder,mergePrintFn,allFhAction,orderFh} from "@/api/order";
|
|
|
import { IMGHOST } from "@/config";
|
|
|
+import {
|
|
|
+ buildMergeShareTitle,
|
|
|
+ buildOrderShareTitle,
|
|
|
+ canShareSingleOrder,
|
|
|
+ getMergeHdSharePath,
|
|
|
+ getMergeSharePath,
|
|
|
+ getShareOrderIdFromEvent,
|
|
|
+ getSingleOrderSharePath,
|
|
|
+ shareOrderToWxMiniProgram
|
|
|
+} from "@/utils/orderShare";
|
|
|
export default {
|
|
|
name: "mergeOrder",
|
|
|
components: {
|
|
|
@@ -73,6 +88,8 @@ export default {
|
|
|
fhLabelShow:false,
|
|
|
shareInfo: {},
|
|
|
shareTitle: '订单列表',
|
|
|
+ shareMode: 'merge',
|
|
|
+ singleShareOrderId: 0,
|
|
|
}
|
|
|
},
|
|
|
onPullDownRefresh() {
|
|
|
@@ -101,57 +118,98 @@ export default {
|
|
|
this.ids = this.option.ids?this.option.ids:''
|
|
|
|
|
|
},
|
|
|
- onShareAppMessage() {
|
|
|
- const share = this.getShareConfig()
|
|
|
+ onShareAppMessage(res) {
|
|
|
+ let orderId = this.singleShareOrderId || 0
|
|
|
+ const datasetOrderId = getShareOrderIdFromEvent(res)
|
|
|
+ if (datasetOrderId) {
|
|
|
+ orderId = datasetOrderId
|
|
|
+ this.shareMode = 'single'
|
|
|
+ }
|
|
|
+ if (this.shareMode === 'single') {
|
|
|
+ const singleShare = this.getSingleOrderShareConfig(orderId)
|
|
|
+ if (singleShare) {
|
|
|
+ return {
|
|
|
+ title: singleShare.title,
|
|
|
+ desc: '',
|
|
|
+ imageUrl: IMGHOST + '/custom/order_share.jpg',
|
|
|
+ path: singleShare.path
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const path = getMergeSharePath(this.shareInfo)
|
|
|
+ const title = this.shareTitle || buildMergeShareTitle(this.shareInfo, this.list.data) || '订单列表'
|
|
|
return {
|
|
|
- title: share.title,
|
|
|
+ title: title,
|
|
|
desc: '',
|
|
|
imageUrl: IMGHOST + '/custom/order_share.jpg',
|
|
|
- path: share.path
|
|
|
+ path: path || 'pagesOrder/showMergeOrder'
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- getShareConfig() {
|
|
|
- const info = this.shareInfo || {}
|
|
|
- const mergeId = info.mergeId || info.id || 0
|
|
|
- const salt = info.salt || ''
|
|
|
- const title = this.shareTitle || '订单列表'
|
|
|
+ findOrderById(orderId) {
|
|
|
+ if (!orderId || !this.list.data) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ for (let i = 0; i < this.list.data.length; i++) {
|
|
|
+ const row = this.list.data[i]
|
|
|
+ if (row.orderInfo && row.orderInfo.id === orderId) {
|
|
|
+ return row.orderInfo
|
|
|
+ }
|
|
|
+ if (row.id === orderId) {
|
|
|
+ return row
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null
|
|
|
+ },
|
|
|
+ getSingleOrderShareConfig(orderId) {
|
|
|
+ const info = this.findOrderById(orderId || this.singleShareOrderId)
|
|
|
+ if (!info) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ const path = getSingleOrderSharePath(info)
|
|
|
+ if (!path) {
|
|
|
+ return null
|
|
|
+ }
|
|
|
return {
|
|
|
- title,
|
|
|
- hdPath: 'pagesPurchase/mergeOrder?mergeId=' + mergeId + '&salt=' + salt,
|
|
|
- path: 'pagesOrder/showMergeOrder?mergeId=' + mergeId + '&salt=' + salt
|
|
|
+ title: buildOrderShareTitle(info),
|
|
|
+ path: path
|
|
|
}
|
|
|
},
|
|
|
+ shareSingleOrder(info) {
|
|
|
+ if (!canShareSingleOrder(info)) {
|
|
|
+ this.$msg('暂无可分享订单')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.shareMode = 'single'
|
|
|
+ this.singleShareOrderId = info.id || 0
|
|
|
+ const singleShare = this.getSingleOrderShareConfig(this.singleShareOrderId)
|
|
|
+ if (!singleShare) {
|
|
|
+ this.$msg('暂无可分享订单')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ shareOrderToWxMiniProgram({
|
|
|
+ dictInfo: this.getDictionariesInfo,
|
|
|
+ appKey: 'ghs',
|
|
|
+ path: singleShare.path,
|
|
|
+ title: singleShare.title
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
shareAllOrder(){
|
|
|
- const info = this.shareInfo || {}
|
|
|
- if (!info.mergeId || !info.salt) {
|
|
|
+ this.shareMode = 'merge'
|
|
|
+ const path = getMergeHdSharePath(this.shareInfo)
|
|
|
+ if (!path) {
|
|
|
this.$msg('暂无可分享订单')
|
|
|
return false
|
|
|
}
|
|
|
- const firstOrder = this.list.data && this.list.data.length > 0 ? this.list.data[0] : {}
|
|
|
- const customName = firstOrder.customName ? firstOrder.customName : ''
|
|
|
- const count = this.list.data ? this.list.data.length : 0
|
|
|
- const totalPrice = info.totalPrice != null && info.totalPrice !== '' ? parseFloat(info.totalPrice) : 0
|
|
|
- this.shareTitle = customName + ' 共' + count + '个订单 ¥' + totalPrice
|
|
|
- const share = this.getShareConfig()
|
|
|
+ this.shareTitle = buildMergeShareTitle(this.shareInfo, this.list.data)
|
|
|
// #ifdef APP-PLUS
|
|
|
- const miniOriginalId =
|
|
|
- this.getDictionariesInfo && this.getDictionariesInfo.miniOriginalId && this.getDictionariesInfo.miniOriginalId.current && this.getDictionariesInfo.miniOriginalId.current.hd
|
|
|
- ? this.getDictionariesInfo.miniOriginalId.current.hd
|
|
|
- : ''
|
|
|
- uni.share({
|
|
|
- provider: 'weixin',
|
|
|
- scene: 'WXSceneSession',
|
|
|
- type: 5,
|
|
|
- title: share.title,
|
|
|
- summary: '暂无',
|
|
|
- imageUrl: IMGHOST + '/custom/order_share.jpg',
|
|
|
- miniProgram: {
|
|
|
- id: miniOriginalId,
|
|
|
- path: share.hdPath,
|
|
|
- type: 0,
|
|
|
- webUrl: 'https://www.wixhb.com'
|
|
|
- }
|
|
|
+ shareOrderToWxMiniProgram({
|
|
|
+ dictInfo: this.getDictionariesInfo,
|
|
|
+ appKey: 'hd',
|
|
|
+ path: path,
|
|
|
+ title: this.shareTitle
|
|
|
})
|
|
|
// #endif
|
|
|
},
|