|
@@ -4,10 +4,10 @@
|
|
|
<block v-if="!$util.isEmpty(list.data)">
|
|
<block v-if="!$util.isEmpty(list.data)">
|
|
|
<div class="list" v-for="(item, index) in list.data" :key="index">
|
|
<div class="list" v-for="(item, index) in list.data" :key="index">
|
|
|
<div v-if="!$util.isEmpty(item.orderInfo)">
|
|
<div v-if="!$util.isEmpty(item.orderInfo)">
|
|
|
- <OrderItem :item="item.orderInfo" @printOrder="printOrder"></OrderItem>
|
|
|
|
|
|
|
+ <OrderItem share-btn-type="single" :item="item.orderInfo" @printOrder="printOrder" @shareOrder="shareSingleOrder"></OrderItem>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-else>
|
|
<div v-else>
|
|
|
- <OrderItem :ref="`orderRef${item.id}`" :item="item" @printOrder="printOrder" @directFh="directFh" @fillNoFh="fillNoFh" :moreOrderRemind="false"></OrderItem>
|
|
|
|
|
|
|
+ <OrderItem share-btn-type="single" :ref="`orderRef${item.id}`" :item="item" @printOrder="printOrder" @directFh="directFh" @fillNoFh="fillNoFh" @shareOrder="shareSingleOrder" :moreOrderRemind="false"></OrderItem>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</block>
|
|
</block>
|
|
@@ -18,7 +18,12 @@
|
|
|
|
|
|
|
|
<view class="bottom-bar-view" v-if="!$util.isEmpty(ids)">
|
|
<view class="bottom-bar-view" v-if="!$util.isEmpty(ids)">
|
|
|
<view class="bar-content">
|
|
<view class="bar-content">
|
|
|
- <button class="admin-button-com big blue" open-type="share" @click="shareAllOrder()">全部分享</button>
|
|
|
|
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
|
|
+ <button class="admin-button-com big blue" open-type="share" data-share-type="merge" @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="batchFh()">全部发货</button>
|
|
|
<button class="admin-button-com big blue" style="margin-left: 50upx;" @click="batchPrint()">合并打印</button>
|
|
<button class="admin-button-com big blue" style="margin-left: 50upx;" @click="batchPrint()">合并打印</button>
|
|
|
</view>
|
|
</view>
|
|
@@ -53,7 +58,16 @@ import { mapGetters } from "vuex";
|
|
|
import orderMixin from "@/mixins/order";
|
|
import orderMixin from "@/mixins/order";
|
|
|
import OrderItem from "../home/components/OrderItem"
|
|
import OrderItem from "../home/components/OrderItem"
|
|
|
import { getMergeOrderList,cloudPrintOrder,mergePrintFn,allFhAction,orderFh} from "@/api/order";
|
|
import { getMergeOrderList,cloudPrintOrder,mergePrintFn,allFhAction,orderFh} from "@/api/order";
|
|
|
-import { IMGHOST } from "@/config";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ buildMergeShareTitle,
|
|
|
|
|
+ buildSingleSharePayload,
|
|
|
|
|
+ canShareSingleOrder,
|
|
|
|
|
+ getMergeSharePath,
|
|
|
|
|
+ resolveMpShareMessage,
|
|
|
|
|
+ shareMergeAllOnApp,
|
|
|
|
|
+ shareSingleOrderOnApp,
|
|
|
|
|
+ buildMpShareMessage
|
|
|
|
|
+} from "@/utils/orderShare";
|
|
|
export default {
|
|
export default {
|
|
|
name: "mergeOrder",
|
|
name: "mergeOrder",
|
|
|
components: {
|
|
components: {
|
|
@@ -73,6 +87,9 @@ export default {
|
|
|
fhLabelShow:false,
|
|
fhLabelShow:false,
|
|
|
shareInfo: {},
|
|
shareInfo: {},
|
|
|
shareTitle: '订单列表',
|
|
shareTitle: '订单列表',
|
|
|
|
|
+ shareMode: 'merge',
|
|
|
|
|
+ singleShareOrderId: 0,
|
|
|
|
|
+ pendingSharePayload: null,
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onPullDownRefresh() {
|
|
onPullDownRefresh() {
|
|
@@ -101,58 +118,93 @@ export default {
|
|
|
this.ids = this.option.ids?this.option.ids:''
|
|
this.ids = this.option.ids?this.option.ids:''
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
- onShareAppMessage() {
|
|
|
|
|
- const share = this.getShareConfig()
|
|
|
|
|
- return {
|
|
|
|
|
- title: share.title,
|
|
|
|
|
- desc: '',
|
|
|
|
|
- imageUrl: IMGHOST + '/custom/order_share.jpg',
|
|
|
|
|
- path: share.path
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ onShareAppMessage(res) {
|
|
|
|
|
+ const mpMessage = resolveMpShareMessage({
|
|
|
|
|
+ pendingSharePayload: this.pendingSharePayload,
|
|
|
|
|
+ res: res,
|
|
|
|
|
+ fallbackOrderId: this.singleShareOrderId,
|
|
|
|
|
+ getSingleShareByOrderId: (orderId) => this.getSingleOrderShareConfig(orderId),
|
|
|
|
|
+ getMergeShare: () => ({
|
|
|
|
|
+ title: this.shareTitle || buildMergeShareTitle(this.shareInfo, this.list.data) || '订单列表',
|
|
|
|
|
+ path: getMergeSharePath(this.shareInfo) || 'pagesOrder/showMergeOrder'
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ return mpMessage || buildMpShareMessage({
|
|
|
|
|
+ title: '订单列表',
|
|
|
|
|
+ path: 'pagesOrder/showMergeOrder'
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- getShareConfig() {
|
|
|
|
|
- const info = this.shareInfo || {}
|
|
|
|
|
- const mergeId = info.mergeId || info.id || 0
|
|
|
|
|
- const salt = info.salt || ''
|
|
|
|
|
- const title = this.shareTitle || '订单列表'
|
|
|
|
|
- return {
|
|
|
|
|
- title,
|
|
|
|
|
- hdPath: 'pagesPurchase/mergeOrder?mergeId=' + mergeId + '&salt=' + salt,
|
|
|
|
|
- path: 'pagesOrder/showMergeOrder?mergeId=' + mergeId + '&salt=' + salt
|
|
|
|
|
|
|
+ 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 payload = buildSingleSharePayload(info)
|
|
|
|
|
+ if (!payload) {
|
|
|
|
|
+ return null
|
|
|
|
|
+ }
|
|
|
|
|
+ return { title: payload.title, path: payload.path }
|
|
|
|
|
+ },
|
|
|
|
|
+ shareSingleOrder(info) {
|
|
|
|
|
+ if (!canShareSingleOrder(info)) {
|
|
|
|
|
+ this.pendingSharePayload = null
|
|
|
|
|
+ this.$msg('暂无可分享订单')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ this.shareMode = 'single'
|
|
|
|
|
+ this.singleShareOrderId = info.id || 0
|
|
|
|
|
+ const payload = buildSingleSharePayload(info)
|
|
|
|
|
+ if (!payload) {
|
|
|
|
|
+ this.pendingSharePayload = null
|
|
|
|
|
+ this.$msg('暂无可分享订单')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ this.pendingSharePayload = payload
|
|
|
|
|
+ // #ifdef APP-PLUS
|
|
|
|
|
+ shareSingleOrderOnApp({ dictInfo: this.getDictionariesInfo, info: info })
|
|
|
|
|
+ // #endif
|
|
|
},
|
|
},
|
|
|
shareAllOrder(){
|
|
shareAllOrder(){
|
|
|
- const info = this.shareInfo || {}
|
|
|
|
|
- if (!info.mergeId || !info.salt) {
|
|
|
|
|
|
|
+ this.shareMode = 'merge'
|
|
|
|
|
+ this.singleShareOrderId = 0
|
|
|
|
|
+ const mpPath = getMergeSharePath(this.shareInfo)
|
|
|
|
|
+ if (!mpPath) {
|
|
|
|
|
+ this.pendingSharePayload = null
|
|
|
this.$msg('暂无可分享订单')
|
|
this.$msg('暂无可分享订单')
|
|
|
return false
|
|
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)
|
|
|
|
|
+ this.pendingSharePayload = {
|
|
|
|
|
+ type: 'merge',
|
|
|
|
|
+ title: this.shareTitle,
|
|
|
|
|
+ path: mpPath
|
|
|
|
|
+ }
|
|
|
// #ifdef APP-PLUS
|
|
// #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'
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const appPayload = shareMergeAllOnApp({
|
|
|
|
|
+ dictInfo: this.getDictionariesInfo,
|
|
|
|
|
+ shareInfo: this.shareInfo,
|
|
|
|
|
+ listData: this.list.data
|
|
|
})
|
|
})
|
|
|
|
|
+ if (!appPayload) {
|
|
|
|
|
+ this.$msg('暂无可分享订单')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
// #endif
|
|
// #endif
|
|
|
},
|
|
},
|
|
|
//这个有多处要同步修改,关键词:fh_express_pop
|
|
//这个有多处要同步修改,关键词:fh_express_pop
|