shish 5 лет назад
Родитель
Сommit
aaf43b4f8d

+ 65 - 62
ghsApp/src/admin/billing/affirm.vue

@@ -200,7 +200,7 @@ export default {
       showCustomer: false
     };
   },
-  onLoad () {
+  onLoad (option) {
     if (!this.getMerchantInfo) {
       this.initMerchantInfo().then((data) => {
         uni.setNavigationBarTitle({
@@ -214,6 +214,14 @@ export default {
     }
     this.modifyPrice = this.allPrice.toFixed(2);
     this.courier(2);
+
+    if(option.customId){
+      this.form.customId = option.customId
+    }
+    if(option.customName){
+      this.form.customName = option.customName
+    }
+
   },
 	onShow(){
 		if(!this.$util.isEmpty(uni.getStorageSync("newClient"))){
@@ -292,12 +300,10 @@ export default {
       if (options.sendType == 2) {
         options.sendCost = "";
       }
-
       createOrder({...options,modifyPrice: this.modifyPrice,}).then((res) => {
-        this.resetSelectInfoByType(this.pageType);
-        const {
-          data: { id, orderSn },
-        } = res;
+        //删除记忆
+        this.removeMemory()
+        const {data: { id, orderSn },} = res;
         let url = `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
         uni.redirectTo({
           url: url,
@@ -308,62 +314,59 @@ export default {
       });
     },
     affirmFormSubmit () {
-					let self = this;
-    	if(this.isBilling){
-						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: "确认开单?",
-							success: function (res) {
-								if (res.confirm) {
-									self.formSubmit();
-								}
-							},
-						});
-					}else{
-    		let price = 0;
-						let 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,
-							};
-						});
-						console.log(product)
-						// formData.product = JSON.stringify(product);
-						uni.showModal({
-							title: "提示",
-							content: "确认报损?",
-							success: function (res) {
-								if (res.confirm) {
-									wastage({product:JSON.stringify(product)}).then((res) => {
-										self.resetSelectInfoByType(self.pageType);
-										const {data: { id, orderSn },} = res;
-										let url = `/admin/billing/result?title=报损成功&orderId=${id}&orderSn=${orderSn}`;
-										uni.redirectTo({url: url,success: (result) => { },fail: () => { },complete: () => { },
-										});
-									});
-								}
-							},
-						});
-					}
-
+      let self = this;
+      if(this.isBilling){
+        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: "确认开单?",
+          success: function (res) {
+            if (res.confirm) {
+              self.formSubmit();
+            }
+          },
+        });
+      }else{
+        let price = 0;
+        let 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,
+          };
+        });
+        uni.showModal({
+          title: "提示",
+          content: "确认报损?",
+          success: function (res) {
+            if (res.confirm) {
+              wastage({product:JSON.stringify(product)}).then((res) => {
+                //删除记忆
+                this.removeMemory()
+                const {data: { id, orderSn },} = res;
+                let url = `/admin/billing/result?title=报损成功&orderId=${id}&orderSn=${orderSn}`;
+                uni.redirectTo({url: url,success: (result) => { },fail: () => { },complete: () => { },});
+              });
+            }
+          },
+        });
+      }
     },
     // 表单验证
     async formSubmit (e) {

+ 7 - 5
ghsApp/src/admin/billing/index.vue

@@ -210,8 +210,6 @@ export default {
 					this.updateItemEvent(this.customData);
 					this.modalCancel();
 				}
-				// this.updateItemEvent(this.customData);
-				// this.modalCancel();
 
 		},
 		cancelEvent() {
@@ -248,9 +246,13 @@ export default {
 				console.log('过滤后',list)
 				this.setSelectInfoByType({ type: this.pageType, info: list });
 
-				uni.navigateTo({
-					url: "/admin/billing/affirm"
-				});
+				if (this.$util.isEmpty(this.option.customId)){
+					this.$msg("请选择客户")
+					return
+				}
+				let customName = this.option.customName ? this.option.customName : '';
+
+				uni.navigateTo({url: "/admin/billing/affirm?customId="+this.option.customId+"&customName="+customName});
 			} else {
 				this.$msg("请选择花材");
 			}

+ 1 - 1
ghsApp/src/admin/home/workbench.vue

@@ -67,7 +67,7 @@
 		<view class="module-com">
 			<view class="tabs-head_bx">
 				<image
-					@click="pageTo({ url: '/admin/billing/index' })"
+					@click="pageTo({ url: '/admin/order/selectCustom' })"
 					:src="kdSrc"
 					mode="widthFix"
 				></image>

+ 262 - 0
ghsApp/src/admin/order/selectCustom.vue

@@ -0,0 +1,262 @@
+<template>
+  <div class="app-main app-content">
+    <view class="input-wrap_box">
+      <view>
+        <AppSearchModule placeholder="请输入客户名称,支持拼音首字母" @input="searchFn"/>
+      </view>
+    </view>
+    <block v-if="!$util.isEmpty(list.data)">
+      <block v-for="(item, index) in list.data" :key="index">
+        <tui-list-cell :arrow="true" @click=" pageTo({url: '/admin/billing/index',type:2,query: {customId: item.id,customName:item.name}})">
+          <div class="tui-msg-box">
+            <img :src="item.avatar" class="tui-msg-pic" mode="widthFix" />
+            <div class="tui-msg-item">
+              <div class="tui-msg-name">
+                <div class="tui-user-name">{{ item.name }}</div>
+              </div>
+              <div class="tui-msg-content">
+                <span>{{ item.visitTime }}</span>
+                <span v-if="item.debtAmount > 0" class="debt-amount">欠款:<span class="amount_num">{{item.debtAmount}}</span></span>
+              </div>
+            </div>
+          </div>
+          <div class="tui-msg-right">
+            <badge-module
+              type="danger"
+              :dot="item.level == 3 ? true : false"
+              v-if="item.messageNum > 0"
+              >{{ item.messageNum }}</badge-module
+            >
+          </div>
+        </tui-list-cell>
+      </block>
+    </block>
+    <block v-else>
+      <app-wrapper-empty :is-empty="$util.isEmpty(list.data)" />
+    </block>
+  </div>
+</template>
+
+<script>
+import TuiListCell from "@/components/plugin/list-cell";
+import BadgeModule from "@/components/plugin/badge";
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import appVipModule from "@/components/module/app-vip";
+import AppTag from "@/components/module/app-tag.vue";
+import AppSearchModule from "@/components/module/app-search";
+import { list } from "@/mixins";
+import { getList } from "@/api/member";
+export default {
+  name: "selectCustom",
+  components: {
+    TuiListCell,
+    BadgeModule,
+    AppWrapperEmpty,
+    appVipModule,
+    AppTag,
+    AppSearchModule
+  },
+  mixins: [list],
+  data() {
+    return {
+      tabIndex: 0
+    };
+  },
+  onPullDownRefresh() {
+    this.resetList();
+    this._list().then((res) => {
+      uni.stopPullDownRefresh();
+    });
+  },
+  onReachBottom() {
+    if (!this.list.finished) {
+      this._list().then((res) => {
+        uni.stopPullDownRefresh();
+      });
+    } else {
+      uni.stopPullDownRefresh();
+    }
+  },
+  onLoad(option) {},
+	onShow(){
+		uni.removeStorageSync('newClient');
+	},
+  methods: {
+    init() {
+      if(!this.AUTHORITY_SHOW) {
+        this._list();
+      }
+    },
+    searchFn(e) {
+        this.seekVal = e;
+        this._list();
+    },
+    _list() {
+      return getList({
+          search: "",
+          type:this.tabIndex,
+          page: this.list.page,
+          name: this.seekVal,
+        }).then((res) => {
+          this.completes(res);
+          if (this.$util.isEmpty(res.data)){
+            return false;
+          }
+        });
+    },
+    change(e) {
+      if (this.tabIndex == e.index) {
+        return false;
+      }
+      this.tabIndex = e.index;
+      this.resetList();
+      this._list();
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.app-content {
+  padding-top: 100px;
+  padding-bottom: 20px;
+}
+.tabs-wrap {
+  position: fixed;
+  .tabs-left {
+    width: 80%;
+  }
+  .tabs-right {
+    width: 19%;
+    border-left: $borderColor;
+    @include disFlex(center, center);
+  }
+}
+  .input-wrap_box {
+    background-color: #fff;
+    position: fixed;
+    top: 0;
+    z-index: 10;
+    width: 100%;
+    height: 100px;
+    display: flex;
+    align-items: center;
+    padding: 0 30px;
+    & > view:nth-child(1) {
+      flex: 1;
+    }
+  }
+.tui-msg-box {
+  display: flex;
+  align-items: center;
+
+  .tui-msg-pic {
+    width: 80upx;
+    height: 80upx;
+    border-radius: 50%;
+    margin-right: 20upx;
+  }
+
+  .tui-msg-item {
+    max-width: 500upx;
+    min-height: 80upx;
+    overflow: hidden;
+    display: flex;
+    flex-direction: column;
+    justify-content: space-between;
+    & > div {
+      @include disFlex(center, flex-start);
+      & > div:first-child {
+        margin-right: 8px;
+      }
+    }
+    .level-img {
+      /deep/.vip-text {
+        left: 70px;
+        top: 8px;
+      }
+    }
+    .normal-img {
+      width: 70px;
+      padding: 2px 6px;
+      color: #999;
+      background-color: #f0f2f6;
+      border-radius: 20px;
+      .vip-text {
+        font-size: 24px;
+        transform: scale(0.6);
+        position: relative;
+        top: -2px;
+        left: -8px;
+      }
+    }
+    .member-img {
+      width: 70px;
+      padding: 2px 6px;
+      color: green;
+      background-color: #f0f2f6;
+      border-radius: 20px;
+      .vip-text {
+        font-size: 24px;
+        transform: scale(0.6);
+        position: relative;
+        top: -2px;
+        left: -8px;
+      }
+    }
+    .iconfont {
+      color: #00aaed;
+    }
+  }
+
+  .tui-msg-name {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    font-size: 30upx;
+    line-height: 1;
+    color: #262b3a;
+    .tui-user-name {
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+      width: 180rpx;
+    }
+  }
+
+  .tui-msg-content {
+    overflow: hidden;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    font-size: 24upx;
+    line-height: 1;
+    color: #9397a4;
+    .debt-amount{
+      margin-left:40rpx;
+      .amount_num{
+        color:red;
+      }
+    }
+  }
+}
+.tui-msg-right {
+  max-width: 120upx;
+  height: 80upx;
+  margin-left: auto;
+  margin-right: 24px;
+  text-align: right;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+.user_tag {
+  border: 1px solid #cccccc;
+  padding: 5px 12px 5px 12px;
+  border-radius: 25px;
+  color: #bbbbbb;
+  margin-right: 10px;
+  margin-bottom: 12px;
+  display: inline-block;
+  font-size: 30rpx;
+}
+</style>

+ 14 - 4
ghsApp/src/mixins/product.js

@@ -27,6 +27,11 @@ export default {
 		}
 	},
 	onShow(){
+
+		if(uni.getStorageSync('selectList'+this.pageType)){
+			this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) });
+		}
+
 		if (this.autoLoad) {
 			this.initData();
 		}
@@ -458,10 +463,15 @@ export default {
 			}
 
 			this.setSelectInfoByType({ type: this.pageType, info: list });
-			console.log(this.selectList,'this.selectList')
-			if(this.isReserve){
-				uni.setStorageSync('selectList', this.selectList);
-			}
+
+			//记忆已经选择的花材
+			uni.setStorageSync('selectList'+this.pageType, this.selectList)
+
+		},
+		//清除已记忆花材
+		removeMemory(){
+			uni.removeStorageSync('selectList');
+			this.resetSelectInfoByType(this.pageType);
 		},
 		/**
 		 * 切换左侧商品类别

+ 6 - 0
ghsApp/src/pages.json

@@ -20,6 +20,12 @@
 				{"path": "list","style": {"navigationBarTitleText": "余额明细"}}
 			]
 		},
+		{
+			"root": "admin/order",
+			"pages": [
+				{"path": "selectCustom","style": {"navigationBarTitleText": "选择客户"}}
+			]
+		},
 		{
 			"root": "pagesClient",
 			"pages": [

+ 3 - 10
ghsApp/src/pagesPurchase/add.vue

@@ -8,7 +8,7 @@
 				<button class="admin-button-com middle blue" @click="pageTo({ url: '/admin/item/detail' })">添加花材</button>
 			</view>
 			<view style="padding:0 0rpx 0 20rpx;" >
-				<button class="admin-button-com middle blue" @click="removeAllSelectList()">清除采购</button>
+				<button class="admin-button-com middle blue" @click="removeMemory()">清除采购</button>
 			</view>
 		</view>
 
@@ -153,11 +153,9 @@ export default {
 		...mapGetters(["getMyShopInfo","getLoginInfo"]),
 	},
 	onShow(){
-		if(uni.getStorageSync('selectList')){
-			console.log(uni.getStorageSync('selectList'))
-			this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList') });
+		if(uni.getStorageSync('selectList'+this.pageType)){
+			this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) });
 		}
-
 		this.shopId = this.getMyShopInfo.id;
 		let type = '';
 		this.initData({ type, shopId: this.shopId,status:0});
@@ -168,10 +166,6 @@ export default {
 		this.initData({ type, shopId: this.shopId,status:0});
 	},
 	methods: {
-		removeAllSelectList(){
-			uni.removeStorageSync('selectList');
-			this.resetSelectInfoByType(this.pageType);
-		},
 		// 计算重量
 		countWeight(){
 			let ratio = this.customData.ratio;
@@ -293,7 +287,6 @@ export default {
 		confirmSelectEvent() {
 			if (this.selectList.length > 0) {
 
-
 				//因历史遗留原因,打开花材页马上点花材出现数量0或null的情况,需要过滤 shish 20210716
 				let selectList = this.selectList;
 				let list = [];

+ 3 - 2
ghsApp/src/pagesPurchase/details.vue

@@ -367,8 +367,9 @@ export default {
 				}
 				await createPurchaseOrderApi({...formData,modifyPrice:this.modifyPrice});
 				uni.setStorageSync('flowersItemInfo', itemInfo);
-				this.resetSelectInfoByType(this.pageType);
-				uni.removeStorageSync('selectList');
+				
+				this.removeMemory()
+
 				uni.navigateTo({url:'/pagesPurchase/components/pageSuccess?title=新增成功'})
 			} catch (error) {}
 		},