Funny 3 vuotta sitten
vanhempi
commit
07d65d63f2
2 muutettua tiedostoa jossa 49 lisäystä ja 37 poistoa
  1. 38 21
      src/components/manualCreate.vue
  2. 11 16
      src/components/orderComponents/orderList.vue

+ 38 - 21
src/components/manualCreate.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="form-wrap" v-loading="isLoading" element-loading-text="正在计算中...">
-    <el-form label-position="left" ref="form" :model="form" label-width="100px">
+    <el-form label-position="left" ref="form" :model="form" label-width="110px">
       <div class="moudle-list">
         <div class="moudle">
           <div class="title-list">
@@ -13,13 +13,13 @@
           </div>
 
           <el-form-item :label="sendType ? '发件门店' : '发件人姓名'" required>
-            <el-input v-show="!sendType" size="small" class="input" v-model="form.sendAddress.contact" placeholder="请填写发件人姓名"></el-input>
+            <el-input v-show="!sendType" size="small" class="input" v-model="form.sendAddress.contact" placeholder="请填写发件人姓名" clearable></el-input>
             <el-input v-show="sendType" disabled size="small" class="input" v-model="form.sendAddress.name" placeholder="请填写发件门店"></el-input>
             <el-button v-show="sendType" @click="showShop(1)" class="but1 active" type="info">选择门店</el-button>
             <el-button v-show="!sendType" @click="showShop(1)" class="but1 active" type="info">常用地址</el-button>
           </el-form-item>
           <el-form-item label="发件人电话" required>
-            <el-input size="small" class="phone-before" v-model="form.sendAddress.phone" placeholder="请填写发件人电话"></el-input>
+            <el-input size="small" class="phone-before" v-model="form.sendAddress.phone" placeholder="请填写发件人电话" clearable></el-input>
             <div class="phone-center">~</div>
             <el-input size="small" class="phone-after" v-model="form.sendAddress.extension" placeholder="分机号"></el-input>
           </el-form-item>
@@ -29,7 +29,7 @@
             </el-input>
           </el-form-item>
           <el-form-item label="楼号/门牌号">
-            <el-input size="small" v-model="form.sendAddress.street" placeholder="请填写发件人楼号/门牌号" :disabled="!!sendType">
+            <el-input size="small" v-model="form.sendAddress.street" placeholder="请填写发件人楼号/门牌号" :disabled="!!sendType" clearable>
             </el-input>
           </el-form-item>
         </div>
@@ -38,22 +38,22 @@
             收件地址
           </div>
           <el-form-item label="收件人姓名" required>
-            <el-input size="small" v-model="form.receiptAddress.contact" placeholder="请填写收件人姓名">
+            <el-input size="small" v-model="form.receiptAddress.contact" placeholder="请填写收件人姓名" clearable>
             </el-input>
             <el-button @click="showShop(2)" class="but1 active" type="info">常用地址</el-button>
           </el-form-item>
           <el-form-item label="收件人电话" required>
-            <el-input size="small" class="phone-before" v-model="form.receiptAddress.phone" placeholder="请填写收件人电话"></el-input>
+            <el-input size="small" class="phone-before" v-model="form.receiptAddress.phone" placeholder="请填写收件人电话" clearable></el-input>
             <div class="phone-center">~</div>
             <el-input size="small" class="phone-after" v-model="form.receiptAddress.extension" placeholder="分机号"></el-input>
           </el-form-item>
           <el-form-item label="收件人地址" required>
-            <el-input size="small" v-model="form.receiptAddress.address" placeholder="请填写/选择收件人地址">
+            <el-input size="small" v-model="form.receiptAddress.address" placeholder="请填写/选择收件人地址" disabled>
               <el-image @click="showMap(2)" slot="append" class="map" src="../../static/image/icon_map.png"></el-image>
             </el-input>
           </el-form-item>
           <el-form-item label="楼号/门牌号">
-            <el-input size="small" v-model="form.receiptAddress.street" placeholder="请填写收件人楼号/门牌号">
+            <el-input size="small" v-model="form.receiptAddress.street" placeholder="请填写收件人楼号/门牌号" clearable>
             </el-input>
           </el-form-item>
         </div>
@@ -74,15 +74,16 @@
           <el-form-item label="物品重量" required>
             <div class="printer-num">
               <img @click="reduce()" src="../../static/image/icon_reduce.png" class="reduce" alt="" srcset="" />
-              <!-- <div class="num">{{ form.weight }} KG</div> -->
-              <el-input size="small" class="num" v-model="form.weight">
+              <el-input type="number" size="small" class="num" v-model="form.weight" clearable>
                 <template slot="append">KG</template>
               </el-input>
               <img @click="add()" src="../../static/image/icon_add.png" class="add" alt="" srcset="" />
             </div>
