Browse Source

feat:线下订单

Moss 1 year ago
parent
commit
047670592e

+ 10 - 1
src/api/order.js

@@ -234,11 +234,20 @@ export function offlineOrderSave(params) {
   })
 }
 
-// 新增标签
+// 线下订单详情
 export function getOfflineOrderDetail(params) {
   return request({
     url: '/order/offline/detail',
     method: 'post',
     params
   })
+}
+
+// 线下订单审批
+export function offlineOrderExamine(params) {
+  return request({
+    url: '/order/offline/examine',
+    method: 'post',
+    params
+  })
 }

+ 13 - 4
src/views/mallManagement/goods/goods_add/index.vue

@@ -189,7 +189,7 @@
             </el-table-column>
             <el-table-column align="center" label="单位" prop="unit" min-width="120">
               <template slot-scope="scope">
-                {{scope.row.unit}}
+                {{scope.row.unit | unitFilter}}
               </template>
             </el-table-column>
             <el-table-column align="center" label="销售价格" prop="price" min-width="120">
@@ -202,9 +202,9 @@
                 <el-input size="small" v-model="scope.row.orgPrice"></el-input>
               </template>
             </el-table-column>
-            <el-table-column align="center" label="参考成本价" prop="costPrice" min-width="120">
+            <el-table-column align="center" label="参考成本价" prop="costAmount" min-width="120">
               <template slot-scope="scope">
-                {{scope.row.costPrice}}
+                {{scope.row.costAmount}}
               </template>
             </el-table-column>
             <el-table-column align="center" label="佣金" prop="shareAmount" min-width="120">
