戴艳蓉 3 lat temu
rodzic
commit
4e760988c1

+ 5 - 2
src/apis/service/mobile/order/index.js

@@ -2,10 +2,13 @@
 import http from '@/apis/axios'
 const api = 'admin/'
 export default {
- 
+
   // 查询列表
   list: (data, params) => http(api + 'orderlist', data, 'post', params),
   // 记录物流
   post: (data, params) => http(api + 'orderdelivery', data, 'post', params),
- 
+  // 获取启用物流
+  exquery: (data, params) => http(api + 'expressquery', data, 'post', params),
+  // 获取启用物流
+  orderexpress: (data, params) => http(api + 'orderexpress', data, 'post', params),
 }

+ 155 - 28
src/views/mobile/order/addEdit.vue

@@ -4,8 +4,8 @@
     :title="title"
     :center="true"
     align="left"
-    top="20vh"
-    width="700px"
+    top="10vh"
+    width="900px"
     :close-on-click-modal="false"
     :visible.sync="showModelThis"
     element-loading-text="拼命加载中"
@@ -17,38 +17,41 @@
       <el-row>
         <el-col :span="24" v-if="id && id.order_sn">
           <el-form
-            label-position="left"
-            size="mini"
+            size="small"
             inline
+            label-width="80px"
             class="demo-table-expand"
           >
             <el-col :span="12">
-              <el-form-item label="订单编号">
+              <el-form-item label="订单编号" style="margin: 0">
                 <span>{{ id.order_sn }}</span>
               </el-form-item>
             </el-col>
             <el-col :span="12">
-              <el-form-item label="订单数量">
-                <!-- {{id.unit}}/{{ id.unit_weight}}kg -->
+              <el-form-item label="订单数量" style="margin: 0">
                 <span>{{ id.order_num }}</span>
               </el-form-item>
             </el-col>
             <el-col :span="12">
-              <el-form-item label="收货人">
+              <el-form-item label="收货人" style="margin: 0">
                 <span>{{ id.contector }}</span>
               </el-form-item>
             </el-col>
             <el-col :span="12">
-              <el-form-item label="收货电话">
+              <el-form-item label="收货电话" style="margin: 0">
                 <span>{{ id.contector_mobile }}</span>
               </el-form-item>
             </el-col>
-            <el-form-item label="收货地址">
-              <span
-                >{{ id.provice_name }}{{ id.city_name }}{{ id.area_name
-                }}{{ id.addr }}</span
-              >
-            </el-form-item>
+            <el-col :span="12" v-if="isDetail !== '009'">
+              <el-form-item label="快递公司" style="margin: 0">
+                <span>{{ id.post_name }}</span>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12" v-if="isDetail !== '009'">
+              <el-form-item label="快递编号" style="margin: 0">
+                <span>{{ id.post_code }}</span>
+              </el-form-item>
+            </el-col>
           </el-form>
         </el-col>
         <el-col :span="24" v-if="isDetail === '009'">
@@ -56,21 +59,105 @@
             ref="ruleForm"
             :model="ruleForm"
             status-icon
+            size="small"
             :rules="rules"
-            label-width="110px"
+            label-width="80px"
             class="demo-ruleForm"
           >
-            <el-form-item label="物流公司" prop="post_company">
-              <el-input v-model="ruleForm.post_company" />
-            </el-form-item>
-            <el-form-item label="物流单号" prop="post_code">
-              <el-input v-model="ruleForm.post_code" />
-            </el-form-item>
+            <el-col :span="12">
+              <el-form-item label="物流公司" prop="express_code">
+                <el-select
+                  v-model="ruleForm.express_code"
+                  filterable
+                  clearable
+                  placeholder="物流公司"
+                  style="width: 100%"
+                >
+                  <el-option
+                    v-for="item in options"
+                    :key="'express_code' + item.express_code"
+                    :label="item.express_name"
+                    :value="item.express_code"
+                  />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="物流单号" prop="post_code">
+                <el-input
+                  v-model="ruleForm.post_code"
+                  placeholder="物流单号"
+                  maxlength="100"
+                />
+              </el-form-item>
+            </el-col>
           </el-form>
         </el-col>
