فهرست منبع

Merge branch 'moss_20240223'

* moss_20240223:
  feat:调整订单打印模版
  feat:1. 订单列表和详情中,需要记录打印次数和打印时间; 2. 打印模板调整
Moss 1 سال پیش
والد
کامیت
930b416774

+ 18 - 0
src/api/order.js

@@ -332,4 +332,22 @@ export function getOrderTypeList(data) {
     method: 'post',
     data
   })
+}
+
+// 记录打印次数
+export function recordPrint(params) {
+  return request({
+    url: '/order/print/count',
+    method: 'post',
+    params
+  })
+}
+
+// 查询打印记录列表
+export function getPrintList(params) {
+  return request({
+    url: '/order/query/print/record',
+    method: 'post',
+    params
+  })
 }

+ 8 - 0
src/views/mallManagement/order/components/preview.vue

@@ -22,6 +22,8 @@
 </template>
 
 <script>
+import { recordPrint } from "@/api/order";
+
 export default {
     name: 'PrintPreview',
   props: {
@@ -29,6 +31,11 @@ export default {
       type: Function,
       default: null
     },
+
+    printOrderId: {
+      type: String,
+      default: ''
+    }
   },
  
   data() {
@@ -66,6 +73,7 @@ export default {
     },
     print() {
       this.hiprintTemplate.print()
+      recordPrint({orderId: this.printOrderId})
       setTimeout(() => {
         this.hideModal()
         this.$emit('refreshList')

+ 54 - 27
src/views/mallManagement/order/order_detail/index.vue

@@ -17,32 +17,49 @@
       </el-row>
       <div style="width: 100%; padding: 10px 15px 15px 15px">
         <el-row>
-          <el-col :span="8" style="border-right: 1px solid #e8e8e8;">
-            <div class="order-main-status">
-              <span>{{ orderDetail.orderStatus | ORDER_CURRENT_STATUS_FILTER }}</span>
-            </div>
-            <div class="order-main-opt-btn">
-              <template v-if="orderDetail.orderStatus === 'NOPAY'">
-                <el-popconfirm title="确定收款吗?" @confirm="confirmOrder">
-                  <el-button slot="reference" size="small">确认收款</el-button>
-                </el-popconfirm>
-                <el-button size="small" @click="showDialog('price')" style="margin-left: 10px;">修改价格</el-button>
-                <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
-                  <el-button slot="reference" size="small" type="danger">取消订单</el-button>
-                </el-popconfirm>
-              </template>
-              <template v-if="orderDetail.orderStatus === 'DFH'">
-                <el-button size="small" type="primary" @click="showDialog('send')">发货</el-button>
-                <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
-                  <el-button slot="reference" size="small" type="danger">取消订单</el-button>
-                </el-popconfirm>
-              </template>
-              <template v-if="orderDetail.orderStatus === 'YFH' || orderDetail.orderStatus === 'OVER'">
-                <el-button size="small" @click="showDialog('query')">查看物流</el-button>
-              </template>
+          <el-col :span="10">
+            <div style="display: flex;">
+              <div>
+                <div class="order-main-status">
+                  <span>{{ orderDetail.orderStatus | ORDER_CURRENT_STATUS_FILTER }}</span>
+                </div>
+                <div class="order-main-opt-btn">
+                  <template v-if="orderDetail.orderStatus === 'NOPAY'">
+                    <el-popconfirm title="确定收款吗?" @confirm="confirmOrder">
+                      <el-button slot="reference" size="small">确认收款</el-button>
+                    </el-popconfirm>
+                    <el-button size="small" @click="showDialog('price')" style="margin-left: 10px;">修改价格</el-button>
+                    <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
+                      <el-button slot="reference" size="small" type="danger">取消订单</el-button>
+                    </el-popconfirm>
+                  </template>
+                  <template v-if="orderDetail.orderStatus === 'DFH'">
+                    <el-button size="small" type="primary" @click="showDialog('send')">发货</el-button>
+                    <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
+                      <el-button slot="reference" size="small" type="danger">取消订单</el-button>
+                    </el-popconfirm>
+                  </template>
+                  <template v-if="orderDetail.orderStatus === 'YFH' || orderDetail.orderStatus === 'OVER'">
+                    <el-button size="small" @click="showDialog('query')">查看物流</el-button>
+                  </template>
+                </div>
+              </div>
+              <el-table
+                class="specTable"
+                style="margin-left: 30px;"
+                height="120px"
+                :data="printList"
+                element-loading-text="Loading"
+                border
+                highlight-current-row
+                stripe>
+                <el-table-column align="center" label="打印人" prop="createBy" min-width="120" show-overflow-tooltip></el-table-column>
+                <el-table-column align="center" label="打印时间" prop="createTime" width="160"></el-table-column>
+              </el-table>
             </div>
+            
           </el-col>
-          <el-col :span="16" style="padding-top: 10px;">
+          <el-col :span="14" style="padding-top: 10px;">
             <el-steps :active="orderDetail.orderStatus != 'CLOSE' ? curOrderStatus : -1" align-center>
               <el-step title="买家下单" :description="orderDetail.createTime"></el-step>
               <el-step title="买家付款" :description="orderDetail.payTime ? orderDetail.payTime : ''"></el-step>
@@ -511,7 +528,7 @@ import {
   confirmOrder,
   getOrderDetail, goodsDeliver,
   saveRemark, orderRefund, orderCompensate, getCompensateList,
-  changeShow, getCodeDetail, getMaterialList, listImport, saveCode, delCode
+  changeShow, getCodeDetail, getMaterialList, listImport, saveCode, delCode, getPrintList
 } from "@/api/order";
 import { getExpress, getCompanyList } from "@/api/common";
 import { commonTemplateDownload } from '@/api/common.js'
@@ -663,7 +680,9 @@ export default {
 	  isEdit1: 0,
 	  isEdit2: 0,
 	  joinCode: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
-	  orderDetailId: ''
+	  orderDetailId: '',
+
+    printList: [],
     }
   },
   created() {
@@ -672,6 +691,7 @@ export default {
     this.getStorageList();
     this.getCompanyList();
     this.getCompensateList();
+    this.getPrintList();
   },
   methods: {
     getDetail() {
@@ -680,9 +700,16 @@ export default {
         this.orderDetail.workerName = this.orderDetail.workerName ? this.orderDetail.workerName : '暂无'
         this.orderDetail.workerPhone = this.orderDetail.workerPhone ? this.orderDetail.workerPhone : ''
         this.evaluateDetail = res.data.orderComment;
-		this.formData1.list = res.data.orderDetails
+		    this.formData1.list = res.data.orderDetails
+      })
+    },
+
+    getPrintList() {
+      getPrintList({ orderId: this.orderId }).then(res => {
+        this.printList = res.data || [];
       })
     },
+
     showDialog(type) {
       this.dialogWidth = type === 'query' ? '80%' : type === 'send' ? '80%': '50%'
       this.remarkVisible = true

+ 32 - 14
src/views/mallManagement/order/order_list/index.vue

@@ -272,7 +272,7 @@
                         <el-button type="text" size="small"
                           v-if="(order.orderStatus === 'DFH' || order.orderStatus === 'YFH')"
                           @click="toPrint(order)">
-                          打印
+                          打印{{order.printRecordCount ? `(${order.printRecordCount}次)` : ''}}
                         </el-button>
                       </div>
                     </div>
@@ -633,7 +633,7 @@
 
     </zj-tab-page>
     
-    <print-preview ref="preView" @initPrint="handleInitPrint" @refreshList="handleRefreshList" />
+    <print-preview ref="preView" :printOrderId="printOrderId" @initPrint="handleInitPrint" @refreshList="handleRefreshList" />
   </div>
 	
 </template>
@@ -765,7 +765,9 @@ export default {
 		isEdit1: 0,
 		isEdit2: 0,
 		joinCode: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
-		orderDetailId: ''
+		orderDetailId: '',
+
+    printOrderId: ''
     }
   },
   computed: {
@@ -798,9 +800,9 @@ export default {
     this.getStorageList();
     this.getCompanyList();
     this.getWebsiteList();
-	if(this.$route.query.id){
-		this.queryDetail(this.$route.query.id)
-	}
+    if(this.$route.query.id){
+      this.queryDetail(this.$route.query.id)
+    }
   },
   methods: {
     queryWorkOrder(id) {
@@ -1506,10 +1508,9 @@ export default {
 	},
 
 
-
-
     // 点击打印
 		async toPrint(row) {
+      this.printOrderId = row.orderId;
 			let pagingData = []
 			const { data } = await getOrderDetail({
 				orderId: row.orderId
@@ -1568,7 +1569,7 @@ export default {
 							left: 20,
 							fontFamily: '黑体',
 							fontSize: 13,
-							content: this.setTableDom(data, html, totalAmount, num, len, i)
+							content: this.setTableDom(data, html, totalAmount, num, len, i, row.printRecordCount)
 						}
 					})
 
@@ -1588,7 +1589,23 @@ export default {
 		},
 
 		// 打印模板
-		setTableDom(data, html, totalAmount, num, length, page) {
+		setTableDom(data, html, totalAmount, num, length, page, printRecordCount) {
+      let now = new Date();
+      let year = now.getFullYear();
+      let month = now.getMonth() + 1; // 月份是从 0 开始计数的,所以要加 1
+      let day = now.getDate();
+      let hours = now.getHours();
+      let minutes = now.getMinutes();
+      let seconds = now.getSeconds();
+      let nowTime = `${year}-${month < 10 ? '0'+month : month}-${day < 10 ? '0'+day : day} ${hours < 10 ? '0'+hours : hours}:${minutes < 10 ? '0'+minutes : minutes}:${seconds < 10 ? '0'+seconds : seconds}`
+
+      let showpPrintCount = '';
+      if(printRecordCount) {
+        showpPrintCount = `重打日期: ${nowTime}`
+      }else {
+        showpPrintCount = `打印日期: ${nowTime}`
+      }
+
 			return `
 	   <div style="font-family:'黑体';font-size: 16px;">
 			<div style="display: flex;justify-content: center;align-items: center;position: relative;">
@@ -1596,7 +1613,7 @@ export default {
 				<div style="position: absolute;right:0;">共 ${length}页 第 ${page+1} 页</div>
 			</div>
 		  <div style="display: flex;justify-content: space-between;">
-			<div style="width: 28%;"></div>
+			<div>${showpPrintCount}</div>
 			<div>单据日期: ${data.createTime}</div>
 			<div>单据编号: ${data.orderId}</div>
 		  </div>
@@ -1605,7 +1622,7 @@ export default {
 		  	<div>摘要: ${data.payType}</div>
 		  </div>
 		  <div style="display: flex;font-size: 16px;margin-bottom: 10px;">
-		  	<div>联系电话: ${data.recePhone}</div>
+		  	<div style="flex-shrink: 0;">联系电话: ${data.recePhone}</div>
 		  	<div style="margin-left: 50px;">收货地址: ${data.province}${data.city}${data.area}${data.street}${data.receAddress}</div>
 		  </div>
 	      <div >
@@ -1656,8 +1673,9 @@ export default {
 		},
 
 		handleRefreshList() {
-			this.recordSelected = []
-			this.$refs.pageRef.refreshList()
+      this.getList();
+			// this.recordSelected = []
+			// this.$refs.pageRef.refreshList()
 		},
 
 		handleInitPrint() {