Эх сурвалжийг харах

管理后台:新增打印交界单功能

panyong 3 жил өмнө
parent
commit
48993e4af6

+ 10 - 1
htmldev/manage/src/utils/rules.js

@@ -81,6 +81,14 @@ var time = (rule, value, callback) => {
     callback()
   }
 }
+// 年与日小时分钟秒
+var datetime = (rule, value, callback) => {
+  if (!value.length) {
+    return callback(new Error('请选择日期'))
+  } else {
+    callback()
+  }
+}
 //多选框
 var checkbox = (rule, value, callback) => {
   if (value.length < 1) {
@@ -180,7 +188,8 @@ const formRules = {
   InterNum: [{ required: true, validator: checkInterNum, trigger: 'blur' }],
   coins: [{ required: true, validator: checkInterNum, trigger: 'blur' }],
   uploadImgs: [{ type: 'array', required: true, message: '请选择图片', trigger: ['change', 'blur'] }],
-  time: [{ required: true, validator: time, trigger: ['change', 'blur'] }]
+  time: [{ required: true, validator: time, trigger: ['change', 'blur'] }],
+  datetime: [{ required: true, validator: datetime, trigger: ['change', 'blur'] }]
 }
 
 Vue.prototype.formRules = formRules

+ 75 - 1
htmldev/manage/src/views/business/oms/list/index.vue

@@ -23,6 +23,11 @@
         </el-form-item>
         <el-form-item class="ml-10">
           <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
+          <el-button
+            v-permission="'business_oms_deliver_order_print'"
+            icon="el-icon-printer"
+            type="primary"
+            @click="booDeliverOrderdialogForm = true">打印交接单</el-button>
         </el-form-item>
       </el-form>
     </div>
@@ -128,6 +133,49 @@
         <el-button type="primary" @click="siteOrderSet">确 定</el-button>
       </div>
     </el-dialog>
+    <!--交接单打印-->
+    <el-dialog :visible.sync="booDeliverOrderdialogForm"
+               title="交接单打印">
+      <el-form ref="deliverOrderdialogForm"
+               :model="deliverOrderdialogForm"
+               :rules="formRules">
+        <el-form-item
+          :rules="formRules.datetime"
+          label="营业时间"
+          prop="time">
+          <el-date-picker
+            v-model="deliverOrderdialogForm.time"
+            :default-time="['12:00:00', '12:00:00']"
+            end-placeholder="结束时间"
+            placeholder="选择时间范围"
+            range-separator="至"
+            start-placeholder="开始时间"
+            type="datetimerange"
+            value-format="yyyy-MM-dd HH:mm:ss">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item
+          :rules="formRules.required"
+          label="出单位置"
+          prop="product_place">
+          <el-select
+            v-model="deliverOrderdialogForm.product_place"
+            placeholder="请选择出单位置"
+            style="width: 67%;">
+            <el-option label="厨房" value="0"></el-option>
+            <el-option label="柜台" value="1"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="booDeliverOrderdialogForm = false">取 消</el-button>
+        <el-button
+          :disabled="booLock"
+          type="primary"
+          @click="printDeliverOrder">确 定
+        </el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -144,7 +192,12 @@ export default {
       tableUrl: '/v1/user/order/list',
       booLock: false,
       orderStatusdialogForm: false,
-      dialogForm: {}
+      dialogForm: {},
+      booDeliverOrderdialogForm: false, // 交接单打印弹窗
+      deliverOrderdialogForm: {
+        time: [],
+        product_place: '0'
+      }
     }
   },
   methods: {
@@ -178,6 +231,27 @@ export default {
           console.log('error submit!!')
         }
       })
+    },
+    // 交接单打
+    async printDeliverOrder() {
+      this.$refs['deliverOrderdialogForm'].validate(async valid => {
+        if (valid) {
+          this.booLock = true
+          const { time, product_place } = this.deliverOrderdialogForm
+          const data = await this.$fetch('/v1/user/print/deliverOrder', {
+            order_start_date: time[0], // 打印开始日期
+            order_end_date: time[1], // 打印结束日期
+            product_place
+          }, 'get')
+          this.booLock = false
+          if (data.code === 200) {
+            this.$message.success('交接已单打印')
+            this.booDeliverOrderdialogForm = false
+          }
+        } else {
+          console.log('error submit!!')
+        }
+      })
     }
   },
   mounted() {