-        <el-col :span="24" style="padding-right: 10px; text-align: right">
-          <el-button type="primary" @click="submitForm">保 存 </el-button>
+        <el-col :span="isDetail === '009' ? 20 : 24" v-if="id && id.order_sn">
+          <span
+            style="
+              width: 120px;
+              padding: 0 12px;
+              line-height: 32px;
+              height: 32px;
+              font-size: 14px;
+              color: #606266;
+              text-align: right;
+              vertical-align: middle;
+              font-weight: 700;
+              box-sizing: border-box;
+            "
+            >收货地址</span
+          >
+          <span
+            >{{ id.provice_name }}{{ id.city_name }}{{ id.area_name
+            }}{{ id.addr }}</span
+          >
         </el-col>
+        <el-col
+          :span="4"
+          style="text-align: right"
+          class="fr"
+          v-if="isDetail === '009'"
+        >
+          <el-button type="primary" size="small" @click="submitForm"
+            >保 存
+          </el-button>
+        </el-col>
+        <div
+          :span="24"
+          v-if="isDetail !== '009' && id && id.status === '2' && express"
+        >
+          <span
+            style="
+              width: 120px;
+              padding: 0 12px;
+              line-height: 32px;
+              height: 32px;
+              font-size: 14px;
+              color: #606266;
+              text-align: right;
+              vertical-align: middle;
+              font-weight: 700;
+              box-sizing: border-box;
+            "
+            >最新物流</span
+          >
+          <span>{{ express.status_cn }}</span>
+          <div v-if="express.post_content&&express.post_content.length>0" class="post_content">
+            <el-timeline style="padding:20px 0 0 0">
+              <el-timeline-item
+                v-for="(activity, index) in express.post_content"
+                :key="activity.time + index"
+                :size="'normal'"
+                :color="index === 0 ? '#1890ff' : '#e4e7ed'"
+                :timestamp="activity.time"
+              >
+                {{ activity.context }}
+              </el-timeline-item>
+            </el-timeline>
+          </div>
+        </div>
       </el-row>
     </el-card>
   </el-dialog>
@@ -98,15 +185,17 @@ export default {
       }
     };
     return {
+      options: [],
       loading: false,
       newTime: 0,
       showModelThis: this.showModel,
+      express: null,
       ruleForm: {
-        post_company: "",
+        express_code: "",
         code: "",
       },
       rules: {
-        post_company: [
+        express_code: [
           {
             required: true,
             message: "物流公司不能为空!",
@@ -148,6 +237,10 @@ export default {
         this.title = "填写物流";
       }
       await this.resetForm();
+      await this.getExquery();
+      if (this.id && this.id.status === "2") {
+        await this.getOrderexpress(this.id.order_sn);
+      }
       this.loading = false;
     },
     refreshAll() {
@@ -161,12 +254,41 @@ export default {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
           this.ruleForm = {
-            post_company: "",
+            express_code: "",
             post_code: "",
           };
         }
       });
     },
+    async getExquery() {
+      this.options = [];
+      let model = {
+        status: "1",
+        code: "",
+        express_name: "",
+      };
+      const { code, data, message } = await asyncRequest.exquery(model);
+      if (code === 0) {
+        this.options = data;
+      } else if (code >= 100 && code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(message);
+      }
+    },
+    async getOrderexpress(order_sn) {
+      this.express = null;
+      const { code, data, message } = await asyncRequest.orderexpress({
+        order_sn: order_sn,
+      });
+      if (code === 0) {
+        this.express = data;
+      } else if (code >= 100 && code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(message);
+      }
+    },
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
@@ -174,7 +296,7 @@ export default {
           const obj = JSON.parse(JSON.stringify(this.ruleForm));
           const model = {
             ordersn: this.id.order_sn,
-            post_company: obj.post_company,
+            express_code: obj.express_code,
             post_code: obj.post_code,
           };
           const res = await asyncRequest.post(model);
@@ -202,5 +324,10 @@ export default {
 
    <style lang="scss" scoped>
 .order {
+  .post_content{
+    padding: 0  0 0 20px;
+    max-height: 300px;
+    overflow-y:scroll;
+  }
 }
 </style>