Explorar o código

合并分享订单

shish hai 2 meses
pai
achega
7b75e7791f

+ 58 - 1
ghsApp/src/admin/order/mergeOrder.vue

@@ -20,6 +20,7 @@
       <view class="bar-content">
         <button class="admin-button-com big blue" @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;" open-type="share" @click="shareAllOrder()">全部分享</button>
       </view>
     </view>
 
@@ -52,6 +53,7 @@ import { mapGetters } from "vuex";
 import orderMixin from "@/mixins/order";
 import OrderItem from "../home/components/OrderItem"
 import { getMergeOrderList,cloudPrintOrder,mergePrintFn,allFhAction,orderFh} from "@/api/order";
+import { IMGHOST } from "@/config";
 export default {
   name: "mergeOrder",
   components: {
@@ -69,6 +71,8 @@ export default {
       fhWl:'顺丰',
       fhWlFocus:false,
       fhLabelShow:false,
+      shareInfo: {},
+      shareTitle: '订单列表',
     }
   },
   onPullDownRefresh() {
@@ -97,7 +101,59 @@ export default {
     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
+    }
+  },
   methods: {
+    getShareConfig() {
+      const info = this.shareInfo || {}
+      const id = info.id || 0
+      const salt = info.salt || ''
+      const title = this.shareTitle || '订单列表'
+      return {
+        title,
+        hdPath: 'pagesPurchase/mergeOrder?id=' + id + '&salt=' + salt,
+        path: 'pagesOrder/showMergeOrder?id=' + id + '&salt=' + salt
+      }
+    },
+    shareAllOrder(){
+      const info = this.shareInfo || {}
+      if (!info.id || !info.salt) {
+        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
+      this.shareTitle = customName + ' 共' + count + '个订单'
+      const share = this.getShareConfig()
+      // #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'
+        }
+      })
+      // #endif
+    },
     //这个有多处要同步修改,关键词:fh_express_pop
     fillNoFh(info){
       let that = this
@@ -201,6 +257,7 @@ export default {
     getOrderList() {
         let mergeId = this.option.mergeId?this.option.mergeId:0
         return getMergeOrderList({ mergeId:mergeId }).then((res) => {
+          this.shareInfo = res.data && res.data.shareInfo ? res.data.shareInfo : {}
           this.completes(res)
         }) 
     }
@@ -304,4 +361,4 @@ page{
     padding: 10upx 40upx;
   }
 }
-</style>
+</style>

+ 2 - 1
ghsApp/src/pages.json

@@ -107,6 +107,7 @@
 				{"path": "detail","style": {"navigationBarTitleText": "订单详情", "enablePullDownRefresh": true}},
 				{"path": "tree","style": {"navigationBarTitleText": "数量", "enablePullDownRefresh": true}},
 				{"path": "showOrder","style": {"navigationBarTitleText": "订单", "enablePullDownRefresh": true}},
+				{"path": "showMergeOrder","style": {"navigationBarTitleText": "订单"}},
 				{"path": "info","style": {"navigationBarTitleText": "订单详情", "enablePullDownRefresh": true}},
 				{"path": "arrival","style": {"navigationBarTitleText": "确认发货"}},
 				{"path": "result","style": {"navigationBarTitleText": "结果"}},
@@ -589,4 +590,4 @@
 			{ "pagePath": "admin/home/me", "iconPath": "static/images/common/user-no.png", "selectedIconPath": "static/images/common/shop-me.png", "text": "我的" }
 		]
 	}
-}
+}

+ 65 - 0
ghsApp/src/pagesOrder/showMergeOrder.vue