+            <!-- <el-input-number size="small" v-model="form.weight" :min="1" :max="10" label="描述文字">
+            </el-input-number> -->
           </el-form-item>
           <el-form-item label="物品价值" required>
-            <el-input size="small" v-model="form.productAmount" placeholder="请输入物品价值!">
+            <el-input size="small" type="number" v-model="form.productAmount" placeholder="请输入物品价值!" clearable>
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
@@ -93,7 +94,7 @@
             </el-date-picker>
           </el-form-item>
           <el-form-item label="发单备注">
-            <el-input type="textarea" size="small" v-model="form.takeRemark" maxlength="20" placeholder="请添加备注信息,最多输入20个字!">
+            <el-input type="text" size="small" v-model="form.takeRemark" maxlength="20" placeholder="请添加备注信息,最多输入20个字!" clearable show-word-limit>
             </el-input>
           </el-form-item>
         </div>
@@ -102,11 +103,11 @@
             发票信息
           </div>
           <el-form-item label="发票抬头">
-            <el-input size="small" v-model="form.invoiceTitle">
+            <el-input size="small" v-model="form.invoiceTitle" placeholder="请输入发票抬头!" clearable>
             </el-input>
           </el-form-item>
           <el-form-item label="发票税号">
-            <el-input size="small" v-model="form.taxpayerId">
+            <el-input size="small" v-model="form.taxpayerId" placeholder="请输入发票税号!" clearable>
             </el-input>
           </el-form-item>
 
@@ -114,12 +115,12 @@
       </div>
 
       <!-- 选择门店 -->
-      <el-dialog v-loading="loading" element-loading-text="拼命加载中" title="选择门店" :visible.sync="showChooseShop" width="600px" center>
+      <el-dialog v-loading="loading" element-loading-text="拼命加载中" :title="sendType === 1 ? '选择门店' : '常用地址'" :visible.sync="showChooseShop" width="600px" center>
         <el-input placeholder="请输入姓名/手机号/地址" v-model="searchKey" clearable>
           <el-button size="medium" type="primary" @click.stop="getData" slot="append" icon="el-icon-search"></el-button>
         </el-input>
         <div class="shop-list">
-          <div @click="curIdx = index" :class=" curIdx === index ? 'shop-item active' : 'shop-item'" v-for="(shop,index) in addressList" :key="index">
+          <div @dblclick="chooseShop" @click="curIdx = index" :class=" curIdx === index ? 'shop-item active' : 'shop-item'" v-for="(shop,index) in addressList" :key="index">
             <div class="name">{{shop.name}}</div>
             <div class="phone">{{shop.contact + ' ' + shop.phone}}</div>
             <div class="address">{{shop.districtName + shop.address}}</div>
