Преглед на файлове

add 手动发单物品来源

Funny преди 3 години
родител
ревизия
93a8b9e05b
променени са 2 файла, в които са добавени 83 реда и са изтрити 43 реда
  1. 4 0
      src/api/order.js
  2. 79 43
      src/components/manualCreate.vue

+ 4 - 0
src/api/order.js

@@ -115,4 +115,8 @@ export const getAddressList = (params) => {
 // 获取usb自动打印内容
 export const getPrintOrderInfos = (params) => {
   return get('app/order/printOrderInfos', params);
+}
+// 获取物品来源
+export const getResource = (params) => {
+  return get('app/waimai/resource', params);
 }

+ 79 - 43
src/components/manualCreate.vue

@@ -72,9 +72,10 @@
             </el-radio-group>
           </el-form-item>
           <el-form-item label="物品来源" required>
-            <el-select size="small" class="item1" v-model="currentGoodsSource" placeholder="请选择物品来源">
-              <el-option v-for="(v,i) in goodsSource" :key="i" :label="v.name" :value="v.id"></el-option>
+            <el-select size="small" class="item1" v-model="form.platformType" placeholder="请选择物品来源">
+              <el-option v-for="(v,i) in goodsSource" :key="i" :label="v.name" :value="v.type"></el-option>
             </el-select>
+            <el-input v-if="form.platformType" type="number" class="item2" v-model="form.daySeq" size="small" placeholder="请输入订单流水号"></el-input>
           </el-form-item>
           <el-form-item label="物品重量" required>
             <div class="printer-num">
@@ -157,32 +158,43 @@ import orderMap from "./orderComponents/orderAMap.vue";
 import addressManagement from "./addressManagement.vue";
 import { getProductList } from "../api/shop.js";
 import { getConfig } from "../api/setting.js";
-import { sendValuation, saveOrder, getAddressList } from "../api/order.js";
+import {
+  sendValuation,
+  saveOrder,
+  getAddressList,
+  getResource,
+} from "../api/order.js";
 import sendOrderPopup from "../components/orderComponents/sendOrderPopup.vue";
 export default {
   name: "manualCreate",
-  data () {
+  data() {
     return {
-      currentGoodsSource: '0',
-      goodsSource: [{
-        id: '0',
-        name: '猎豹'
-      }, {
-        id: '1',
-        name: '美团'
-      }, {
-        id: '2',
-        name: '饿了么'
-      }, {
-        id: '3',
-        name: '饿百零售'
-      }, {
-        id: '4',
-        name: '京东到家'
-      }, {
-        id: '5',
-        name: '心动外卖'
-      }],
+      goodsSource: [
+        {
+          id: "0",
+          name: "猎豹",
+        },
+        {
+          id: "1",
+          name: "美团",
+        },
+        {
+          id: "2",
+          name: "饿了么",
+        },
+        {
+          id: "3",
+          name: "饿百零售",
+        },
+        {
+          id: "4",
+          name: "京东到家",
+        },
+        {
+          id: "5",
+          name: "心动外卖",
+        },
+      ],
       products: [],
       addressType: 1,
       name: "",
@@ -223,6 +235,8 @@ export default {
         invoiceTitle: "",
         taxpayerId: "",
         transport: "0",
+        platformType: 0,
+				daySeq: ''
       },
       chooseMapAddress: 1, // 1 发件选择地址2 收件选择地址
       showChooseShop: false,
@@ -235,7 +249,7 @@ export default {
       curIdx: 0,
       isLoading: false,
       pickerOptions: {
-        disabledDate (time) {
+        disabledDate(time) {
           return (
             time.getTime() > Date.now() + 3600 * 1000 * 24 ||
             time.getTime() < Date.now() - 3600 * 1000 * 24
@@ -258,7 +272,7 @@ export default {
   // 监控data中的数据变化
   watch: {
     "$store.state.userInfo": {
-      handler (newVal, oldVal) {
+      handler(newVal, oldVal) {
         this.sendType = newVal.memberType === 1 ? 0 : 1;
         this.memberType = newVal.memberType;
         this.form.type = newVal.memberType === 1 ? 1 : 2;
@@ -267,7 +281,7 @@ export default {
       deep: true,
     },
     sendType: {
-      handler (newVal, oldVal) {
+      handler(newVal, oldVal) {
         this.searchKey = "";
         Object.keys(this.form.sendAddress).map((v) => {
           this.form.sendAddress[v] = "";
@@ -285,22 +299,37 @@ export default {
     },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created () {
+  created() {
     this.getProductList();
     this.getData();
+    this.getResource();
   },
   // 方法集合
   methods: {
-    closeAddress () {
+    getResource() {
+      getResource().then((res) => {
+        console.log("物品来源:", res);
+        if (res.code === 200) {
+          this.goodsSource = res.data;
+          this.form.platformType = this.goodsSource[0].type;
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
+    },
+    closeAddress() {
       this.getData();
     },
-    seachEnterFun (e) {
+    seachEnterFun(e) {
       var keyCode = window.event ? e.keyCode : e.which;
       if (keyCode == 13) {
         this.getData();
       }
     },
-    chooseTime (time) {
+    chooseTime(time) {
       let min = this.min; // 多少分钟后发起配送
       let now = new Date().getTime();
       let inputTime = new Date(time).getTime();
@@ -314,7 +343,7 @@ export default {
         this.form.takeTime = this.$tool.getFormatDate(inputTime);
       }
     },
-    chooseShop () {
+    chooseShop() {
       this.showChooseShop = false;
       let sendAddress = this.addressList[this.curIdx];
       if (this.addressType === 1) {
@@ -331,14 +360,14 @@ export default {
         this.personalReceiptAddressId = sendAddress.id;
       }
     },
-    showShop (addressType) {
+    showShop(addressType) {
       // 1门店地址发单选择门店 2是个人地址发单选择常用地址 3是收件地址选择常用地址
       this.addressType = addressType;
       this.searchKey = "";
       this.getData();
       this.showChooseShop = true;
     },
-    getData () {
+    getData() {
       this.loading = true;
       getAddressList({
         searchKey: this.searchKey,
@@ -406,7 +435,7 @@ export default {
         }
       });
     },
-    getProductList () {
+    getProductList() {
       getProductList().then((res) => {
         if (res.code === 200) {
           this.products = res.data;
@@ -420,7 +449,7 @@ export default {
       });
     },
 
-    onSubmit () {
+    onSubmit() {
       // 去除电话中的空格
       this.form.sendAddress.phone = this.form.sendAddress.phone.replace(
         /\s/g,
@@ -567,7 +596,7 @@ export default {
         this.sendValuation();
       }
     },
-    saveOrder () {
+    saveOrder() {
       saveOrder(this.form).then((res) => {
         if (res.code === 200) {
           this.$message({
@@ -587,7 +616,7 @@ export default {
       });
     },
     // 计价
-    sendValuation () {
+    sendValuation() {
       this.isLoading = true;
       sendValuation(this.form).then((res) => {
         this.isLoading = false;
@@ -608,13 +637,13 @@ export default {
         }
       });
     },
-    showMap (type) {
+    showMap(type) {
       this.searchKey = "";
       this.chooseMapAddress = type;
       if (this.sendType === 1 && this.chooseMapAddress === 1) return;
       this.$refs.orderMap.chooseLocation();
     },
-    getAddressDetail (v, lng, lat) {
+    getAddressDetail(v, lng, lat) {
       let type = "sendAddress";
       if (this.chooseMapAddress === 1) {
         type = "sendAddress";
@@ -629,13 +658,13 @@ export default {
       this.form[type].lng = lng;
       this.form[type].lat = lat;
     },
-    reduce () {
+    reduce() {
       this.form.weight = this.form.weight === 1 ? 1 : --this.form.weight;
     },
-    add () {
+    add() {
       this.form.weight = ++this.form.weight;
     },
-    focus () {
+    focus() {
       this.$nextTick(() => {
         document
           .getElementsByClassName("el-button--text")[0]
@@ -701,6 +730,13 @@ export default {
       .phone-after {
         width: 70px;
       }
+      .item1 {
+        width: 190px;
+      }
+      .item2 {
+        margin-left: 20px;
+        width: 50%;
+      }
       .map {
         height: 25px;
         width: 25px;