@@ -0,0 +1,65 @@
+<template>
+  <view class="app-content">
+    <view class="billing_box_bg">
+      <view class="result-view">
+        <view class="title">订单列表</view>
+        <button v-if="showButton" class="admin-button-com big blue" style="width:45vw;" @click="showMergeOrder()">点击查看订单</button>
+      </view>
+    </view>
+  </view>
+</template>
+<script>
+import { getWeixinId } from "@/api/invite/index"
+export default {
+  name: "showMergeOrder",
+  data() {
+    return {
+      getAppIdList: {},
+      showButton: false
+    }
+  },
+  onLoad() {
+    getWeixinId().then(res => {
+      this.getAppIdList = res.data
+      this.showButton = true
+    })
+  },
+  methods: {
+    init(){
+    },
+    showMergeOrder() {
+      const id = this.option.id || 0
+      const salt = this.option.salt || ''
+      uni.navigateToMiniProgram({
+        appId: this.getAppIdList.hd.miniAppId,
+        path: 'pagesPurchase/mergeOrder?id=' + id + '&salt=' + salt,
+        envVersion: process.env.NODE_ENV === 'development' ? 'develop' : 'release',
+        extraData: {
+          id,
+          salt
+        }
+      })
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.billing_box_bg {
+  padding: 60upx 30upx;
+  background-color: #f5f5f5;
+}
+.result-view {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  padding: 70upx;
+  width: 100%;
+  background: #ffffff;
+  border-radius: 20upx;
+  .title {
+    margin-bottom: 60upx;
+    font-size: 34upx;
+    color: #333333;
+  }
+}
+</style>

+ 7 - 0
hdApp/src/api/purchase/index.js

@@ -63,6 +63,13 @@ export const createPurchaseOrderApi = async data => {
 	return https.get("/purchase/list", data);
 };
 
+/** *
+ * 合并采购记录
+ */
+ export const getMergePurchaseList = async data => {
+	return https.get("/purchase/merge-order-list", data);
+};
+
 /** *
  * 待结款明细
  */

+ 2 - 1
hdApp/src/pages.json

@@ -514,6 +514,7 @@
 				{ "path": "pb", "style": { "navigationBarTitleText": "已删批发店", "enablePullDownRefresh": true } },
 				{ "path": "open", "style": { "navigationBarTitleText": "商城功能开关", "enablePullDownRefresh": true } },
 				{ "path": "shopping", "style": { "navigationBarTitleText": "采购", "enablePullDownRefresh": true } },
+				{ "path": "mergeOrder", "style": { "navigationBarTitleText": "采购列表", "enablePullDownRefresh": true } },
 				{ "path": "ghsProduct", "style": { "navigationBarTitleText": "采购花材", "enablePullDownRefresh": false } },
 				{ "path": "ghsProduct2", "style": { "navigationBarTitleText": "采购花材", "enablePullDownRefresh": false } },
 				{ "path": "setPsd", "style": { "navigationBarTitleText": "设置密码", "enablePullDownRefresh": true } },
@@ -657,4 +658,4 @@
 			}
 		]
 	}
-}
+}

+ 83 - 0
hdApp/src/pagesPurchase/mergeOrder.vue

