Browse Source

制作编号

shish 4 years ago
parent
commit
ed6f716c95

+ 1 - 1
hdApp/src/admin/order/addOrder.vue

@@ -82,7 +82,7 @@ import FooterCart from "@/components/module/app-footer-cg-plant-cart";
 import { list } from "@/mixins";
 import productMins from "@/mixins/cgPlantProduct";
 export default {
-  name: "plant",
+  name: "addOrder",
   components: {
     OperateModule,
     AppWrapperEmpty,

+ 36 - 21
hdApp/src/admin/order/addOrderConfirm.vue

@@ -54,6 +54,19 @@
             <text v-if="modifyPrice > 0 && modifyPrice < finalPrice" style="font-size:25upx;margin-left:20upx;color:green;">优惠 ¥{{parseFloat((finalPrice-modifyPrice).toFixed(2))}}</text>
           </tui-list-cell>
 
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
+            <view class="tui-title">结账方式</view>
+            <button @tap="form.hasPay = 1" class="admin-button-com mini-btn" :class="form.hasPay == 1 ? 'blue' : 'default'">已付款</button>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :arrow="true" v-if="form.hasPay == 1">
+            <view class="tui-title">收款方式</view>
+            <picker mode="selector" :value="form.payWay" :range="payWayList" range-key="name" @change="payWayChange" class="tui-input" >
+              <input v-model="form.payWay" name="payWay" type="text" hidden />
+              <view style="padding:6upx 0 6upx 0;">{{payWayList[payWayindex].name}}</view>
+            </picker>
+          </tui-list-cell>
+
         </view>
 
         <app-delivery-module ref="appDelivery" @changeAddress="changeAddress" />
@@ -71,8 +84,8 @@
 import TuiListCell from "@/components/plugin/list-cell";
 import productMins from "@/mixins/cgPlantProduct";
 import AppDeliveryModule from "@/components/app-delivery";
-import { cgPlant } from "@/api/goods/index";
-import { mapActions, mapGetters } from "vuex";
+import { createOrder } from "@/api/order";
+import { mapGetters } from "vuex";
 import { getUserDistance } from "@/api/express";
 export default {
   name: "plantConfirm",
@@ -84,18 +97,14 @@ export default {
     return {
       selectJobType: "addOrder",
       form: {
-        anonymity: "0", // 是否匿名 0不 1要
-        sendDistance: "", // 配送距离,根据腾讯js进行计算
-        goodsId: "", // 【商城下单特有字段】商品id
-        goodsStyleId: "", // 【商城下单特有字段】商品款式id
-        goodsNum: "", // 【商城下单特有字段】商品数量
-        couponId: "0", // 优惠券id,默认0没有使用优惠券
-        receiveLat: "", // 收花人纬度
-        receiveLong: "",// 收花人经度
         remark:"",
+        hasPay:1,
+        payWay:0,
         sendCost:''
       },
-      modifyPrice:0
+      modifyPrice:0,
+			payWayindex:0,
+			payWayList:[{name:"微信",id:0},{name:"支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}],
     };
   },
   onLoad (option) {
@@ -117,23 +126,29 @@ export default {
     }
   },
   methods: {
+		payWayChange(e){
+			let index = e.detail.value
+			this.payWayindex = index
+      this.form.payWay = this.payWayList[index].id
+		},
     //计算客户距离和运费
-    changeAddress(e) {
-      let lat = this.$refs.appDelivery.region.latitude;
-      let long = this.$refs.appDelivery.region.longitude;
+    changeAddress() {
+      return false
+      let lat = this.$refs.appDelivery.region.latitude
+      let long = this.$refs.appDelivery.region.longitude
       getUserDistance({ lat: lat, lng: long }).then(res => {
-        this.freightPrice = res.data.fee;
-        this.showDistance = res.data.showDistance;
-      });
+        this.freightPrice = res.data.fee
+        this.showDistance = res.data.showDistance
+      })
     },
     confirmToSubmit () {
-      return
       let that = this
-      let goods = this.selectList.map((ele) => {
-        return {goodsId: ele.id, num: ele.bigCount,price: ele.userPrice,goodsSn:ele.sn,cover:ele.shortCover}
+      let productData = this.selectList.map((ele) => {
+        return {productId: ele.id, num: ele.bigCount,unitPrice: ele.userPrice,unitType:0,property:ele.property}
       })
+      that.form = {...that.$refs.appDelivery.form,...that.form}
       that.$util.confirmModal({content:'确认提交?'},() => {
-          cgPlant({goods:JSON.stringify(goods),...that.form}).then((res) => {
+          createOrder({product:JSON.stringify(productData),...that.form,modifyPrice:this.modifyPrice}).then((res) => {
             that.removeFromSaveDirect()
             that.pageTo({url: '/admin/order/addOrderResult',type:2,query:{id:res.data.id}})
           });

+ 1 - 1
hdApp/src/admin/order/components/order-item.vue

@@ -8,7 +8,7 @@
             <view class="goods-name" style="font-size:29upx;font-weight:bold;">{{ goodsInfo.name }}</view>
         </view>
         <view class="operate-wrap" style="margin-bottom:15upx;">
-            <view class="goods-price" style="font-size:23upx;">60</view>
+            <view class="goods-price" style="font-size:23upx;">¥{{goodsInfo.price?parseFloat(goodsInfo.price):0}}</view>
             <view style="float:right;display:inlin-block;padding-right:30upx;color:#CCCCCC;">
                 <text @click.stop="delItemFn" style="border:1upx solid #CCCCCC;border-radius:30upx;padding:0upx 12upx;">-</text>
                 <text style="width:90upx;display:inline-block;text-align:center;">

+ 4 - 1
hdApp/src/admin/order/detail.vue

@@ -16,7 +16,7 @@
       <view class="module-com order-msg" v-if="!$util.isEmpty(orderInfo.receiveMobile)">
         <view class="module-tit">
           收花人信息
-          <button class="admin-button-com mini-btn" style="float:right;">编辑</button>
+          <button class="admin-button-com mini-btn" @click="edit" style="float:right;">编辑</button>
         </view>
         <view class="module-det">
           <view class="order-msg-blo">
@@ -128,6 +128,9 @@ export default {
   onLoad() {
   },
   methods: {
+    edit(){
+      this.$msg('开发中')
+    },
 		goRefund(){
 			if(this.orderInfo.payWay == 1){
 				this.$msg('支付宝订单暂不支持线上退款')

+ 53 - 87
hdApp/src/components/app-delivery.vue

@@ -1,11 +1,10 @@
 <template>
-  <div class="app-delivery-module">
-    <!-- 配送公共组件 -->
-    <!-- 收花人 -->
-    <div class="module-com">
+  <view class="app-delivery-module">
+
+    <view class="module-com">
 
       <tui-list-cell class="line-cell" :hover="false">
-        <div class="tui-title">收花人姓名</div>
+        <view class="tui-title">收花人姓名</view>
         <input
           v-model="form.receiveUserName"
           placeholder-class="phcolor"
@@ -17,7 +16,7 @@
       </tui-list-cell>
 
       <tui-list-cell class="line-cell" :hover="false">
-        <div class="tui-title">收花人手机号</div>
+        <view class="tui-title">收花人手机号</view>
         <input
           v-model="form.receiveMobile"
           placeholder-class="phcolor"
@@ -29,22 +28,19 @@
         />
       </tui-list-cell>
 
-
-      <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="openAddres">
-        <div class="tui-title">所在城市</div>
-        <div
-          class="tui-input"
-          v-if="form.province || form.city"
-        >{{ form.province + '-' + form.city }}</div>
-        <div class="tui-placeholder" v-else>请选择</div>
+      <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selectCityFn">
+        <view class="tui-title">所在城市</view>
+        <view class="tui-input" v-if="form.province || form.city" >{{ form.province + '-' + form.city }}</view> <view class="tui-placeholder" v-else>请选择</view>
       </tui-list-cell>
+
       <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selRegionFn">
-        <div class="tui-title">详细地址</div>
-        <div class="tui-input" v-if="form.address">{{ form.address }}</div>
-        <div class="tui-placeholder" v-else>请填写地址</div>
+        <view class="tui-title">详细地址</view>
+        <view class="tui-input" v-if="form.address">{{ form.address }}</view>
+        <view class="tui-placeholder" v-else>请填写地址</view>
       </tui-list-cell>
+
       <tui-list-cell class="line-cell" :hover="false">
-        <div class="tui-title">门牌号</div>
+        <view class="tui-title">门牌号</view>
         <input
           v-model="form.floor"
           placeholder-class="phcolor"
@@ -54,35 +50,23 @@
           placeholder="楼号门牌号(选填)"
         />
       </tui-list-cell>
+
       <tui-list-cell class="line-cell" :hover="false" :arrow="true">
-        <div class="tui-title">配送时间</div>
+        <view class="tui-title">配送时间</view>
         <picker mode="date" :value="form.reachTime" @change="selTimeFn" class="tui-input">
-          <div v-if="form.reachTime">{{ form.reachTime }}</div>
-          <div class="tui-placeholder" v-else>请选择送达时间</div>
+          <view v-if="form.reachTime">{{ form.reachTime }}</view>
+          <view class="tui-placeholder" v-else>请选择送达时间</view>
         </picker>
       </tui-list-cell>
-       <div class="delivery-time">
-        <button
-          class="button-com"
-          :class="[form.reachPeriod == 0 ? 'red' : 'default']"
-          @click="timeTodaySelFn(0)"
-        >上午</button>
-        <button
-          class="button-com"
-          :class="[form.reachPeriod == 1 ? 'red' : 'default']"
-          @click="timeTodaySelFn(1)"
-        >下午</button>
-        <button
-          class="button-com"
-          :class="[form.reachPeriod == 2 ? 'red' : 'default']"
-          @click="timeTodaySelFn(2)"
-        >晚上</button>
-      </div>
-
 
+      <view class="delivery-time">
+        <button class="button-com" :class="[form.reachPeriod == 0 ? 'red' : 'default']" @click="timeTodaySelFn(0)" >上午</button>
+        <button class="button-com" :class="[form.reachPeriod == 1 ? 'red' : 'default']" @click="timeTodaySelFn(1)" >下午</button>
+        <button class="button-com" :class="[form.reachPeriod == 2 ? 'red' : 'default']" @click="timeTodaySelFn(2)" >晚上</button>
+      </view>
 
       <tui-list-cell class="line-cell" :hover="false">
-        <div class="tui-title">订花人姓名</div>
+        <view class="tui-title">订花人姓名</view>
         <input
           v-model="form.bookName"
           placeholder-class="phcolor"
@@ -94,7 +78,7 @@
       </tui-list-cell>
 
       <tui-list-cell class="line-cell" :hover="false">
-        <div class="tui-title">订花人手机号</div>
+        <view class="tui-title">订花人手机号</view>
         <input
           v-model="form.bookMobile"
           placeholder-class="phcolor"
@@ -107,20 +91,20 @@
       </tui-list-cell>
 
       <tui-list-cell class="line-cell" :hover="false">
-        <div class="none-name-delivery flex-center" style="padding-left:0upx;">
-          <div class="tui-title">派送方式</div>
+        <view class="none-name-delivery flex-center" style="padding-left:0upx;">
+          <view class="tui-title">派送方式</view>
           <checkbox-group @change="anonymityChange" style="padding-left:70upx;">
           <checkbox class="ljd-checkbox" value="1" id="noneNameText" ></checkbox>
           <label for="noneNameText" class="none-name-text">匿名派送</label>
           </checkbox-group>
-        </div>
+        </view>
       </tui-list-cell>
 
-    </div>
-    <!-- 备注 -->
-    <div class="module-com remark-wrap">
+    </view>
+
+    <view class="module-com remark-wrap">
       <tui-list-cell class="line-cell" :hover="false">
-        <div class="tui-title">备注</div>
+        <view class="tui-title">备注</view>
         <input
           v-model="form.remark"
           placeholder-class="phcolor"
@@ -130,17 +114,15 @@
           placeholder="选填"
         />
       </tui-list-cell>
-    </div>
+    </view>
+
     <!-- 省市联动 -->
-    <simple-address
-      ref="simpleAddress"
-      :region="orderShop.region"
-      :pickerValueDefault="cityPickerValueDefault"
-      @onConfirm="onCityConfirm"
-    ></simple-address>
-    <!-- 选择地区 -->
+    <simple-address ref="simpleAddress" :region="orderShop.region" :pickerValueDefault="cityPickerValueDefault" @onConfirm="getCityConfirm" ></simple-address>
+
+    <!-- 选择详细地址 -->
     <app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
-  </div>
+
+  </view>
 </template>
 
 <script>
@@ -150,6 +132,7 @@ import AppDatePicker from "@/components/app-date-picker";
 import SimpleAddress from "@/components/plugin/simple-address";
 import AppAreaSel from "@/components/app-area-sel";
 import AppBindInfo from "@/components/app-bind-info";
+import {getShop} from "@/api/common"
 export default {
   name: "app-delivery-module",
   components: {
@@ -170,6 +153,7 @@ export default {
         province: "", // 收花人省份
         city: "", // 收花人城市
         address: "", // 收花人城市
+        showAddress:"",
         floor: "", // 收花人门楼号和牌号
         fullAddress: "", // 收花人完整地址,从腾讯地图接口获取
         bookName: '', // 订花人姓名
@@ -189,25 +173,15 @@ export default {
       cityPickerValueDefault: [0, 0]
     };
   },
-  computed: {
-    ...mapGetters({ orderShop: "getOrderShop" })
-  },
-  watch: {
-    orderShop(val) {
-      console.log("val", val);
-      this.form.province = val.shop.province ? val.shop.province : "";
-      this.form.city = val.shop.city ? val.shop.city : "";
-    }
-  },
   mounted() {
-    if (!this.$util.isEmpty(this.orderShop)) {
-      this.form.province = this.orderShop.shop.province
-        ? this.orderShop.shop.province
-        : "";
-      this.form.city = this.orderShop.shop.city
-        ? this.orderShop.shop.city
-        : "";
-    }
+    getShop().then(res=>{
+      if(res.code == 1){
+        if(res.data.info){
+          this.form.province = res.data.info.province
+          this.form.city = res.data.info.city
+        }
+      }
+    })
   },
   methods: {
     selTimeFn(e) {
@@ -222,9 +196,8 @@ export default {
       this.showRegion = true;
     },
     changeAreaFn(e) {
-      console.log("changeAreaFn", e);
       this.form.address = e.title;
-      this.form.fullAddress = e.address;
+      this.form.showAddress = e.address;
       this.region.latitude = e.location.lat;
       this.region.longitude = e.location.lng;
       this.$emit("changeAddress", e);
@@ -238,19 +211,16 @@ export default {
     anonymityChange() {
       this.form.anonymity = this.form.anonymity == 1 ? 0 : 1;
     },
-    // 省市联动
-    openAddres() {
+    selectCityFn() {
       this.$refs.simpleAddress.open();
     },
-    onCityConfirm(e) {
-      this.form.address = e.label;
+    getCityConfirm(e) {
       this.form.province = e.provinceName;
       this.form.city = e.cityName;
     }
   }
 };
 </script>
-
 <style lang="scss" scoped>
 .app-delivery-module {
   .module-com {
@@ -288,7 +258,6 @@ export default {
     @include disFlex(center, center);
     background-color: #fff;
     padding: 20upx 0;
-    // border-top: 1px solid $borderColor;
     .button-com {
       padding-top: 14upx;
       padding-bottom: 10upx;
@@ -311,9 +280,6 @@ export default {
 
   // 匿名派送
   .none-name-delivery {
-    // padding-left: 30upx;
-    // padding: 26upx 30upx;
-    // margin-top: 40upx;
     margin-bottom: 20upx;
     background-color: #fff;
     .none-name-text {
@@ -322,4 +288,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 6 - 2
hdApp/src/mixins/cgPlantProduct.js

@@ -395,9 +395,13 @@ export default {
 			this.$nextTick(()=>{
 				this.customData.smallCount = this.customData.smallCount==0?null:this.customData.smallCount;
 				this.customData.bigCount = this.customData.bigCount==0?null:this.customData.bigCount;
-				if(this.selectJobType == 'bill'){
+				if(this.selectJobType == 'bill' || this.selectJobType == 'addOrder'){
 					if(this.customData.userPrice == null || this.customData.userPrice == 0){
-						this.customData.userPrice =	this.customData.bigPrice;
+						if(this.customData.property == 0){
+							this.customData.userPrice =	parseFloat(this.customData.price)
+						}else{
+							this.customData.userPrice =	parseFloat(this.customData.bigPrice)
+						}
 					}
 				}else{
 					this.customData.userPrice = this.customData.userPrice==0?null:this.customData.userPrice;