Kaynağa Gözat

更新订单物流

reghao 1 yıl önce
ebeveyn
işleme
3b8e314c84
2 değiştirilmiş dosya ile 138 ekleme ve 18 silme
  1. 10 1
      src/api/mall.js
  2. 128 17
      src/views/mall/Order.vue

+ 10 - 1
src/api/mall.js

@@ -9,7 +9,8 @@ const mallApi = {
   payOrderApi: '/api/mall/pay/order',
   payWalletApi: '/api/mall/pay',
   deliveryApi: '/api/mall/delivery',
-  logisticsApi: '/api/mall/logistics',
+  logisticsApi: '/api/mall/logistics/order',
+  logisticsProgressApi: '/api/mall/logistics/progress',
   walletApi: '/api/user/wallet',
   chargeWalletApi: '/api/user/wallet/charge',
   walletBillApi: '/api/user/wallet/bill'
@@ -86,3 +87,11 @@ export function getUserDelivery() {
 export function getOrderLogistics(orderId) {
   return get(mallApi.logisticsApi + '/' + orderId)
 }
+
+export function putOrderLogistics(payload) {
+  return post(mallApi.logisticsApi, payload)
+}
+
+export function putLogisticsProgress(payload) {
+  return post(mallApi.logisticsProgressApi, payload)
+}

+ 128 - 17
src/views/mall/Order.vue

@@ -47,21 +47,32 @@
             label="操作"
           >
             <template slot-scope="scope">
-              <el-button
-                size="mini"
-                @click="getDetail(scope.row)"
-              >详情</el-button>
-              <el-button
-                size="mini"
-                type="warning"
-                @click="handleStatus(scope.row)"
-              >
-                {{ scope.row.statusText }}
-              </el-button>
-              <el-button
-                size="mini"
-                @click="deleteOrder(scope.row)"
-              >删除</el-button>
+              <el-row>
+                <el-button
+                  size="mini"
+                  @click="getDetail(scope.row)"
+                >详情</el-button>
+                <el-button
+                  size="mini"
+                  @click="handleStatus(scope.row)"
+                >
+                  {{ scope.row.statusText }}
+                </el-button>
+                <el-button
+                  size="mini"
+                  @click="deleteOrder(scope.row)"
+                >删除</el-button>
+              </el-row>
+              <el-row>
+                <el-button
+                  size="mini"
+                  @click="handleLogistics(scope.row)"
+                >发货</el-button>
+                <el-button
+                  size="mini"
+                  @click="handleProgress(scope.row)"
+                >进度</el-button>
+              </el-row>
             </template>
           </el-table-column>
         </el-table>
@@ -105,11 +116,63 @@
         </el-timeline-item>
       </el-timeline>
     </el-dialog>
+
+    <el-dialog
+      title="订单发货"
+      append-to-body
+      :visible.sync="orderLogisticsDialog"
+      width="30%"
+      center
+    >
+      <el-form :model="orderLogisticsForm">
+        <el-form-item label="物流" label-width="120px" prop="tpl">
+          <el-select v-model="logisticsProgressForm.tpl">
+            <el-option value="顺丰" label="顺丰" />
+            <el-option value="中通" label="中通" />
+            <el-option value="韵达" label="韵达" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="物流订单号" label-width="120px">
+          <el-input
+            v-model="orderLogisticsForm.logisticsId"
+            style="margin-left: 5px"
+          />
+        </el-form-item>
+        <el-button style="float: right; padding: 10px" type="text" @click="submitLogistics">发货</el-button>
+      </el-form>
+    </el-dialog>
+
+    <el-dialog
+      title="物流进度"
+      append-to-body
+      :visible.sync="logisticsProgressDialog"
+      width="30%"
+      center
+    >
+      <el-form :model="logisticsProgressForm">
+        <el-form-item label="状态" label-width="120px" prop="subjectId">
+          <el-select v-model="logisticsProgressForm.status">
+            <el-option value="3" label="运输中" />
+            <el-option value="4" label="派送中" />
+            <el-option value="5" label="待取件" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="详情" label-width="120px">
+          <el-input
+            v-model="logisticsProgressForm.current"
+            style="margin-left: 5px"
+            type="textarea"
+            :rows="5"
+          />
+        </el-form-item>
+        <el-button style="float: right; padding: 10px" type="text" @click="putProgress">提交进度</el-button>
+      </el-form>
+    </el-dialog>
   </el-row>
 </template>
 
 <script>
-import { getOrderLogistics, getOrders } from '@/api/mall'
+import { getOrderLogistics, getOrders, putLogisticsProgress, putOrderLogistics } from '@/api/mall'
 
 export default {
   name: 'Order',
@@ -134,7 +197,19 @@ export default {
       productId: null,
       payDialog: false,
       logisticsDialog: false,
-      logisticsList: []
+      logisticsList: [],
+      logisticsProgressDialog: false,
+      logisticsProgressForm: {
+        orderId: null,
+        status: null,
+        current: null
+      },
+      orderLogisticsDialog: false,
+      orderLogisticsForm: {
+        orderId: null,
+        tpl: null,
+        logisticsId: null
+      }
     }
   },
   created() {
@@ -200,6 +275,42 @@ export default {
       this.getData(this.searchForm)
     },
     handleChange(value) {
+    },
+    handleLogistics(row) {
+      this.orderLogisticsForm.orderId = row.orderId
+      this.orderLogisticsDialog = true
+    },
+    submitLogistics() {
+      putOrderLogistics(this.orderLogisticsForm).then(resp => {
+        if (resp.code !== 0) {
+          this.$notify.warning({
+            message: resp.msg,
+            duration: 3000
+          })
+        }
+      })
+
+      this.orderLogisticsForm.orderId = null
+      this.orderLogisticsForm.tpl = null
+      this.orderLogisticsForm.logisticsId = null
+      this.orderLogisticsDialog = false
+    },
+    handleProgress(row) {
+      this.logisticsProgressForm.orderId = row.orderId
+      this.logisticsProgressDialog = true
+    },
+    putProgress() {
+      putLogisticsProgress(this.logisticsProgressForm).then(resp => {
+        if (resp.code !== 0) {
+          this.$notify.warning({
+            message: resp.msg,
+            duration: 3000
+          })
+        }
+      })
+
+      this.logisticsProgressDialog = false
+      this.logisticsProgressForm.orderId = null
     }
   }
 }