@@ -0,0 +1,83 @@
+<template>
+  <view class="order-page">
+    <block v-if="!$util.isEmpty(list.data)">
+      <view class="pay_list">
+        <OrderItem
+          v-for="(item, index) in list.data"
+          :key="index"
+          :info="item"
+          :showMergeTip="false"
+          @click="goToDetail"
+        ></OrderItem>
+      </view>
+    </block>
+    <block v-else>
+      <view>
+        <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)"/>
+      </view>
+    </block>
+  </view>
+</template>
+
+<script>
+import OrderItem from "./orderItem";
+import { list } from "@/mixins";
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { getMergePurchaseList } from "@/api/purchase/index";
+
+export default {
+  components: {
+    AppWrapperEmpty,
+    OrderItem
+  },
+  mixins: [list],
+  data () {
+    return {
+      id: 0,
+      salt: ''
+    }
+  },
+  onReachBottom () {
+    if (!this.list.finished) {
+      this.getOrderList().then(res => {
+        uni.stopPullDownRefresh()
+      });
+    } else {
+      uni.stopPullDownRefresh()
+    }
+  },
+  onPullDownRefresh () {
+    this.resetList();
+    this.getOrderList().then(res => {
+      uni.stopPullDownRefresh()
+    })
+  },
+  methods: {
+    init () {
+      this.id = this.option.id ? this.option.id : 0
+      this.salt = this.option.salt ? this.option.salt : ''
+      this.getOrderList()
+    },
+    getOrderList () {
+      return getMergePurchaseList({ id: this.id, salt: this.salt, page: this.list.page }).then(res => {
+        this.completes(res)
+      })
+    },
+    goToDetail (val) {
+      const salt = val.salt ? val.salt : ''
+      uni.navigateTo({ url: '/pagesPurchase/purDetails?id=' + val.id + '&salt=' + salt })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.order-page {
+  .pay_list {
+    min-height: 100vh;
+    padding-top: 20upx;
+    padding-bottom: 100upx;
+    background-color: #f0f2f6;
+  }
+}
+</style>

+ 24 - 1
hdApp/src/pagesPurchase/orderItem.vue

@@ -53,6 +53,13 @@
         <text class="iconfont iconxiangyou"></text>
       </view>
     </view>
+    <view
+      v-if="showMergeTip && info.mergeNum && info.mergeNum > 1"
+      class="merge-tips"
+      @click.stop="clickMergeEvent"
+    >
+      当天共采购{{ info.mergeNum }}个订单
+    </view>
   </view>
 </template>
 <script>
@@ -61,6 +68,10 @@ export default {
   props: {
     info: {
       required: true
+    },
+    showMergeTip: {
+      type: Boolean,
+      default: true
     }
   },
   data () {
@@ -97,6 +108,9 @@ export default {
   methods: {
     clickItemEvent () {
       this.$emit("click", this.info);
+    },
+    clickMergeEvent () {
+      this.$emit("merge-click", this.info);
     }
   }
 };
@@ -171,5 +185,14 @@ export default {
       }
     }
   }
+  .merge-tips {
+    margin: 24upx 20upx 0;
+    padding: 16upx 20upx;
+    text-align: center;
+    color: #fff;
+    font-size: 30upx;
+    background-color: #09C567;
+    border-radius: 8upx;
+  }
 }
-</style>
+</style>

+ 2 - 1
hdApp/src/pagesPurchase/purDetails.vue

@@ -593,7 +593,8 @@ export default {
     },
     initData (id) {
       let that = this
-      return purchaseDetail({ id: id }).then(res => {
+      let salt = this.option.salt ? this.option.salt : ''
+      return purchaseDetail({ id: id, salt: salt }).then(res => {
         that.detailInfo = res.data
         that.settlePrice = Number(that.detailInfo.bookPrice) - Number(that.detailInfo.orderPrice)
         that.settlePrice = parseFloat(that.settlePrice.toFixed(2))

+ 18 - 2
hdApp/src/pagesPurchase/shopping.vue

@@ -13,7 +13,13 @@
 
     <block v-if="!$util.isEmpty(list.data)">
     <view class="pay_list">
-        <OrderItem v-for="(item, index) in list.data" :key="index" :info="item" @click="goToDetail"></OrderItem>
+        <OrderItem
+          v-for="(item, index) in list.data"
+          :key="index"
+          :info="item"
+          @click="goToDetail"
+          @merge-click="goToMergeList"
+        ></OrderItem>
     </view>
     </block>
     <block v-else>
@@ -78,6 +84,7 @@ export default {
 			searchContent:'',			
 			searchTime:'',
 			startTime:'',
+      endTime:'',
       ghsId:0,
       ghsName:''
     }
@@ -162,6 +169,15 @@ export default {
     goToDetail (val) {
       uni.navigateTo({ url: '/pagesPurchase/purDetails?id=' + val.id })
     },
+    goToMergeList (val) {
+      let mergeId = val.mergeId ? val.mergeId : 0
+      let ghsId = val.ghsId ? val.ghsId : 0
+      if (mergeId == 0 || ghsId == 0) {
+        this.$msg('没有找到合并采购单')
+        return false
+      }
+      this.$util.pageTo({ url: '/pagesPurchase/mergeOrder', query: { mergeId: mergeId, ghsId: ghsId } })
+    },
     addEvent() {
       uni.navigateTo({url: '/pagesPurchase/order'})
     }
@@ -257,4 +273,4 @@ export default {
     background-color: #f0f2f6;
   }
 }
-</style>
+</style>