@@ -155,6 +156,7 @@ export default {
         name: "",
         sendAddress: {
           name: "",
+          id: "",
           address: "",
           cityCode: "",
           cityName: "",
@@ -182,7 +184,7 @@ export default {
         isWaimai: false,
         createType: 1,
         shopId: this.$store.state.userInfo.shopId,
-        productAmount: "",
+        productAmount: 50,
         chooseAddressType: 1,
       },
       showChooseShop: false,
@@ -241,6 +243,9 @@ export default {
   activated() {},
   // 方法集合
   methods: {
+    dbChoose(){
+      console.log('进来了',this.curIdx);
+    },
     chooseTime(time) {
       let min = 15; // 多少分钟后发起配送
       let now = new Date().getTime();
@@ -333,6 +338,7 @@ export default {
 
     onSubmit() {
       // 个人发件
+
       if (!this.sendType) {
         if (
           !this.form.sendAddress.contact.trim() ||
@@ -355,12 +361,24 @@ export default {
           message: "请先完善收件地址信息!",
         });
       }
-      if (!this.form.productAmount.trim()) {
+      let reg = new RegExp(/^([1-4][0-9]{0,1}|50)$/);
+      if (!reg.test(Number(this.form.weight))) {
         return this.$message({
           type: "error",
-          message: "请先输入物品价值!",
+          message: "物品重量为整数且不得超过50KG!",
         });
       }
+      let reg1 = new RegExp(/(^[1-9]{1}[0-9]*$)|(^[0-9]*\.[0-9]{2}$)/);
+      if (
+        !reg1.test(Number(this.form.productAmount)) ||
+        Number(this.form.productAmount) > 20000
+      ) {
+        return this.$message({
+          type: "error",
+          message: "物品价值大于0最多保留2位小数且不得超过20000元!",
+        });
+      }
+
       // 预约发单
       if (this.form.takeType) {
         if (!this.form.takeTime.trim()) {
@@ -416,8 +434,8 @@ export default {
     },
     showMap(type) {
       this.searchKey = "";
-      if (this.sendType === 1) return;
       this.chooseAddressType = type;
+      if (this.sendType === 1 && this.chooseAddressType === 1) return;
       this.$refs.orderMap.chooseLocation();
     },
     getAddressDetail(v, lng, lat) {
@@ -515,7 +533,6 @@ export default {
   /deep/ .el-form {
     display: flex;
     flex-wrap: wrap;
-    // width: 600px;
   }
   /deep/ .el-form-item__label {
     color: #b1b1b1;

+ 11 - 16
src/components/orderComponents/orderList.vue

@@ -21,7 +21,7 @@
               <el-button size="small" @click.native="itemAddRemark(list[curIdx].id, list[curIdx])" class="btn_bots">添加备注</el-button>
               <el-button size="small" @click.native="iGnoreOrder(list[curIdx].id)" class="btn_bots">忽略订单</el-button>
               <el-button size="small" @click.native="orderPrinter(list[curIdx].waimaiOrderId)" class="btn_bots">补打发票</el-button>
-              <el-button size="small" @click.native="deleteItem(list[curIdx])" class="btn_bots btn">发起配送</el-button>
+              <el-button size="small" @click.native="sendNow(list[curIdx])" class="btn_bots btn">发起配送</el-button>
             </div>
             <!-- 预约单 -->
             <div class="btns" v-if="buttonStatus === 10">
@@ -35,10 +35,12 @@
                 </el-dropdown>
               </div>
               <el-button size="small" @click.native="itemAddRemark(list[curIdx].id, list[curIdx])" class="btn_bots">添加备注</el-button>
-              <el-button size="small" @click.native="settingTime(list[curIdx])" class="btn_bots btn">{{
+              <el-button v-if="list[curIdx].waimaiOrderId" size="small" @click.native="settingTime(list[curIdx])" class="btn_bots btn">{{
                   list[curIdx].delayTime ? "修改定时" : "定时发单"
                 }}</el-button>
-              <el-button size="small" @click.native="deleteItem(list[curIdx])" class="btn_bots btn">发起配送</el-button>
+              <el-button v-else size="small" @click.native="cancelOrder(list[curIdx].id)" class="btn_bots">取消订单</el-button>
+              
+              <el-button size="small" @click.native="sendNow(list[curIdx])" class="btn_bots btn">发起配送</el-button>
             </div>
             <!-- 待接单 -->
             <div class="btns" v-if="buttonStatus === 1">
@@ -94,7 +96,7 @@
               <div class="order_item_header_r" v-if="item.buttonStatus === 0">
                 <!-- <span class="header_r">已发单1分钟</span> -->
                 <el-tag v-if="tabNum === -1" class="header_r">新订单</el-tag>
-                <el-button size="small" class="btn" @click.stop="deleteItem(item)">发起配送</el-button>
+                <el-button size="small" class="btn" @click.stop="sendNow(item)">发起配送</el-button>
               </div>
               <!-- 预约单 -->
               <div class="order_item_header_r" v-if="item.buttonStatus === 10">
@@ -102,15 +104,11 @@
                 <el-tag v-if="tabNum === -1" class="header_r">预约单</el-tag>
                 <!-- <el-button size='small' @click.stop="iGnoreOrder(item.id)">忽略订单</el-button> -->
                 <!-- <el-button size='small' @click.stop="itemAddRemark(item.id, item)">添加备注</el-button> -->
-                <el-button size="small" class="btn" @click.stop="settingTime(item)">{{
+                <el-button v-if="item.waimaiOrderId" size="small" class="btn" @click.stop="settingTime(item)">{{
                   item.delayTime ? "修改定时" : "定时发单"
                 }}</el-button>
-                <!-- <el-button
-                  size="small"
-                  class="btn"
-                  @click.stop="deleteItem(item)"
-                  >发起配送</el-button
-                > -->
+
+                <el-button v-else size="small" class="btn" @click.stop="sendNow(item)">立即配送</el-button>
               </div>
               <!-- 待接单 -->
               <div class="order_item_header_r" v-if="item.buttonStatus === 1">
@@ -495,10 +493,7 @@ export default {
           type: "error",
         });
       }
-        console.log(222222,this.buttonStatus);
-
-      if (this.buttonStatus === 1) {
-        console.log(111111);
+      if (this.buttonStatus !== 2) {
         this.doCancelOrder();
         return;
       }
@@ -678,7 +673,7 @@ export default {
     checkMap(item) {
       this.$refs.orderMap.setDialogStatus(item);
     },
-    deleteItem(item) {
+    sendNow(item) {
       this.getValuation(item);
     },
     // 撤回订单