Explorar o código

新增订单快递信息修改

hwb0 %!s(int64=3) %!d(string=hai) anos
pai
achega
253cafbde7

+ 18 - 0
src/api/business/order.js

@@ -55,6 +55,15 @@ export function channelOrderShip(data) {
   })
 }
 
+// 修改经销商发货信息
+export function channelOrderShipUpdate(data) {
+  return request({
+    url: '/api/v1/mp/admin/channel/order/ship/update',
+    method: 'post',
+    data
+  })
+}
+
 // 用户订单
 export function getDeliverList(urlParams, data) {
   return request({
@@ -83,6 +92,15 @@ export function deliverOrderShip(data) {
   })
 }
 
+// 用户订单发货
+export function deliverOrderShipUpdate(data) {
+  return request({
+    url: '/api/v1/mp/admin/deliver/order/ship/update',
+    method: 'post',
+    data
+  })
+}
+
 // 用户订单导出
 export function deliverOrderExport(data) {
   return request({

+ 150 - 0
src/views/order/channel/components/ExpressEdit.vue

@@ -0,0 +1,150 @@
+<template>
+  <div>
+    <el-dialog
+      title="修改快递信息"
+      :visible.sync="editShow"
+      width="500px"
+      :before-close="close"
+    >
+      <el-form
+        :model="shipForm"
+        ref="shipForm"
+        :rules="rules"
+        label-width="100px"
+      >
+        <el-form-item label="快递公司:" prop="deliveryId">
+          <el-select
+            v-model="shipForm.deliveryId"
+            placeholder="请选择快递公司"
+            clearable
+            size="small"
+            style="width: 300px"
+          >
+            <el-option
+              v-for="item in companyData"
+              :key="item.areaId"
+              :label="item.companyName"
+              :value="item.deliveryId"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="快递单号:" prop="deliveryFlowId">
+          <el-input
+            v-model="shipForm.deliveryFlowId"
+            placeholder="输入快递单号"
+            clearable
+            size="small"
+            style="width: 300px"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 按钮 -->
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" :disabled="loading" @click="saveClick"
+          >确 定</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import CustomFieldsMixin from "@/mixins/CustomFields";
+import {
+  companyList,
+  channelOrderShipUpdate,
+} from "@/api/business/order";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    // 发货弹框显示
+    editShow: {
+      type: Boolean,
+      default: false,
+    },
+    // 订单详情
+    goodsInfo: {
+      type: Object,
+      default: {},
+    },
+  },
+  data() {
+    return {
+      loading: false,
+      shipForm: {
+        deliveryId: "",
+        deliveryFlowId: "",
+      },
+      // 快递下拉列表
+      companyData: [],
+      rules: {
+        deliveryId: [
+          { required: true, message: "请选择快递公司", trigger: "change" },
+        ],
+        deliveryFlowId: [
+          { required: true, message: "请输入快递单号", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  created() {
+    this.getCompanyList();
+    this.getFormData()
+  },
+  methods: {
+    getFormData(){
+      this.shipForm.deliveryId = this.goodsInfo.deliveryId
+      this.shipForm.deliveryFlowId = this.goodsInfo.deliveryFlowId
+    },
+    // 关闭发货弹框
+    close() {
+      this.$emit("close");
+      this.loading = false;
+      this.$refs["shipForm"].resetFields();
+    },
+
+    // 快递下拉列表
+    getCompanyList() {
+      companyList({}).then((res) => {
+        this.companyData = res.data;
+      });
+    },
+
+    // 确认
+    saveClick() {
+      this.loading = true;
+      const subForm = this.$refs["shipForm"];
+      subForm.validate((valid) => {
+        if (valid) {
+          this.submitForm(this.shipForm);
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(subForm);
+          return false;
+        }
+      });
+    },
+
+    // 提交
+    submitForm(form) {
+      let data = {
+        ...form,
+        orderId: this.goodsInfo.orderId,
+      };
+      channelOrderShipUpdate(data)
+        .then((res) => {
+          if (res.code == 0) {
+            this.msgSuccess("修改成功");
+            this.close();
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
+</script>
+<style scoped>
+</style>

+ 39 - 6
src/views/order/channel/detail.vue

@@ -72,6 +72,9 @@
             <div class="title">发货时间:</div>
             <div class="txt">{{ parseTime(info.deliveryTime) || "--" }}</div>
           </div>
+          <div class="info-item-content-one" v-if="status.value === 2">
+            <div class="edit-express" @click="editExpress">修改</div>
+          </div>
         </div>
         <div class="info-item-content">
           <el-button
@@ -83,7 +86,9 @@
           >
           <div class="info-item-content-one" v-if="status.value === 2">
             <div class="title">快递公司:</div>
-            <div class="txt">{{ (delivery && delivery.companyName) || "--" }}</div>
+            <div class="txt">
+              {{ (delivery && delivery.companyName) || "--" }}
+            </div>
           </div>
           <div class="info-item-content-one" v-if="status.value === 2">
             <div class="title">快递单号:</div>
@@ -122,12 +127,17 @@
               <div>{{ $numberFormat(row.pkgSalePrice * row.orderNum) }}</div>
             </template>
           </el-table-column>
-          <el-table-column v-if="status.value === 2 || status.value === 3" label="附加信息" min-width="150">
+          <el-table-column
+            v-if="status.value === 2 || status.value === 3"
+            label="附加信息"
+            min-width="150"
+          >
             <template slot-scope="{ row }">
-              <div>序列号:
-                 <div v-for="(item, index) in row.detailList" :key="index">
-                   {{item.startSn}} 至 {{item.endSn}}
-                 </div>
+              <div>
+                序列号:
+                <div v-for="(item, index) in row.detailList" :key="index">
+                  {{ item.startSn }} 至 {{ item.endSn }}
+                </div>
               </div>
             </template>
           </el-table-column>
@@ -150,6 +160,14 @@
       :channel-list="boxData"
       @close="close"
     />
+
+    <!-- 修改快递信息 -->
+    <express-edit
+      v-if="editShow"
+      :edit-show="editShow"
+      :goods-info="info"
+      @close="close"
+    />
   </div>
 </template>
 <script>
@@ -157,10 +175,12 @@ import { orderDetail, channelList } from "@/api/business/order";
 import { publicFileGetUrl } from "@/api/common";
 import { accMul } from "@/utils/util";
 import SendGoods from "./components/SendGoods";
+import ExpressEdit from "./components/ExpressEdit";
 export default {
   name: "Detail",
   components: {
     SendGoods,
+    ExpressEdit,
   },
   data() {
     return {
@@ -178,6 +198,8 @@ export default {
       goodsShow: false,
       // 盲票组列表
       boxData: [],
+      // 修改快递信息弹框
+      editShow: false,
     };
   },
   created() {
@@ -225,8 +247,14 @@ export default {
     // 发货弹框关闭
     close() {
       this.goodsShow = false;
+      this.editShow = false;
       this.getDetail();
     },
+
+    // 修改快递信息
+    editExpress() {
+      this.editShow = true;
+    },
   },
 };
 </script>
@@ -251,6 +279,11 @@ export default {
           width: 100px;
         }
 
+        .edit-express {
+          color: #409eff;
+          cursor: pointer;
+        }
+
         .txt {
           width: 200px;
         }

+ 156 - 0
src/views/order/deliver/components/ExpressEdit.vue

@@ -0,0 +1,156 @@
+<template>
+  <div>
+    <el-dialog
+      title="修改快递信息"
+      :visible.sync="editShow"
+      width="500px"
+      :before-close="close"
+    >
+      <el-form
+        :model="shipForm"
+        ref="shipForm"
+        :rules="rules"
+        label-width="100px"
+      >
+        <el-form-item label="快递公司:" prop="deliveryId">
+          <el-select
+            v-model="shipForm.deliveryId"
+            placeholder="请选择快递公司"
+            clearable
+            size="small"
+            style="width: 300px"
+          >
+            <el-option
+              v-for="item in companyData"
+              :key="item.areaId"
+              :label="item.companyName"
+              :value="item.deliveryId"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="快递单号:" prop="deliveryFlowId">
+          <el-input
+            v-model="shipForm.deliveryFlowId"
+            placeholder="输入快递单号"
+            clearable
+            size="small"
+            style="width: 300px"
+          />
+        </el-form-item>
+      </el-form>
+      <!-- 按钮 -->
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="close">取 消</el-button>
+        <el-button type="primary" :disabled="loading" @click="saveClick"
+          >确 定</el-button
+        >
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import CustomFieldsMixin from "@/mixins/CustomFields";
+import {
+  companyList,
+  deliverOrderShipUpdate,
+} from "@/api/business/order";
+export default {
+  mixins: [CustomFieldsMixin],
+  props: {
+    // 发货弹框显示
+    editShow: {
+      type: Boolean,
+      default: false,
+    },
+    // 订单详情
+    goodsInfo: {
+      type: Object,
+      default: {},
+    },
+    // 订单ID
+    orderId: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      shipForm: {
+        deliveryId: "",
+        deliveryFlowId: "",
+      },
+      // 快递下拉列表
+      companyData: [],
+      rules: {
+        deliveryId: [
+          { required: true, message: "请选择快递公司", trigger: "change" },
+        ],
+        deliveryFlowId: [
+          { required: true, message: "请输入快递单号", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  created() {
+    this.getCompanyList();
+    this.getFormData()
+  },
+  methods: {
+    getFormData(){
+      this.shipForm.deliveryId = this.goodsInfo.deliveryId
+      this.shipForm.deliveryFlowId = this.goodsInfo.deliveryFlowId
+    },
+    // 关闭发货弹框
+    close() {
+      this.$emit("close");
+      this.loading = false;
+      this.$refs["shipForm"].resetFields();
+    },
+
+    // 快递下拉列表
+    getCompanyList() {
+      companyList({}).then((res) => {
+        this.companyData = res.data;
+      });
+    },
+
+    // 确认
+    saveClick() {
+      this.loading = true;
+      const subForm = this.$refs["shipForm"];
+      subForm.validate((valid) => {
+        if (valid) {
+          this.submitForm(this.shipForm);
+        } else {
+          this.loading = false;
+          // 提示第一个error
+          this.getFormErrorMessage(subForm);
+          return false;
+        }
+      });
+    },
+
+    // 提交
+    submitForm(form) {
+      let data = {
+        ...form,
+        orderId: this.orderId,
+        itemIds: this.goodsInfo.items.map( item => item.itemId)
+      };
+      deliverOrderShipUpdate(data)
+        .then((res) => {
+          if (res.code == 0) {
+            this.msgSuccess("修改成功");
+            this.close();
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+        });
+    },
+  },
+};
+</script>
+<style scoped>
+</style>

+ 29 - 0
src/views/order/deliver/detail.vue

@@ -99,6 +99,9 @@
               <div class="tit">发货时间:</div>
               <div class="txt">{{ parseTime(item.deliveryTime) || "--" }}</div>
             </div>
+            <div class="info-one">
+              <div class="edit-express" @click="editExpress(item)">修改</div>
+            </div>
           </div>
           <div class="goods">
             <div class="goods-item" v-for="(ele, ins) in item.items" :key="ins">
@@ -158,16 +161,27 @@
 
     <!-- 发货 -->
     <send-goods :send-show="goodsShow" :goods-info="info" @close="close" />
+
+    <!-- 修改快递信息 -->
+    <express-edit
+      v-if="editShow"
+      :edit-show="editShow"
+      :goods-info="expressInfo"
+      :order-id="info.orderId"
+      @close="close"
+    />
   </div>
 </template>
 <script>
 import { deliverDetail } from "@/api/business/order";
 import { publicFileGetUrl } from "@/api/common";
 import SendGoods from "./components/SendGoods";
+import ExpressEdit from "./components/ExpressEdit";
 export default {
   name: "UserDetail",
   components: {
     SendGoods,
+    ExpressEdit,
   },
   data() {
     return {
@@ -183,6 +197,10 @@ export default {
       deliverList: [],
       // 发货显示
       goodsShow: false,
+      // 修改快递信息弹框
+      editShow: false,
+      // 快递信息
+      expressInfo: {}
     };
   },
   created() {
@@ -229,8 +247,15 @@ export default {
     // 发货关闭
     close() {
       this.goodsShow = false;
+      this.editShow = false;
       this.getDetail();
     },
+
+    // 修改快递信息
+    editExpress(item) {
+      this.expressInfo = item
+      this.editShow = true;
+    },
   },
 };
 </script>
@@ -280,6 +305,10 @@ export default {
         .txt {
           width: 200px;
         }
+        .edit-express{
+          color: #409eff;
+          cursor: pointer;
+        }
       }
       .goods {
         margin: 10px 0;