shish 2 tahun lalu
induk
melakukan
be003178db
3 mengubah file dengan 103 tambahan dan 248 penghapusan
  1. 3 1
      ghs/src/cool/request/index.js
  2. 6 0
      ghs/src/service/stat-book/index.js
  3. 94 247
      ghs/src/views/order/book.vue

+ 3 - 1
ghs/src/cool/request/index.js

@@ -34,6 +34,7 @@ import custom from '@/service/custom/index';
 import product from '@/service/product/index';
 import product from '@/service/product/index';
 import ptItemClass from '@/service/pt-item-class/index';
 import ptItemClass from '@/service/pt-item-class/index';
 import ghsItemClass from '@/service/ghs-item-class/index';
 import ghsItemClass from '@/service/ghs-item-class/index';
+import statBook from '@/service/stat-book/index';
 
 
 export function SET_SERVICE({ store }) {
 export function SET_SERVICE({ store }) {
 	// const files = require.context('@/service/', true, /\.js$/);
 	// const files = require.context('@/service/', true, /\.js$/);
@@ -73,7 +74,8 @@ export function SET_SERVICE({ store }) {
 		custom,
 		custom,
 		product,
 		product,
 		ptItemClass,
 		ptItemClass,
-		ghsItemClass
+		ghsItemClass,
+		statBook
 	};
 	};
 
 
 	Vue.prototype.$service = modules;
 	Vue.prototype.$service = modules;

+ 6 - 0
ghs/src/service/stat-book/index.js

@@ -0,0 +1,6 @@
+import { BaseService, Service } from '@/cool';
+@Service('stat-book')
+export class StatBookService extends BaseService {
+
+}
+export default new StatBookService();

+ 94 - 247
ghs/src/views/order/book.vue

@@ -3,7 +3,7 @@
     <x-crud class="liu-crud-wrap order-list-wrap" @load="onLoad">
     <x-crud class="liu-crud-wrap order-list-wrap" @load="onLoad">
       <!-- tabs -->
       <!-- tabs -->
       <template #slot-tabs>
       <template #slot-tabs>
-        <el-tabs class="liu-tabs" type="border-card" v-model="tabIndex" @tab-click="handleClick">
+        <el-tabs class="liu-tabs" type="border-card" v-model="tabIndex">
           <el-tab-pane
           <el-tab-pane
               v-for="(item, index) in tabsData"
               v-for="(item, index) in tabsData"
               :key="index"
               :key="index"
@@ -13,40 +13,6 @@
         </el-tabs>
         </el-tabs>
       </template>
       </template>
 
 
-      <!-- 单号 -->
-      <template #table-column-orderSn="{scope}">
-        <el-link
-            :underline="true"
-            style="font-size:12px;display:inline-block;"
-        >{{ scope.row.orderSn }}</el-link>
-      </template>
-
-      <template #table-column-customName="{scope}">
-        <div>
-          {{ scope.row.customName }}
-        </div>
-      </template>
-
-      <template #table-column-customMobile="{scope}">
-        <div v-if="scope.row.customMobile == ''">-</div>
-        <div v-else>{{ scope.row.customMobile }}</div>
-      </template>
-
-      <!-- 状态 -->
-      <template #table-column-status="{scope}">
-        <span v-if="scope.row.status == 2">待配送</span>
-        <span v-else-if="scope.row.status == 3">配送中</span>
-        <span v-else-if="scope.row.status == 4">已完成</span>
-        <span v-else-if="scope.row.status == 5">已取消</span>
-        <span v-else>待付款</span>
-      </template>
-
-      <!-- 送达时间 -->
-      <template #table-column-reachTime="{scope}">
-				<span>
-					{{scope.row.requireReachTime}}
-				</span>
-      </template>
 
 
       <!-- 操作 -->
       <!-- 操作 -->
       <template #slot-column-option="{scope}">
       <template #slot-column-option="{scope}">
@@ -54,69 +20,27 @@
       </template>
       </template>
 
 
 			<template #slot-search-date="{scope}">
 			<template #slot-search-date="{scope}">
-        <el-date-picker type="date" placeholder="开始日期" v-model="adForm.startTime" value-format="yyyy-MM-dd" style="margin-right: 10px;" @change="changeStartDate()"></el-date-picker>
-        <el-date-picker type="date" placeholder="结束日期" v-model="adForm.endTime" value-format="yyyy-MM-dd" style="margin-right: 10px;" @change="changeEndDate()"></el-date-picker>
+        <el-date-picker v-model="searchDate" @change="changeDate()" value-format="yyyy-MM-dd" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
+        </el-date-picker>
 			</template>
 			</template>
 
 
+			<!-- 添加商品 -->
+			<template #slot-add-goods-btn>
+
+
+        <el-popover style="margin-left:10px;margin-right:10px;" placement="top" width="160" ref="printRef">
+          <p>确认打印?</p>
+          <div style="text-align: right; margin: 0">
+          <el-button size="mini" type="text" @click.stop="cancelPrint()">取消</el-button>
+          <el-button type="primary" size="mini" @click.stop="printOrder()">确定</el-button>
+          </div>
+          <el-button slot="reference" type="primary" @click.stop="">A4打印</el-button>
+        </el-popover>
+				
+			</template>
 
 
     </x-crud>
     </x-crud>
-    <!-- 用户详情 -->
-    <order-detail ref="orderDetail" :orderOperate="optionData" />
-    <!-- 发货状态 -->
-    <sel-order ref="selOrder" :id="optionData.id" @song-success="onSongSuccess" />
-    <!-- 配送单 -->
-    <div class="print-html-box">
-      <table border="0" width="730" style="border:solid 1px #fff;border-collapse:collapse">
-        <tr>
-          <td style="width: 340px;">客户:{{orderData.customName}} {{orderData.customMobile}}</td>
-          <td style="width: 200px;">单号:{{orderData.orderSn}}</td>
-          <td style="width: 220px;">日期:{{orderData.deadline}}</td>
-        </tr>
-        <tr>
-          <td colspan="3">地址:{{orderData.fullAddress}}<span v-if="orderData.showAddress!=''">({{orderData.showAddress}})</span></td>
-        </tr>
-      </table>
-      <table border="1" width="730" style="border:solid 1px black;border-collapse:collapse">
-        <tr>
-          <td style="width: 50px;text-align: center;">序号</td>
-          <td style="width: 250px;text-align: center;">名称</td>
-          <td style="width: 80px;text-align: center;">单位</td>
-          <td style="width: 80px;text-align: center;">数量</td>
-          <td style="width: 80px;text-align: center;">单价</td>
-          <td style="width: 60px;text-align: center;">金额</td>
-          <td style="width: 100px;text-align: center;">备注</td>
-        </tr>
-        <tr v-for="(res,i) in orderData.product">
-          <td style="width: 50px;text-align: center;">{{ i+1 }}</td>
-          <td style="width: 250px;text-align: center;">{{ res.name }}</td>
-          <td style="width: 80px;text-align: center;">扎/支</td>
-          <td style="width: 80px;text-align: center;">{{ `${res.bigNum}/${res.smallNum}` }}</td>
-          <td style="width: 80px;text-align: center;">{{ res.price }}</td>
-          <td style="width: 80px;text-align: center;" v-if="res.ratio==0">{{  Number(res.price) * (Number(res.bigNum) + 0) }}</td>
-          <td style="width: 80px;text-align: center;" v-else>{{  Number(res.price) * (Number(res.bigNum) + Number(res.smallNum) / Number(res.ratio)) }}</td>
-          <td style="width: 100px;text-align: center;"></td>
-        </tr>
-        <tr>
-          <td style="width: 100px;"></td>
-          <td style="width: 100px;font-weight:bold;" colspan="6">
-            <span>合计:{{orderData.actPrice}}<span v-if="orderData.sendCost > 0">(运费:{{orderData.sendCost}} )</span></span>
-            <span style="margin-left:30px;">应收:{{orderData.realPrice}}</span>
-            <span style="margin-left:30px;">实收:{{orderData.debt==0?orderData.realPrice:'0.00'}}</span>
-            <span v-if="orderData.debtAmount > 0" style="margin-left:30px;">累计欠款:{{orderData.debtAmount}}</span>
-          </td>
-        </tr>
-        <tr>
-          <td style="width: 100px;">其他说明:</td>
-          <td style="width: 100px;" colspan="6">{{orderData.remark}}</td>
-        </tr>
-      </table>
-      <table border="0" width="730" style="border:solid 1px #fff;border-collapse:collapse">
-        <tr >
-          <td style="width: 260px;" colspan="2">开单:{{orderData.shopAdminName}}</td>
-          <td style="width: 260px;">打印时间:{{todays(1)}}</td>
-        </tr>
-      </table>
-    </div>
+
   </div>
   </div>
 </template>
 </template>
 
 
@@ -132,6 +56,42 @@ export default {
   },
   },
   data() {
   data() {
     return {
     return {
+      pickerOptions: {
+          shortcuts: [{
+            text: '今天',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              picker.$emit('pick', [start, end]);
+            }
+          },
+          {
+            text: '最近一周',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近一个月',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+              picker.$emit('pick', [start, end]);
+            }
+          }, {
+            text: '最近三个月',
+            onClick(picker) {
+              const end = new Date();
+              const start = new Date();
+              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+              picker.$emit('pick', [start, end]);
+            }
+          }]
+        },
+      searchDate:[],
       app: null,
       app: null,
       tabIndex: '0',
       tabIndex: '0',
       tabsData: [
       tabsData: [
@@ -142,171 +102,74 @@ export default {
         }
         }
       ],
       ],
       optionData: {},
       optionData: {},
-      orderData:'',
-			adForm: {
-				startTime: '',
-				endTime: ''
-			}
+      searchTime:'today',
+      startDate:'',
+      endDate:''
     };
     };
   },
   },
   created() {
   created() {
     this.init();
     this.init();
   },
   },
   methods: {
   methods: {
-    changeStartDate(){
-      console.log(this.adForm)
-    },
-    changeEndDate(){
-      console.log(this.adForm)
-    },
-    todays(type) {
-      var myDate = new Date();
-      let todaty = '';
-      if(type==1){
-        todaty = myDate.getFullYear()+'-'+parseInt(myDate.getMonth()+1)+'-'+myDate.getDate()+' '+myDate.getHours()+':'+myDate.getMinutes()+':'+myDate.getSeconds()
-      }else if(type=='time'){
-        todaty = myDate.getHours()+':'+myDate.getMinutes();
-      }else{
-        let getDate = myDate.getDate()>9?myDate.getDate():'0'+myDate.getDate()
-        let getDateMonth = parseInt(myDate.getMonth()+1)>9?parseInt(myDate.getMonth()+1):'0'+parseInt(myDate.getMonth()+1)
-        todaty = myDate.getFullYear()+'-'+getDateMonth+'-'+getDate
-      }
-      return todaty
-    },
-    formatProgress(){
-      return ''
-    },
-    init() {
-      this.$store.dispatch('getUsage');
-    },
-    selfGetCancel(id) {
-      this.$refs[`popover-` + id][1].doClose();
-    },
-    noSendShipFn(item) {
-      this.$refs[`popover-` + item.id][1].doClose();
-      this.$service.order.freeShipping({ id: item.id }).then(res => {
-        this.$message.success('操作成功!');
-        item.buttonList.forEach((ele)=>{
-          if(ele.type=='selfGet'){
-            console.log(ele)
-            ele.disable = 1
-          }
-        })
-      });
+    init(){
+
     },
     },
-    //发货详情
-    shipDrawFn(item) {
-      this.optionData = item;
-      setTimeout(() => {
-        this.$refs.selOrder.init();
-      });
+    cancelPrint(){
+      this.$refs['printRef'].doClose()
     },
     },
-    //获取订单详情
-    detailShowFn(item) {
-      this.optionData = item;
-      setTimeout(() => {
-        this.$refs.orderDetail.init();
-      });
+    printOrder(){
+
     },
     },
-    handleClick(tab, e) {
-      this.app.refresh({ status: this.tabIndex });
+    changeDate(){
+      let startDate = this.searchDate[0] || '' 
+      let endDate = this.searchDate[1] || ''
+      if(startDate == ''){
+        this.$message.error('请选择开始时间');
+        return false
+      }
+      if(endDate != '' && endDate < startDate){
+        this.$message.error('结束时间不能小于开始时间');
+        return false
+      }
+      this.searchTime = 'custom'
+      this.startDate = startDate
+      this.endDate = endDate
+      this.app.refresh({ status: this.tabIndex,searchTime:this.searchTime,startTime:startDate,endTime:endDate});
     },
     },
     onLoad({ ctx, app }) {
     onLoad({ ctx, app }) {
       this.app = app;
       this.app = app;
-
-      //传入参数 shish 2020.5.9
-      if(this.$route.query.status){
-        this.tabIndex = this.$route.query.status
-      }
-
-      ctx.service(this.$service.order)
+      ctx.service(this.$service.statBook)
           .set('table', {
           .set('table', {
             columns: [
             columns: [
               {
               {
-                prop: 'orderSn',
-                label: '单号',
-                align: 'center',
-                width: '160'
-              },
-              {
-                prop: 'prePrice',
-                label: '总价',
+                prop: 'time',
+                label: '日期',
                 align: 'center',
                 align: 'center',
-                width: '110'
+                width: '280'
               },
               },
               {
               {
-                prop: 'actPrice',
-                label: '实付款',
+                prop: 'name',
+                label: '名称',
                 align: 'center',
                 align: 'center',
-                emptyText: '无',
-                width: '110'
+                width: '300'
               },
               },
               {
               {
-                prop: 'customName',
-                label: '客户',
-                align: 'center',
-                width: '150'
-              },
-              {
-                prop: 'customMobile',
-                label: '手机号',
-                align: 'center',
-                width: '120'
-              },
-              {
-                prop: 'bigNum',
+                prop: 'num',
                 label: '数量',
                 label: '数量',
                 align: 'center',
                 align: 'center',
-                width: '150'
-              },
-              {
-                prop: 'sendTypeName',
-                label: '配送方式',
-                align: 'center',
-                width: '150'
-              },
-              {
-                prop: 'reachTime',
-                label: '送达时间',
-                align: 'center',
-                width: 120
-              },
-              {
-                prop: 'sendNum',
-                label: '编号',
-                align: 'center',
-                width: 110
+                width: '210'
               },
               },
               {
               {
-                prop: 'status',
-                label: '状态',
+                prop: 'itemId',
+                label: '花材编号',
                 align: 'center',
                 align: 'center',
-                width: 110
-              },
-              {
-                prop: 'shopAdminName',
-                label: '开单人',
-                align: 'center',
-                width: 110
+                width: '300'
               }
               }
             ],
             ],
-
-            on: {
-              'row-click': (row, column) => {
-                this.detailShowFn(row)
-              }
-            },
-
-            props: {
-              'default-sort': {
-                prop: 'createTime',
-                order: 'descending'
-              }
-            },
             op: {
             op: {
               visible: true,
               visible: true,
               props: {
               props: {
-                width: 220,
+                width: 300,
                 align: 'center',
                 align: 'center',
                 fixed: 'right',
                 fixed: 'right',
                 label: '操作'
                 label: '操作'
@@ -314,30 +177,14 @@ export default {
               layout: ['slot-column-option']
               layout: ['slot-column-option']
             }
             }
           })
           })
-          .set('dict', {
-            search: {
-              keyWord: 'name'
-            }
-          })
-          .set('search', {
-            key: { placeholder: '订单号 / 姓名,支持拼音首字母搜索' }
-          })
           .set('layout', [
           .set('layout', [
             ['slot-tabs'],
             ['slot-tabs'],
-            ['slot-search-date'],
+            ['slot-search-date','slot-add-goods-btn'],
             ['data-table'],
             ['data-table'],
-            ['flex1', 'pagination']
+            []
           ])
           ])
-          .on('refresh', async (params, { next }) => {
-            let  asset  = await next(params);
-            this.tabsData[0].val = asset.shop.totalOrder||0;
-            this.tabsData[1].val = asset.shop.unPayOrder||0;
-            this.tabsData[2].val = asset.shop.unSendOrder||0;
-            this.tabsData[3].val = asset.shop.sendingOrder||0;
-            this.tabsData[4].val = asset.shop.finishOrder||0;
-          })
           .done();
           .done();
-      app.refresh({ status: this.tabIndex });
+          app.refresh({ status: this.tabIndex,searchTime:this.searchTime});
     },
     },
     onSongSuccess() {
     onSongSuccess() {
       this.app.refresh();
       this.app.refresh();