@@ -377,6 +377,15 @@ export default {
   components: {
     quillEditor
   },
+  filters: {
+    unitFilter(val) {
+      const MAP = {
+        C: '整套',
+        I: '单个'
+      }
+      return MAP[val];
+    },
+  },
   data() {
     return {
       baseURL: process.env.VUE_APP_BASE_API,
@@ -686,7 +695,7 @@ export default {
         unit: '', // 单位
         price: '', // 销售价格
         orgPrice: '', // 划线价格
-        costPrice: '', // 成本价格
+        costAmount: '', // 成本价格
         shareAmount: '', // 分销金额
         innerShareAmount: '', // 内部分销金额
         stockNum: '', // 上架库存

+ 235 - 30
src/views/mallManagement/order/offline_order_list/index.vue

@@ -209,37 +209,162 @@
 			</div>
 
       <div v-if="~['detail', 'examine'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
-        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%">
+        <div style="font-weight: 500;">单据信息</div>
+        <el-divider></el-divider>
+
+        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%" contentStyle="width: 17%">
           <el-descriptions-item label="审批状态">
-            {{detailData.companyWechatName}}
+            {{detailData.examineStatus | examineStatusFilter}}
           </el-descriptions-item>
           <el-descriptions-item label="订单单号">
-            {{detailData.companyWechatName}}
+            {{detailData.orderId}}
           </el-descriptions-item>
-          <el-descriptions-item label="所属商户">
+          <el-descriptions-item label="所属商户" contentStyle="width: 42%">
             {{detailData.companyWechatName}}
           </el-descriptions-item>
+        </el-descriptions>
+        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%" contentStyle="width: 17%" style="margin-top: -1px">
           <el-descriptions-item label="业务员">
-            {{detailData.companyWechatName}}
+            {{detailData.saleName}}
           </el-descriptions-item>
-          <el-descriptions-item label="所属商户">
-            {{detailData.companyWechatName}}
+          <el-descriptions-item label="业务员电话">
+            {{detailData.saleMobile}}
           </el-descriptions-item>
-          <el-descriptions-item label="所属商户">
-            {{detailData.companyWechatName}}
+          <el-descriptions-item label="销售类型">
+            线下销售
+          </el-descriptions-item>
+          <el-descriptions-item label="">
+            
           </el-descriptions-item>
         </el-descriptions>
-        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%">
-          <el-descriptions-item label="订单备注">
-            {{detailData.companyWechatName}}
+        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%" contentStyle="width: 17%" style="margin-top: -1px">
+          <el-descriptions-item label="客户姓名">
+            {{detailData.receUserName}}
+          </el-descriptions-item>
+          <el-descriptions-item label="客户电话">
+            {{detailData.recePhone}}
+          </el-descriptions-item>
+          <el-descriptions-item label="详细地址" contentStyle="width: 42%">
+            {{detailData.province}}{{detailData.city}}{{detailData.area}}{{detailData.street}}{{detailData.receAddress}}
           </el-descriptions-item>
         </el-descriptions>
-        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%">
+        <el-descriptions border title="" :column="4" :colon="false" labelStyle="width: 8%" contentStyle="width: 17%" style="margin-top: -1px">
+          <el-descriptions-item label="支付状态">
+            {{detailData.orderStatus == 'NOPAY' || detailData.orderStatus == 'NOPAY' ? '待支付' : '已支付'}}
+          </el-descriptions-item>
+          <el-descriptions-item label="支付方式">
+            {{detailData.payType | payTypeFilter}}
+          </el-descriptions-item>
+          <el-descriptions-item label="支付订单号">
+            {{detailData.transactionId}}
+          </el-descriptions-item>
+          <el-descriptions-item label="支付时间">
+            {{detailData.payTime}}
+          </el-descriptions-item>
+          <el-descriptions-item label="创建人">
+            {{detailData.createBy}}
+          </el-descriptions-item>
+          <el-descriptions-item label="创建时间">
+            {{detailData.createTime}}
+          </el-descriptions-item>
+          <el-descriptions-item label="审批人">
+            {{detailData.examineBy}}
+          </el-descriptions-item>
+          <el-descriptions-item label="审批时间">
+            {{detailData.examineTime}}
+          </el-descriptions-item>
+        </el-descriptions>
+        <el-descriptions border title="" :column="1" :colon="false" labelStyle="width: 8%" contentStyle="width: 92%" style="margin-top: -1px">
+          <el-descriptions-item label="附件">
+            <el-image 
+              style="width: 100px; height: 100px"
+              :src="detailData.fileUrl" 
+              :preview-src-list="[detailData.fileUrl]">
+            </el-image>
+          </el-descriptions-item>
+          <el-descriptions-item label="订单备注">
+            {{detailData.remark}}
+          </el-descriptions-item>
           <el-descriptions-item label="审批备注">
-            {{detailData.companyWechatName}}
+            {{detailData.examineRemark}}
           </el-descriptions-item>
         </el-descriptions>
+
+        <div style="font-weight: 500; margin-top: 20px;">商品信息</div>
+        <el-divider></el-divider>
+
+        <el-table
+          class="specTable"
+          :data="detailData.orderDetails"
+          element-loading-text="Loading"
+          border
+          highlight-current-row
+          stripe
+          style="margin-top: 20px">
+          <el-table-column align="center" label="品牌" prop="brandName" min-width="120"></el-table-column>
+          <el-table-column align="center" label="大类" prop="mainName" min-width="120"></el-table-column>
+          <el-table-column align="center" label="小类" prop="smallName" min-width="120"></el-table-column>
+          <el-table-column align="center" label="商品名称" prop="goodsName" min-width="120"></el-table-column>
+          <el-table-column align="center" label="规格型号" prop="goodsSpecName" min-width="120"></el-table-column>
+          <el-table-column align="center" label="单位" prop="goodsMaterialUnit" min-width="120">
+            <template slot-scope="scope">
+              {{scope.row.goodsMaterialUnit | unitFilter}}
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="采购数量" prop="num" min-width="120"></el-table-column>
+          <el-table-column align="center" label="内机数量" prop="insideNum" min-width="120"></el-table-column>
+          <el-table-column align="center" label="外机数量" prop="outNum" min-width="120"></el-table-column>
+          <el-table-column align="center" label="配件数量" prop="partNum" min-width="120"></el-table-column>
+          <el-table-column align="center" label="单价" prop="price" min-width="120"></el-table-column>
+          <el-table-column align="center" label="金额" min-width="120">
+            <template slot-scope="scope">
+              {{scope.row.num * scope.row.price}}
+            </template>
+          </el-table-column>
+          <el-table-column align="center" label="库存数量" prop="goodsMaterialStock" min-width="120"></el-table-column>
+        </el-table>
+
+        <div v-if="activeKey == 'examine'">
+          <div style="font-weight: 500; margin-top: 20px;">审批信息</div>
+          <el-divider></el-divider>
+
+          <el-form ref="examineForm" :model="examineFormData" :rules="examineFormRules" label-position="left" label-width="90px">
+            <el-form-item label="审批结果" prop="status">
+              <el-radio-group v-model="examineFormData.status">
+                <el-radio label="OK">审批通过</el-radio>
+                <el-radio label="FAIL">审批驳回</el-radio>
+              </el-radio-group>
+            </el-form-item>
+            <el-form-item label="审批备注" prop="remark">
+              <el-input type="textarea" v-model="examineFormData.remark" autocomplete="off" placeholder="请输入备注"></el-input>
+            </el-form-item>
+          </el-form>
+        </div>
+
+				<div slot="footer" class="dialog-footer" style="margin-top: 20px;">
+				  <el-button size="mini" @click="data.removeTab()">关 闭</el-button>
+				  <el-button size="mini" @click="detailConfirm(data.removeTab)" type="primary" v-if="activeKey == 'examine'">确 定</el-button>
+				</div>
       </div>
+
+      <el-dialog
+        title="提示"
+        :visible.sync="showCodeDialog"
+        :close-on-click-modal="false"
+        :show-close="false"
+        width="30%">
+        <div class="code-dialog">
+          <div class="title">请用微信扫码支付</div>
+          <div
+            ref="payQRCode"
+            style="display: flex; justify-content: center;"
+          />
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="showCodeDialog = false; data.removeTab();">关 闭</el-button>
+        </span>
+      </el-dialog>
+
 		</template>
 	</zj-tab-page>
 </template>
@@ -250,10 +375,11 @@ import { lbsAmapRegion } from '@/api/common.js'
 import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import { getOfflineOrderList, offlineOrderListExport, offlineOrderSave, getOfflineOrderDetail } from "@/api/order";
+import { getOfflineOrderList, offlineOrderListExport, offlineOrderSave, getOfflineOrderDetail, offlineOrderExamine } from "@/api/order";
 import { getGoodsSpecList } from '@/api/goods'
 import operation_mixin from '@/components/template/operation_mixin.js'
 import geographicalPosi from '@/components/geographicalPosi/index.vue'
+import QRCode from "qrcodejs2";
 export default {
   components: { TemplatePage, geographicalPosi },
   mixins: [import_mixin,operation_mixin],
@@ -264,6 +390,22 @@ export default {
         I: '单个'
       }
       return MAP[val];
+    },
+    payTypeFilter(val) {
+      const MAP = {
+        WECHAT: '微信支付',
+        CASH: '现金支付',
+        TRANSFER: '转账支付',
+      }
+      return MAP[val];
+    },
+    examineStatusFilter(val) {
+      const MAP = {
+        WAIT: '待审批',
+        OK: '审批通过',
+        FAIL: '审批驳回',
+      }
+      return MAP[val];
     }
   },
   data() {
@@ -323,6 +465,16 @@ export default {
       goodsSpecList: [],
 
       detailData: {},
+      examineFormData: {
+        status: '',
+        remark: '',
+      },
+      examineFormRules: {
+        status: [{ required: true, message: '请选择审批结果', trigger: 'change' }],
+        remark: [{ required: true, message: '请输入审批备注', trigger: 'blur' }],
+      },
+
+      showCodeDialog: false,
     }
   },
   computed: {
@@ -407,9 +559,9 @@ export default {
           }
         },
         examine: {
-          // conditions: ({ row, index, column }) => {
-          //   return row.orderStatus === 'OVER' && ~["EXCEPTION", "ING"].indexOf(row.status)
-          // },
+          conditions: ({ row, index, column }) => {
+            return row.examineStatus === 'WAIT'
+          },
           btnType: 'text',
           click: ({ row, index, column }) => {
             this.openDetail('examine', row.orderId)
@@ -453,15 +605,27 @@ export default {
     formCancel() {
       this.formVisible = false
       this.$refs?.formRef?.resetFields()
+      this.formData.fileUrl = '';
+      this.goodsList = [];
       this.$data.formRef = this.$options.data().formRef
     },
     formConfirm(cancel) {
       this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
         if (valid) {
           offlineOrderSave({...this.formData, orderDetails: this.goodsList}).then(res => {
-            this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
-            cancel('list')
-            this.$refs.pageRef.refreshList()
+            offlineOrderExamine({
+              orderId: res.data,
+              examineStatus: 'OK',
+              examineRemark: '',
+            }).then(examineRes => {
+              if(this.formData.payType == 'WECHAT' && examineRes.data.codeUrl) {
+                this.creatCode(examineRes.data.codeUrl);
+              }else {
+                this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
+                cancel('list')
+                this.$refs.pageRef.refreshList()
+              }
+            })
           })
         }
       })
@@ -497,16 +661,24 @@ export default {
     },
     detailCancel() {
       this.formVisible = false
-      this.$refs?.formRef?.resetFields()
-      this.$data.formRef = this.$options.data().formRef
+      this.$refs?.examineForm?.resetFields()
+      this.$data.examineForm = this.$options.data().examineForm
     },
     detailConfirm(cancel) {
-      this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
+      this.$refs.examineForm.validate((valid, invalidFields, errLabels) => {
         if (valid) {
-          offlineOrderSave({...this.formData, orderDetails: this.goodsList}).then(res => {
-            this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
-            cancel('list')
-            this.$refs.pageRef.refreshList()
+          offlineOrderExamine({
+            orderId: this.detailData.orderId,
+            examineStatus: this.examineFormData.status,
+            examineRemark: this.examineFormData.remark,
+          }).then(res => {
+            if(this.examineFormData.status == 'OK' && res.data.codeUrl) {
+              this.creatCode(res.data.codeUrl);
+            }else {
+              this.$message({ type: 'success', message: `审批成功!` })
+              cancel('list')
+              this.$refs.pageRef.refreshList()
+            }
           })
         }
       })
@@ -611,7 +783,7 @@ export default {
       getGoodsSpecList({
         pageNum: 1,
         pageSize: -1,
-        specsName: '10'
+        specsName: ''
       }).then(res => {
         this.goodsSpecList = res.data.records;
       })
@@ -652,6 +824,8 @@ export default {
     changeSpec(index, row) {
       let item = this.goodsSpecList.find(o => o.id == row.goodsMaterialId);
       this.goodsList[index].goodsMaterialId = item.id;
+      this.goodsList[index].brandId = item.brandId;
+      this.goodsList[index].brandName = item.brandName;
       this.goodsList[index].mainId = item.mainId;
       this.goodsList[index].mainName = item.mainName;
       this.goodsList[index].smallId = item.smallId;
@@ -662,11 +836,42 @@ export default {
       this.goodsList[index].stockQty = item.stockQty;
     },
 
+    creatCode(data) {
+      this.showCodeDialog = true;
+      this.$nextTick(() => {
+        this.$refs.payQRCode.innerHTML = '';
+        new QRCode(this.$refs.payQRCode, {
+          text: data,
+          width: 200,
+          height: 200,
+          colorDark: "#333333", // 二维码颜色
+          colorLight: "#ffffff", // 二维码背景色
+          correctLevel: QRCode.CorrectLevel.L // 容错率,L/M/H
+        })
+      })
+    }
+
   }
 }
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.code-dialog {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  .title {
+    font-size: 18px;
+    font-weight: 500;
+    margin-bottom: 20px;
+  }
+  img {
+    width: 200px;
+    height: 200px;
+    margin-top: 20px;
+  }
+}
+</style>
 
 <style lang="scss">
 .specTable .el-table__cell {

+ 2 - 2
src/views/mallManagement/order/order_list/index.vue

@@ -1132,8 +1132,8 @@ export default {
 						num += Number(item.num)
 						html += `
               <tr align="center">
-              <td>${item.goodsName}</td>
-              <td>${item.goodsSpecName}</td>
+              <td>${item.goodsName || ''}</td>
+              <td>${item.goodsSpecName || ''}</td>
               <td>${item.goodsMaterialUnit || ''}</td>
               <td>${item.num}</td>
               <td>${item.price}</td>