shish 4 лет назад
Родитель
Сommit
ab69403493

+ 549 - 0
ghsApp/src/admin/home/pda.vue

@@ -0,0 +1,549 @@
+<template>
+  <view class="affirm-page">
+    <view class="affirm-view overscroll">
+      <!-- 门店信息 -->
+      <form>
+        <view class="module-com">
+          <view class="commodity-view">
+            <view class="commodity-list">
+              <view class="commodity-item" v-for="(item, index) in selectList" :key="index">
+                <image class="item-icon" :src="item.cover" alt="" />
+                <view class="item-info">
+                  <view class="info-line">
+                    <text class="item-name">{{ item.itemName }}</text>
+                    <text class="item-price">
+                      <text class="unit">¥</text>
+                      <text class="price">
+                        {{ parseFloat(item.userPrice)||0 }}
+                      </text>
+                    </text>
+                  </view>
+                  <view class="info-line">
+                    <text class="item-type"></text>
+                    <text class="item-count">
+                      <text v-if="item.bigCount > 0 || item.smallCount > 0">{{`${item.bigCount}`}}</text>
+                      <text v-if="item.smallCount > 0">/</text>
+                      <text v-if="item.smallCount > 0">{{`${item.smallCount}`}}</text>
+                    </text>
+                  </view>
+                </view>
+              </view>
+            </view>
+            <view class="summary-bar">
+              <view class="operate-view" @click="gobackEvent">
+                <text class="iconfont icongouwuche"></text>重选花材
+              </view>
+              <view class="describe-view">
+                共{{ selectList.length }}种,合计 ¥<text class="price">{{ allPrice }}</text>
+              </view>
+            </view>
+          </view>
+        </view>
+        <view class="module-com input-line-wrap">
+					<view class="" v-if="isBilling">
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false" @click="selectCustom">
+            <view class="tui-title">客户</view>
+            <view class="tui-input">{{ form.customName }}</view>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
+            <view class="tui-title">送货</view>
+            <button @tap="courier(2)" class="admin-button-com mini-btn" :class="form.sendType == 2 ? 'blue' : 'default'">自取</button>
+            <button @click="courier(1)" class="admin-button-com mini-btn" :class="form.sendType == 1 ? 'blue' : 'default'">配送</button>
+          </tui-list-cell>
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
+            <view class="tui-title">结算类型</view>
+            <button @tap="form.debt = 1" class="admin-button-com mini-btn" :class="form.debt == 1 ? 'blue' : 'default'">欠款</button>
+            <button @click="form.debt = 0" class="admin-button-com mini-btn" :class="form.debt == 0 ? 'blue' : 'default'">已收款</button>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1" >
+            <view class="tui-title">运费</view>
+            <input @blur="sendCostBlur" type="number" placeholder="请填写,留空免运费" @input="calcPrice" v-model="form.sendCost" placeholder-class="tui-placeholder"/>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :arrow="true" v-if="form.debt == 0">
+            <div class="tui-title">收款方式</div>
+            <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 />
+              <div style="padding:6upx 0 6upx 0;">{{payWayList[payWayindex].name}}</div>
+            </picker>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+            <view class="tui-title">总金额</view>
+            <text style="color: #3385FF" v-if="form.sendType == 1">{{	(allPrice + Number(form.sendCost)).toFixed(2) }}</text>
+            <text style="color: #3385FF" v-else >{{ allPrice.toFixed(2) }}</text>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false" >
+            <view class="tui-title">
+              <text>
+                <text v-if="form.debt == 1">应收金额</text><text v-else>已收金额</text>
+              </text>
+            </view>
+            <text style="color: #3385FF">{{modifyPrice}}</text>
+          </tui-list-cell>
+
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
+            <view class="tui-title">备注</view>
+						<textarea style="height: 100upx" v-model="form.remark" placeholder="选填"/>
+					</tui-list-cell>
+
+          </view>
+        </view>
+      </form>
+    </view>
+    <view class="under-bar">
+      <view class="price-view">
+        <text class="price-title" v-if="isBilling">
+          <text>{{form.debt == 1 ? "欠款" : "已收款"}}</text>
+        </text>
+        <text class="price-title" v-else>金额</text>
+        <text class="price-number">¥<text class="large">{{ modifyPrice }}</text></text>
+      </view>
+      <button class="admin-button-com blue middle" @click="affirmFormSubmit">开单</button>
+    </view>
+
+  </view>
+</template>
+
+<script>
+import TuiListCell from "@/components/plugin/list-cell";
+import AppAvatarModule from "@/components/module/app-avatar";
+import SimpleAddress from "@/components/plugin/simple-address";
+import AppAreaSel from "@/components/app-area-sel";
+import productMins from "@/mixins/product";
+import appFormRadioBtn from "@/components/app-formRadio-btn";
+import appAddressGroup from "@/components/app-address-group";
+import appSendTime from "@/components/app-send-time";
+import appFormSend from "@/components/app-form-send";
+const formUtil = require("@/utils/formValidation.js");
+import { createOrder, updateOrder } from "@/api/order/index";
+import { mapActions, mapGetters } from "vuex";
+import { getUserDet} from "@/api/member";
+export default {
+  name: "pda", //PDA极速开单
+  components: {
+    TuiListCell,
+    AppAvatarModule,
+    SimpleAddress,
+    AppAreaSel,
+    appFormRadioBtn,
+    appAddressGroup,
+    appSendTime,
+    appFormSend,
+  },
+  mixins: [productMins],
+  data () {
+    return {
+      autoLoad: false,
+      isBilling: true,
+			payWayList:[{name:"微信",id:0},{name:"支付宝",id:1},{name:"现金",id:4},{name:"银行卡",id:5}],
+			payWayindex:0,
+      form: {
+        debt: 1, //付款方式 1欠款订单 0正常订单
+        shopId: "",
+        shopName: "",
+        receiveProvince: "",
+        receiveCity: "",
+        receiveFloor: "",
+        receiveAddress: "",
+        receiveLong: "",
+        receiveLat: "",
+        sendType: 2,
+        sendSide: "2",
+        sendDate: "",
+        sendTimeWant: "",
+        sendCost: "",
+        customId: "",
+        product: "",
+        remark:"",
+        payWay:0,
+        needPrint:1,//订单生成时打印订单1需要2不需要
+      },
+      money: "",
+      modifyPrice: 0,
+      showCustomer: false,
+      customInfo:{discount:1}
+    };
+  },
+  onLoad (option) {
+    if (!this.getMerchantInfo) {
+      this.initMerchantInfo().then((data) => {
+        uni.setNavigationBarTitle({
+          title: data.name,
+        });
+      });
+    } else {
+      uni.setNavigationBarTitle({
+        title: this.getMerchantInfo.name,
+      });
+    }
+    this.modifyPrice = this.allPrice.toFixed(2);
+    //默认自取
+    this.courier(2);
+    if(option.customId){
+      this.form.customId = option.customId
+      let that = this
+      getUserDet({ id: option.customId }).then(res => {
+        that.form.customName = res.data.name
+        that.customInfo = res.data
+        if(res.data.discount && res.data.discount < 1){
+          that.calcPrice()
+        }
+      })
+    }
+  },
+	onShow(){
+		if(!this.$util.isEmpty(uni.getStorageSync("newClient"))){
+			this.showCustomer = true;
+		}
+	},
+	onUnload(){
+			uni.removeStorageSync('newClient');
+	},
+  computed: {
+    ...mapGetters(["getMerchantInfo", "getLoginInfo"]),
+  },
+  methods: {
+    ...mapActions(["initMerchantInfo"]),
+    init () {
+      this._getDet();
+    },
+    selectCustom(){
+    },
+		payWayChange(e){
+			let index = e.detail.value
+			this.payWayindex = index
+      this.form.payWay = this.payWayList[index].id
+		},
+    calcPrice () {
+      let totalPrice = this.allPrice.toFixed(2)
+      this.modifyPrice = (Number(totalPrice) + Number(this.form.sendCost)).toFixed(2)
+      this.modifyPrice = parseFloat(this.modifyPrice)
+    },
+    setPayWay(payWay){
+      this.form.payWay = payWay
+    },
+    courier (type) {
+      this.form.sendType = type;
+      if (type === 2) {
+        this.form.sendCost = "";
+      } else if(type == 1){
+        this.form.sendCost = this.money;
+      }
+    },
+    sendCostBlur () {
+      if (this.form.sendType === 1) {
+        this.money = this.form.sendCost;
+      }
+    },
+    _getDet () {
+      let data = uni.getStorageSync("modifyShopB");
+      if (this.$util.isEmpty(data)) return;
+      Object.keys(this.form).forEach((i, index) => {
+        this.form[i] = data[i];
+      });
+    },
+    changeCustomerFn (info) {
+      const product = this.selectList.map((ele) => {
+        return {
+          productId: ele.id,
+          bigNum: ele.bigCount,
+          smallNum: ele.smallCount,
+          classId: ele.classId,
+          itemId: ele.itemId,
+        };
+      });
+      let params = {
+        customId: info.id,
+        product: JSON.stringify(product),
+        province: info.province,
+        city: info.city,
+        address: info.address,
+        floor: info.floor,
+        long: info.long,
+        lat: info.lat,
+      };
+      this.form.sendCost = '';
+      this.form.customId = info.id;
+      this.form.customName = info.name;
+    },
+    confirmFn (options) {
+      let that = this
+      if (options.sendType == 2) {
+        options.sendCost = "";
+      }
+      let Fn = createOrder
+      let params = {...options,modifyPrice: this.modifyPrice,newVersion:1};
+      if(this.option.orderId && this.option.orderId > 0){
+        Fn = updateOrder
+        params = {...params,id:this.option.orderId}
+      }
+
+      //小菊
+      let xj = uni.getStorageSync("xj"+this.option.customId)
+      params = {...params,xj:JSON.stringify(xj)}
+
+      Fn(params).then((res) => {
+        if(res.code == 1){
+          //删除记忆
+          this.removeMemory(that.option.customId)
+          const {data: { id, orderSn },} = res;
+          this.$util.pageTo({ url: '/admin/billing/result',type:2,query: {orderId:id,orderSn:orderSn}})
+        }
+      });
+    },
+    affirmFormSubmit () {
+      let self = this;
+
+        let rules = [
+          {
+            name: "customId",
+            rule: ["required"],
+            msg: ["请选择客户"],
+          },
+        ];
+        let checkRes = formUtil.validation(this.form, rules);
+        if (checkRes) {
+          this.$msg(checkRes);
+          return false;
+        }
+        uni.showModal({
+          title: "提示",
+          content: "确认打印订单?",
+          cancelText: "不需要",
+          confirmText: "打印",
+          confirmColor: '#39B54A',
+          cancelColor: '#777777',
+          success: function (res) {
+            if (res.confirm) {
+              self.form.needPrint = 1
+              self.formSubmit();
+            }else{
+              self.form.needPrint = 2
+              self.formSubmit();
+            }
+          },
+        });
+
+    },
+    // 表单验证
+    async formSubmit () {
+      try {
+        // 进行表单检查
+        this.form;
+        let formData = this.form;
+        let price = 0;
+        const product = this.selectList.map((ele) => {
+          price += ele.bigCount * Number(ele.bigPrice);
+          price += ele.smallCount * Number(ele.smallPrice);
+          return {
+            productId: ele.id,
+            bigNum: ele.bigCount,
+            smallNum: ele.smallCount,
+            classId: ele.classId,
+            itemId: ele.itemId,
+            price: ele.userPrice>0?ele.userPrice:price,
+          };
+        });
+        formData.product = JSON.stringify(product);
+        if (!this.getMerchantInfo) {
+          await this.initMerchantInfo();
+        }
+        formData.shopId = this.getMerchantInfo.id;
+        let checkRes = formUtil.validation(formData, []);
+        // 验证通过!
+        if (!checkRes) {
+          this.confirmFn(formData);
+        } else {
+          this.$msg(checkRes);
+        }
+      } catch (error) {
+        console.log(999999, error);
+      }
+    },
+    gobackEvent () {
+      uni.navigateBack({
+        delta: 1,
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.admin-button-com {
+  margin-right: 20upx;
+}
+.affirm-page {
+  position: relative;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+
+  .affirm-view {
+    flex: 1;
+    padding: 20upx;
+    background-color: #f0f2f6;
+
+    .commodity-view {
+      display: flex;
+      flex-direction: column;
+      .commodity-list {
+        padding: 20upx;
+        .commodity-item {
+          display: flex;
+          margin-bottom: 20upx;
+          .item-icon {
+            flex-shrink: 0;
+            width: 140upx;
+            height: 140upx;
+          }
+          .item-info {
+            display: flex;
+            flex-direction: column;
+            justify-content: center;
+            flex: 1;
+            margin-left: 20upx;
+            .info-line {
+              margin-bottom: 20upx;
+              display: flex;
+              justify-content: space-between;
+              align-items: flex-end;
+              .item-name {
+                color: #666;
+                font-size: 28upx;
+              }
+              .item-price {
+                color: #333;
+                font-size: 22upx;
+                .price {
+                  font-size: 32upx;
+                  font-weight: bold;
+                }
+              }
+              .item-type {
+                color: #999;
+                font-size: 24upx;
+              }
+              .item-count {
+                color: #666;
+                font-size: 24upx;
+              }
+            }
+          }
+        }
+      }
+      .summary-bar {
+        padding: 0 20upx;
+        height: 90upx;
+        display: flex;
+
+        align-items: center;
+        justify-content: space-between;
+        border-top: 1px solid #eeeeee;
+        .operate-view {
+          display: flex;
+
+          align-items: center;
+          color: #3385ff;
+          font-size: 26upx;
+          .iconfont {
+            margin-right: 20upx;
+            font-size: 40upx;
+          }
+        }
+        .describe-view {
+          display: flex;
+
+          align-items: center;
+          color: #333;
+          font-size: 24upx;
+          .price {
+            font-weight: bold;
+            font-size: 36upx;
+          }
+        }
+      }
+    }
+    .module-com {
+        background-color: #fff;
+        margin-bottom: 20upx;
+        border-radius: 10upx;
+        overflow: hidden;
+        .tab-box{
+            padding: 10upx 30upx 30upx;
+            .tab{
+                width: 49%;
+                height: 70upx;
+                color: #a2a2a2;
+                border: 1px solid #dcdcdc;
+                border-radius: 10upx;
+                font-size: 28upx;
+                font-weight: 700;
+                &.active{
+                    color: #ff4d4d;
+                    border: 1px solid #ff4d4d;
+                }
+            }
+        }
+        .member-wrap {
+            .member-det {
+                font-size: 24upx;
+                margin-left: 20upx;
+            }
+        }
+        .remark-wrap {
+            align-items: flex-start;
+            .remark {
+                height: 240upx;
+            }
+        }
+        // .tui-placeholder,
+        // .tui-input {
+        // 	padding-right: 30upx;
+        // 	width: 100%;
+        // 	text-align: right;
+        // }
+    }
+  }
+  .under-bar {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 20upx;
+    width: 100%;
+    height: 100upx;
+    background-color: #fff;
+
+    box-shadow: 0px -1px 6px 0px rgba(4, 0, 0, 0.06);
+    .price-view {
+      display: flex;
+      align-items: center;
+      font-size: 24upx;
+      .price-title {
+        color: #333;
+      }
+      .price-number {
+        margin: 0 20upx;
+        color: #ff2842;
+        .large {
+          font-size: 40upx;
+        }
+      }
+    }
+    .admin-button-com {
+      width: 200upx;
+    }
+  }
+}
+</style>

+ 25 - 0
ghsApp/src/admin/home/workbench.vue

@@ -269,6 +269,18 @@ export default {
 		...mapGetters({ myShopInfo: "getMyShopInfo" }),
 	},
 	onLoad(option) {
+
+		let that = this
+		var main = plus.android.runtimeMainActivity(); //获取activity
+		var receiver = plus.android.implements('io.dcloud.feature.internal.reflect.BroadcastReceiver', {
+			onReceive: that.doReceive
+		});
+		var IntentFilter = plus.android.importClass('android.content.IntentFilter');
+		var filter = new IntentFilter();
+		filter.addAction("nlscan.action.SCANNER_RESULT"); //监听扫描
+		main.registerReceiver(receiver, filter); //注册监听
+
+
 	},
 	onPullDownRefresh() {
 		this.init();
@@ -278,6 +290,19 @@ export default {
 	},
 	methods: {
 		...mapActions(['setUserShopAll']),
+		doReceive(context, intent) {
+			//通过intent实例引入intent类,方便以后的'.'操作
+			plus.android.importClass(intent)
+			var barcodeBytes1 = intent.getStringExtra("SCAN_BARCODE1")
+			console.log(barcodeBytes1)
+			var pages = getCurrentPages()
+			let currentRoute  = pages[pages.length-1].route;
+			if(currentRoute != 'admin/home/pda'){
+				this.$util.pageTo({url: '/admin/home/pda'})
+			}else{
+				console.log('vvvvvvv')
+			}
+		},
 		loginFun(mobile,password){
 
 			//有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login

+ 115 - 0
ghsApp/src/components/login-model.vue

@@ -0,0 +1,115 @@
+<template>
+  <view class="model" v-if="show">
+    <view class="experFrame">
+      <view>
+        <view style="text-align:center;margin-bottom:60upx;">
+          <image :src="`${constant.imgUrl}/logo3.png`" class="logo" mode="widthFix"></image> 
+        </view>
+        <view>
+          <input v-model="mobile" class="experInput" placeholder="手机号" type="number" />
+        </view>
+        <view>
+          <input v-model="password" class="experInput" placeholder="密码" type="text" />
+        </view>
+        <button class="admin-button-com small blue buttonText" @click="loginClick">登陆</button>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  props: {
+    show: {
+      type: Boolean,
+      default: true,
+    }
+  },
+  watch: {
+  },
+  data() {
+    return {
+      password: '',
+      mobile:''
+    };
+  },
+  methods: {
+    loginClick() {
+      this.$emit('comfirm', this.mobile,this.password)
+    }
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.model {
+  position: fixed;
+  z-index: 9999;
+  top: 0;
+  left: 0;
+  width: 100vw;
+  height: 100vh;
+  background: rgba(0, 0, 0, 0.6);
+  color: #fff;
+  overflow: hidden;
+  text-align: center;
+  & > .noData_img {
+    width: 318upx;
+    height: 318upx;
+    margin: 332upx auto 0;
+  }
+  & > .no_data_text {
+    font-size: 32upx;
+    color: #ffffff;
+    text-align: center;
+    margin: 50upx 0;
+  }
+  & > .freeApply {
+    width: 376upx;
+    height: 88upx;
+    line-height: 88upx;
+    background: linear-gradient(90deg, #3385ff, #33b0ff);
+    border-radius: 44upx;
+    margin: 0 auto;
+    font-size: 32upx;
+    color: #ffffff;
+    text-align: center;
+  }
+  &>.experience{
+    margin-top: 40upx;
+    color: #fff;
+    font-size: 30upx;
+  }
+  &>.experFrame{
+      margin-top: 260upx;
+      height: 50upx;
+      .experInput{
+        height: 70upx;
+        width: 350upx;
+        margin-bottom:38upx;
+        display: inline-block;
+        vertical-align: middle;
+        border-radius: 8upx;
+        background-color: #fff;
+        border: 1px solid #ccc;
+        color: #666;
+        padding-left: 20upx;
+        box-sizing: border-box;
+        text-align: left;
+      }
+      .buttonText{
+        display: inline-block;
+        line-height: 70upx;
+        padding: 0 20upx;
+        background-color: #3385FF;
+        vertical-align: middle;
+        font-size: 30upx;
+        width:350upx;
+      }
+      .logo{
+        width:180upx;
+        margin:0 auto;
+      }
+  }
+}
+</style>