Kaynağa Gözat

绿植采购

shish 4 yıl önce
ebeveyn
işleme
9ea8d34081

+ 101 - 0
hdApp/src/admin/goodsManage/components/plant-item.vue

@@ -0,0 +1,101 @@
+<template>
+    <view class="goods-list-top" @click="showAddModelFn()">
+        <view class="img-blo">
+        <image :src="goodsInfo.smallImgList[0]" mode="aspectFit" ></image>
+        </view>
+        <view class="goods-det">
+        <view class="goods-det-top" style="margin-bottom:4upx;">
+            <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 style="float:right;display:inlin-block;padding-right:10upx;color:#666666;">
+                <text>-</text>
+                <text style="width:100upx;display:inline-block;text-align:center;">
+                  <text v-if="Number(goodsInfo.bigCount)>2">{{goodsInfo.bigCount}}</text>
+                </text>
+                <text>+</text>
+            </view>
+        </view>
+        <view class="operate-wrap">
+            <view style="font-size:23upx;color:#666666;">
+            <text>库存</text> <text style="font-weight:bold;margin-left:8upx;">{{goodsInfo.stock}}</text>
+            </view>
+        </view>
+        </view>
+    </view>
+</template>
+<script>
+export default {
+	name: "plant-item",
+	components: {},
+	mixins: [],
+	props: {
+		goodsInfo: {
+			required: true,
+			type: Object,
+			default() {
+				return {};
+			}
+		},
+    },
+	methods: {
+		addItemFn () {
+			this.$emit("replaceItemFn", this.goodsInfo,0,'add')
+		},
+		reduceItemFn() {
+			this.$emit("replaceItemFn", this.goodsInfo,0,'sub')
+		},
+		showAddModelFn() {
+			this.$emit("showAddModelFn", { ...this.goodsInfo})
+		}
+	}
+}
+</script>
+<style lang="scss" scoped>
+      .goods-list-top {
+        position: relative;
+        @include disFlex(flex-start, flex-start);
+      }
+      .goods-list-bottom {
+        width: 96%;
+        margin-top: 16upx;
+        color: #bebebe;
+        text{
+          border:1px solid rgb(218, 216, 216);
+          border-radius: 20upx;
+          font-size:22upx;
+          padding:6upx 25upx 6upx 25upx;
+        }
+      }
+      .img-blo {
+        width: 130upx;
+        height: 130upx;
+        margin-right: 20upx;
+        & > image {
+          height: 100%;
+          width: 100%;
+        }
+      }
+      .goods-det {
+        width: calc(100% - 150upx);
+        font-size: 28upx;
+        .operate-wrap {
+          @include disFlex(flex-end, space-between);
+        }
+        .operate-icon-wrap {
+          left: -20upx;
+        }
+        .goods-name {
+          margin-bottom: 10upx;
+        }
+        .goods-sales {
+          color: $fontColor3;
+          font-size: 24upx;
+        }
+        .goods-price {
+          color: #ff2842;
+          font-weight: bold;
+        }
+      }
+</style>

+ 2 - 1
hdApp/src/admin/goodsManage/list.vue

@@ -85,7 +85,8 @@ export default {
       operateData: {},
       operateShow: false,
       operateIndex: null,
-      operateTop: 0
+      operateTop: 0,
+      autoLoad:false
     };
   },
   computed: {

+ 95 - 95
hdApp/src/admin/goodsManage/plant.vue

@@ -1,14 +1,15 @@
 <template>
   <view class="app-content">
 
-	<view class="input-wrap" >
-		<view class="search-bar">
-			<app-search-module v-model="py" placeholder="输入英文字母搜索" @input="searchFn" />
-		</view>
-		<view style="float:right">
-			<button class="admin-button-com middle blue" @click="newCg()">新品类</button>
-		</view>
-	</view>
+    <view class="input-wrap" >
+      <view class="search-bar">
+        <app-search-module v-model="py" placeholder="输入英文字母搜索" @input="searchFn" />
+      </view>
+      <view style="float:right">
+        <button class="admin-button-com middle blue" style="margin-right:10upx;" @click="clearSelect()">清除已选</button>
+        <button class="admin-button-com middle blue" @click="newCg()">新品类</button>
+      </view>
+    </view>
 
     <view class="app-middle">
       <scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop">
@@ -22,29 +23,7 @@
             <view class="page-view">
               <view class="goods-list" v-for="(goodsItem, idx) in list.data" :key="idx">
 
-                <view class="goods-list-top">
-                  <view class="img-blo">
-                    <image :src="goodsItem.smallImgList[0]" mode="aspectFit" ></image>
-                  </view>
-                  <view class="goods-det">
-                    <view class="goods-det-top" style="margin-bottom:4upx;">
-                      <view class="goods-name" style="font-size:29upx;font-weight:bold;">{{ goodsItem.name }}</view>
-                    </view>
-                    <view class="operate-wrap" style="margin-bottom:15upx;">
-                      <view class="goods-price" style="font-size:23upx;">60</view>
-					  <view style="float:right;display:inlin-block;padding-right:10upx;color:#666666;">
-						  <text>-</text>
-						  <text style="width:80upx;display:inline-block;"></text>
-						  <text>+</text>
-					  </view>
-                    </view>
-                    <view class="operate-wrap">
-                      <view style="font-size:23upx;color:#666666;">
-                        <text>库存</text> <text style="font-weight:bold;margin-left:8upx;">{{goodsItem.stock}}</text>
-                      </view>
-                    </view>
-                  </view>
-                </view>
+				        <PlantItem :goodsInfo="goodsItem" @showAddModelFn="showAddModelFn" @replaceItemFn="replaceItemFn"></PlantItem>
 
               </view>
             </view>
@@ -55,6 +34,32 @@
         </scroll-view>
       </block>
     </view>
+
+    <modal-module :show="isAddModel" @cancel="addItemModelHidden" @click="confirmAddItemModel" :title="customData.name" color="#333" :size="32" padding="30rpx 30rpx" >
+      <template slot="customContent">
+        <view class="select-cmd_bx">
+          <view class="kc"><text class="unit_price">库存 {{ customData.stock }}</text></view>
+          <view class="num_bx"> 
+            <text style="font-size:35upx;font-weight:bold;color:#666666;margin-right:20upx;">单价</text>
+            <!-- #ifdef APP-PLUS -->
+            <input style="width: 430upx" v-model="customData.userPrice" type="digit" :focus="isAddInputFocus" />
+            <!-- #endif -->
+            <!-- #ifdef MP-WEIXIN -->
+            <input style="width: 430upx" v-model="customData.userPrice" type="digit" />
+            <!-- #endif -->
+          </view>
+        </view>
+        <view class="select-cmd_bx">
+          <view class="num_bx"> 
+            <text style="font-size:35upx;font-weight:bold;color:#666666;margin-right:20upx;">数量</text>
+            <input style="width: 430upx" v-model="customData.bigCount" type="number" />
+          </view>
+        </view>
+      </template>
+    </modal-module>
+
+	  <FooterCart :price="allPrice" :count="allCount" @confirm="confirmToSave" ></FooterCart>
+
   </view>
 </template>
 <script>
@@ -62,19 +67,25 @@ import AppSearchModule from "@/components/module/app-search";
 import OperateModule from "@/admin/home/components/module/operate";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import ModalModule from "@/components/plugin/modal";
-import {categoryListB,getCategoryGoodsB,delB,changeStatusB} from "@/api/goods";
+import PlantItem from "./components/plant-item";
+import {categoryListB,getCategoryGoodsB,changeStatusB} from "@/api/goods";
+import FooterCart from "@/components/module/app-footer-cg-plant-cart";
 import { list } from "@/mixins";
+import productMins from "@/mixins/cgPlantProduct";
 export default {
   name: "plant",
   components: {
     OperateModule,
     AppWrapperEmpty,
     ModalModule,
-    AppSearchModule
+    AppSearchModule,
+	PlantItem,
+	FooterCart
   },
-  mixins: [list],
+  mixins: [list,productMins],
   data() {
     return {
+      selectJobType: "cgPlant",
       tabbar: [],
       height: 0,
       currentTab: 0,
@@ -86,7 +97,8 @@ export default {
       operateData: {},
       operateShow: false,
       operateIndex: null,
-      operateTop: 0
+      operateTop: 0,
+      checkStock:false
     };
   },
   computed: {
@@ -100,13 +112,23 @@ export default {
             this.sInit();
           }
         });
-      }, 50);
+      }, 50)
     }
   },
   methods: {
+    clearSelect(){
+      this.removeFromSaveDirect()
+    },
+    confirmToSave(){
+      if (this.$util.isEmpty(this.selectList)){
+        this.$msg('请选择商品')
+        return false
+      }
+      this.$util.pageTo({url:"/admin/goodsManage/plantConfirm",type:2})
+    },
     goBottom(){
       if (!this.list.finished) {
-        this._list().then((res) => {
+        this.getPlantList().then((res) => {
           uni.stopPullDownRefresh();
         });
       } else {
@@ -117,22 +139,18 @@ export default {
       //this.$util.pageTo({url:"/admin/goodsManage/plant",type:2})
     },
     async sInit() {
-      this._getClass();
-      this._list();
+      this.getPlantClass();
+      this.getPlantList();
     },
-    _getClass() {
+    getPlantClass() {
       categoryListB().then(res => {
         this.tabbar = res.data;
       });
     },
-    _list() {
-      return getCategoryGoodsB({
-        status: 1,
-        page: this.list.page,
-        ...this.form
-      }).then(res => {
-        this.completes(res);
-      });
+    getPlantList() {
+      return getCategoryGoodsB({ status: 1, page: this.list.page, ...this.form }).then(res => {
+        this.completes(res)
+      })
     },
     swichTab(e, item) {
       let cur = e.currentTarget.dataset.current;
@@ -142,7 +160,7 @@ export default {
         this.currentTab = cur;
         this.form.categoryId = item.id;
         this.resetList();
-        this._list();
+        this.getPlantList();
       }
     },
     changeStatus(item) {
@@ -217,51 +235,6 @@ page {
     padding-bottom: env(safe-area-inset-bottom);
     .goods-list {
       margin: 40upx 0;
-      .goods-list-top {
-        position: relative;
-        @include disFlex(flex-start, flex-start);
-      }
-      .goods-list-bottom {
-        width: 96%;
-        margin-top: 16upx;
-        color: #bebebe;
-        text{
-          border:1px solid rgb(218, 216, 216);
-          border-radius: 20upx;
-          font-size:22upx;
-          padding:6upx 25upx 6upx 25upx;
-        }
-      }
-      .img-blo {
-        width: 130upx;
-        height: 130upx;
-        margin-right: 20upx;
-        & > image {
-          height: 100%;
-          width: 100%;
-        }
-      }
-      .goods-det {
-        width: calc(100% - 150upx);
-        font-size: 28upx;
-        .operate-wrap {
-          @include disFlex(flex-end, space-between);
-        }
-        .operate-icon-wrap {
-          left: -20upx;
-        }
-        .goods-name {
-          margin-bottom: 10upx;
-        }
-        .goods-sales {
-          color: $fontColor3;
-          font-size: 24upx;
-        }
-        .goods-price {
-          color: #ff2842;
-          font-weight: bold;
-        }
-      }
     }
   }
 }
@@ -293,7 +266,34 @@ page {
 	padding: 22upx 20upx 22upx 30upx;
 	.search-bar {
 		display:inline-block;
-		width:560upx;
+		width:400upx;
+	}
+}
+.select-cmd_bx {
+	& .kc {
+		color: #999999;
+		font-size: 28upx;
+		font-weight: 400;
+		margin-bottom: 40upx;
+		text-align: center;
+		margin-top: 30upx;
+		.unit_price{
+			padding-right:25upx;
+		}
+	}
+	& .num_bx {
+		display: flex;
+		align-items: center;
+		margin-bottom: 40upx;
+		& > input {
+			width: 212upx;
+			height: 80upx;
+			border: 1upx solid #dddddd;
+			border-radius: 4upx;
+			text-align: center;
+			margin-right: 24upx;
+			font-size: 40upx;
+		}
 	}
 }
 </style>

+ 272 - 0
hdApp/src/admin/goodsManage/plantConfirm.vue

@@ -0,0 +1,272 @@
+<template>
+<view class="app-content">
+  <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"></image>
+                <view class="item-info">
+                  <view class="info-line">
+                    <text class="item-name">{{ item.name }}</text>
+                    <text class="item-price">
+                      <text class="unit"></text>
+                      <text class="price">
+                        <text>{{`${item.bigCount}`}}</text>
+                      </text>
+                    </text>
+                  </view>
+                  <view class="info-line">
+                    <text class="item-type"></text>
+                    <text class="item-count">
+                    </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 }}种 </view>
+            </view>
+          </view>
+        </view>
+        <view class="module-com input-line-wrap">
+          <tui-list-cell class="line-cell" :hover="false" :arrow="false">
+            <view class="tui-title">备注</view>
+						<input type="text" v-model="form.remark" placeholder="选填"/>
+					</tui-list-cell>
+        </view>
+      </form>
+    </view>
+    <view class="under-bar">
+      <view class="price-view"></view>
+      <button class="admin-button-com blue middle" @click="confirmToSubmit">提交</button>
+    </view>
+  </view>
+</view>
+</template>
+<script>
+import TuiListCell from "@/components/plugin/list-cell";
+import productMins from "@/mixins/cgPlantProduct";
+import { wastage } from "@/api/order/index";
+import { mapActions, mapGetters } from "vuex";
+export default {
+  name: "plantConfirm",
+  components: {
+    TuiListCell
+  },
+  mixins: [productMins],
+  data () {
+    return {
+      selectJobType: "cgPlant",
+      form: { remark:"" }
+    };
+  },
+  onLoad (option) {
+
+  },
+	onShow(){
+	},
+	onUnload(){
+
+	},
+  computed: {
+    ...mapGetters(["getLoginInfo"]),
+  },
+  methods: {
+    init () {
+      
+    },
+    confirmToSubmit () {
+      let that = this
+      let product = this.selectList.map((ele) => {
+        return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount, classId: ele.classId, itemId: ele.itemId }
+      })
+      that.$util.confirmModal({content:'确认报损?'},() => {
+          wastage({product:JSON.stringify(product),remark:that.form.remark}).then((res) => {
+            //删除记忆
+            that.removeFromSaveDirect()
+            that.pageTo({url: '/admin/breakage/result',type:2})
+          });
+      })
+    },
+    gobackEvent () {
+      this.pageTo({url: '/admin/goodsManage/plant',type:2})
+    },
+  },
+};
+</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;
+    margin-bottom:90upx;
+    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: 1upx 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: 1upx solid #dcdcdc;
+							border-radius: 10upx;
+							font-size: 28upx;
+							font-weight: 700;
+							&.active{
+								color: #ff4d4d;
+								border: 1upx solid #ff4d4d;
+							}
+						}
+					}
+      .member-wrap {
+        .member-det {
+          font-size: 24upx;
+          margin-left: 20upx;
+        }
+      }
+      .remark-wrap {
+        align-items: flex-start;
+        .remark {
+          height: 240upx;
+        }
+      }
+    }
+  }
+  .under-bar {
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+    padding: 0 20upx;
+    position: fixed;
+    bottom:0;
+    /* 手机mobile屏幕小于1000px */
+    @media screen and (max-width: 1100px) {
+      width: 100%;
+    }
+    /* 收银台cashier屏幕大于1000px */
+    @media screen and (min-width:1100px) {
+      width: 40%;
+    } 
+    height: 100upx;
+    background-color: #fff;
+
+    box-shadow: 0upx -1upx 6upx 0upx 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>

+ 70 - 0
hdApp/src/admin/goodsManage/plantResult.vue

@@ -0,0 +1,70 @@
+<template>
+	<view class="app-content">
+		<view class="billing_box_bg">
+			<view class="top-view"> </view>
+			<view class="result-view">
+				<view class="iconfont iconchenggong"></view>
+				<view class="result-title">报损成功</view>
+				<button class="admin-button-com big blue" style="width:45vh;" @click="goBackHome">返回首页</button>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+    name: "success",
+	methods: {
+		goBackHome() {
+			uni.navigateBack({})
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.go-back{
+	width: 80%;
+	height: 80upx;
+	color: #FFFFFF;
+	margin-top: 50upx;
+	background: #3385FF;
+	border-radius: 10upx;
+	font-size:30upx;
+}
+.billing_box_bg {
+	position: relative;
+	padding: 60upx 30upx;
+	display: flex;
+	background: white;
+	flex-direction: column;
+    background-color: #f5f5f5;
+	.top-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		width: 100%;
+		height: 299upx;
+		background: #3385ff;
+		border-radius: 0upx 0upx 83upx 83upx;
+	}
+	.result-view {
+		position: relative;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		padding: 70upx;
+		width: 100%;
+		background: #ffffff;
+		border-radius: 20upx;
+		z-index: 1;
+		.iconchenggong {
+			font-size: 170upx;
+			color: $mainColor1;
+		}
+		.result-title {
+			margin: 50upx 0 70upx;
+			font-size: 32upx;
+		}
+	}
+}
+</style>

+ 113 - 0
hdApp/src/components/module/app-footer-cg-plant-cart.vue

@@ -0,0 +1,113 @@
+<template>
+	<div class="cart-ft_bx">
+		<div class="cart-ct_bx">
+			<view class="cart-lf_bx">
+				<view class="cart-dot_bx">
+					<i class="iconfont icongouwuche"></i>
+				</view>
+				<view class="price" v-if="!offPrice">
+					<text>数量 {{count.bigLength}}</text>
+					<text style="margin-left:20upx;">¥{{ price }}</text>
+				</view>
+			</view>
+			<view class="cart-rg_bx" @click="confirmEvent"> 选好了 </view>
+		</div>
+	</div>
+</template>
+<script>
+export default {
+	name: "FooterCart",
+	props: {
+		offPrice:{
+			type: Boolean,
+			default: false
+		},
+		price: {
+			type: Number,
+			default: 0
+		},
+		countNumber: {
+			type: Number,
+			default: 0
+		},
+		count: {
+			type: Object,
+			default: {}
+		}
+	},
+	methods: {
+		confirmEvent() {
+			this.$emit("confirm");
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.cart-ft_bx {
+	width: 702upx;
+	height: 88upx;
+	background-color: #444444;
+	position: fixed;
+	bottom: 15upx;
+	border-radius: 50upx;
+	left: 50%;
+	transform: translate(-50%, 0);
+	z-index: 200;
+	overflow: hidden;
+	& .cart-ct_bx {
+		display: flex;
+		align-items: center;
+		height: 100%;
+		& .cart-lf_bx {
+			flex: 1;
+			display: flex;
+			align-items: center;
+			& .cart-dot_bx {
+				position: relative;
+				width: 72upx;
+				height: 72upx;
+				border-radius: 50%;
+				background-color: #3385ff;
+				text-align: center;
+				line-height: 72upx;
+				margin-left: 6upx;
+				.iconfont {
+					font-size: 40upx;
+					color: #fff;
+				}
+				.count {
+					position: absolute;
+					display: flex;
+					justify-content: center;
+					align-items: center;
+					height: 30upx;
+					padding: 0 10upx;
+					right: 0;
+					top: 0;
+					transform: translateX(50%);
+					color: #fff;
+					background-color: red;
+					border-radius: 10upx;
+					font-size: 24upx;
+				}
+			}
+			& .price {
+				font-weight: 500;
+				color: #ffffff;
+				font-size: 36upx;
+				padding-left: 24upx;
+			}
+		}
+		& .cart-rg_bx {
+			height: 100%;
+			width: 200upx;
+			text-align: center;
+			font-size: 28upx;
+			color: #ffffff;
+			background-color: #3385ff;
+			line-height: 88upx;
+		}
+	}
+}
+</style>

+ 456 - 0
hdApp/src/mixins/cgPlantProduct.js

@@ -0,0 +1,456 @@
+import { getProductDataApi } from "@/api/product/index";
+import { mapGetters, mapActions } from "vuex";
+import { copyObject } from "@/utils/util";
+export default {
+	data() {
+		return {
+			selectJobType: "bill",//业务类型,开单、采购、报损、盘点
+			selectJobId:0,//业务类型对应的主体ID等
+			isCut:false,
+			productInfoList: [], //商品信息
+			classIndex: 0, //当前商品类别下标
+			py: "", //拼音搜索条件
+			type: "", //库存预警时,固定为waring,其他情况不传或者传空
+			autoLoad: true, //自动获取商品信息
+			allFilterProductInfo:'',
+			globalClassItemList:'',
+			top_list:'',
+			//id动态切换
+			scroll_into_view:"",
+			timeFun:"",
+			kdType:'HIT',//点击和扫码开单,HIT SCAN
+			checkStock:true,// 考虑库存,盘点不需要考虑库存
+			isAddModel:false,
+			isAddInputFocus:false,
+			customData: { bigCount: 0, smallCount: 0, userPrice: 0 },
+			globalItemList:[],
+			//当前页面默认使用的单位 0大单位 1小单位
+			globalUnitType:0
+		};
+	},
+	onLoad(options) {
+		const { selectJobType } = options;
+		if (selectJobType) {
+			this.selectJobType = selectJobType;
+		}
+	},
+	onUnload() {},
+	computed: {
+		...mapGetters(["getSelectInfo"]),
+		//当前页面选中的商品列表
+		selectList() {
+			let selectInfo = this.getSelectInfo;
+			let currentList = selectInfo[this.selectJobType+'_'+this.selectJobId] || []
+
+			let has = [];
+			if (!this.$util.isEmpty(currentList)){
+				currentList.forEach((currentItem,currentIndex,currentArray)=>{
+				let id = currentItem.id
+				has[id]= currentItem
+			  })
+			}
+			if (this.list && this.list.data && !this.$util.isEmpty(this.list.data)){
+				this.list.data.forEach((currentItem,currentIndex,currentArray)=>{
+				let id = currentItem.id
+				if(has[id]){
+					currentItem.bigCount = has[id].bigCount || 0 
+					currentItem.userPrice = has[id].userPrice || 0
+				}
+			  })
+			  this.$forceUpdate()
+			}
+
+			return currentList
+		},
+		scrollClassId() {
+			const curClass = this.productInfoList[this.classIndex];
+			if (curClass) {
+				return `class_${curClass.classId}`;
+			}
+			return "";
+		},
+		allPrice() {
+			let price = 0;
+			if (this.selectList) {
+				for (const item of this.selectList) {
+					const itemInfo = this.getSelectItemById(item.id, item.classId)
+					price += Number(item.bigCount) * Number(itemInfo.userPrice)
+				}
+			}
+			return Math.round(price * 100) / 100;
+		},
+		//选择商品总数
+		allCount() {
+			let bigLength = 0;
+			let smallLength = 0;
+			if (this.selectList) {
+				for (const item of this.selectList) {
+					bigLength += Number(item.bigCount)
+					smallLength += Number(item.smallCount)
+				}
+			}
+			return {bigLength:bigLength,smallLength:smallLength,};
+		},
+		//当前选中商品列表中是否有没有库存的商品
+		hasNoStock() {
+			let has = false;
+			if (this.selectList) {
+				for (const item of this.selectList) {
+					const { bigCount, smallCount, bigNum, bigUnit, smallNum, smallUnit, ratio } = item
+					const ratioNum = Number(ratio)
+					if ( Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum) ) {
+						has = true;
+						break;
+					}
+				}
+			}
+			return has;
+		}
+	},
+	onShow(){
+
+	},
+	methods: {
+		...mapActions(["setSelectInfo", "reSetSelectInfo"]),
+		init(){
+			this.initData();
+		},
+		//放到仓库
+		pushToSave(selectData){
+			this.setSelectInfo({ selectJobType: this.selectJobType, info: selectData,selectJobId:this.selectJobId })
+			uni.setStorageSync('selectList_'+this.selectJobType+'_target_'+this.selectJobId, selectData)
+		},
+		//询问是否删除缓存
+		removeFromSave(){
+			let that = this
+			that.$util.confirmModal({content:'确认清除花材?'},() => {
+				that.removeFromSaveDirect()
+				that.$msg('已清除')
+            })
+		},
+		//直接删除缓存
+		removeFromSaveDirect(){
+			let that = this
+
+			uni.removeStorageSync('selectList_'+that.selectJobType+'_target_'+that.selectJobId)
+			that.reSetSelectInfo({selectJobType:that.selectJobType,selectJobId:that.selectJobId})
+
+			if(!this.$util.isEmpty(this.globalClassItemList)){
+				this.globalClassItemList.forEach((item,index,arr) =>{
+					if(!this.$util.isEmpty(arr[index].child)){
+						arr[index].child.forEach((ele,i,son)=>{
+							arr[index].child[i].bigCount = 0;
+							arr[index].child[i].smallCount = 0;
+							arr[index].child[i].userPrice = 0;
+						})
+					}
+				})
+				this.$forceUpdate()
+			}
+		},
+		//请求商品数据
+		async initData(extendInfo) {
+
+			let currentInfo = uni.getStorageSync('selectList_'+this.selectJobType+'_target_'+this.selectJobId)
+			if(!this.$util.isEmpty(currentInfo)){
+				currentInfo.forEach((currentItem,currentIndex,currentArray)=>{
+					let currentId = currentItem.id
+					if(this.globalItemList[currentId]){
+						currentArray[currentIndex].bigPrice = this.globalItemList[currentId].bigPrice
+						currentArray[currentIndex].smallPrice = this.globalItemList[currentId].smallPrice
+					}
+				})
+				this.setSelectInfo({ selectJobType: this.selectJobType, info: currentInfo,selectJobId:this.selectJobId })
+			}
+
+		},
+		//滚动或切换分类 获取更多数据
+		scrollPushList(){
+
+			//涉及记住花材的代码和流程,请全项目搜索关键词remember_item
+			//将已选的花材按classId_productId键名组合
+			let selectListData = []
+			if(!this.$util.isEmpty(this.selectList)){
+				this.selectList.forEach((i)=>{
+					selectListData[i.id] = i
+				})
+			}
+
+			let list = copyObject(this.productInfoList);
+			let classList = [];
+			for (let i=0;i<list.length;i++){
+
+				//将已选的花材数量和价格组合到总列表里
+				if(!this.$util.isEmpty(list[i].child)){
+					let currentChildren = list[i].child
+					for(let x=0;x<currentChildren.length;x++){
+						let currentProduct = currentChildren[x]
+						let currentPId = currentProduct.id
+						let selectProduct = selectListData[currentPId] || []
+						if(!this.$util.isEmpty(selectProduct)){
+							list[i].child[x].bigCount = selectProduct.bigCount || 0
+							list[i].child[x].userPrice = selectProduct.userPrice || 0
+							list[i].child[x].smallCount = selectProduct.smallCount || 0
+						}else{
+							list[i].child[x].bigCount = 0
+							list[i].child[x].userPrice = 0
+							list[i].child[x].smallCount = 0
+						}
+					}
+				}
+
+				if(i<2){
+					classList.push({...list[i],isActive:true});
+				}else{
+					classList.push({...list[i],isActive:false});
+				}
+			}
+			this.globalClassItemList = classList
+		},
+		//搜索对应花材
+		searchFn() {
+			let list = this.globalItemList
+			if(this.$util.isEmpty(this.py)){
+				this.globalClassItemList = '';
+				this.classIndex = 0;
+				this.scroll_into_view = 'class_'+0;
+				this.scrollPushList();
+				return
+			}
+
+			//大于等于2个字符才开始搜索 shish 20210622
+			if(this.py.length <=1){
+				return
+			}
+			//红色粉色花材太多,搜索时会卡住,所以设置输入第三个字母时才搜索
+			if(this.py.indexOf('fs') == 0 && this.py.length <= 2){
+				return
+			}
+			if(this.py.indexOf('hs') == 0 && this.py.length <= 2){
+				return
+			}
+			if(this.py.indexOf('zs') == 0 && this.py.length <= 2){
+				return
+			}
+			if(this.py.indexOf('ls') == 0 && this.py.length <= 2){
+				return
+			}
+			if(this.py.indexOf('bs') == 0 && this.py.length <= 2){
+				return
+			}
+			if(this.py.indexOf('yj') == 0 && this.py.length <= 2){
+				return
+			}
+			//涉及记住花材的代码和流程,请全项目搜索关键词remember_item
+			//将已选的花材按productId键名组合
+			let selectListData = []
+			if(!this.$util.isEmpty(this.selectList)){
+				this.selectList.forEach((i)=>{
+					selectListData[i.id] = i
+				})
+			}
+
+			let filterItemData = [];
+			list.forEach(currentItem => {
+
+				//组合已记忆已选择的花材
+				let currentPId = currentItem.id
+				let selectProduct = selectListData[currentPId] || []
+				if(!this.$util.isEmpty(selectProduct)){
+					currentItem.bigCount = selectProduct.bigCount || 0
+					currentItem.userPrice = selectProduct.userPrice || 0
+					currentItem.smallCount = selectProduct.smallCount || 0
+				}else{
+					currentItem.bigCount = 0
+					currentItem.userPrice = 0
+					currentItem.smallCount = 0
+				}
+				let elePy = (currentItem.py && currentItem.py.toLocaleUpperCase()) || "";
+				let hasPy = elePy.indexOf(this.py.toLocaleUpperCase()) >= 0;
+				if (hasPy) {
+					if(this.$util.isEmpty(filterItemData)){
+						filterItemData = [{classId: currentItem.classId, className: currentItem.className,isActive:true,child:[currentItem]}]
+					}else{
+						filterItemData.forEach(res => {
+							if(res.classId==currentItem.classId){
+								res.child.push(currentItem)
+							}else{
+								filterItemData.push({classId: currentItem.classId, className: currentItem.className,isActive:true,child:[currentItem]})
+							}
+						})
+					}
+				}
+
+			})
+
+			let searchList = this.$util.unique(filterItemData)
+			this.globalClassItemList = searchList;
+			this.classIndex = 0;
+			this.scroll_into_view = 'class_'+0;
+		},
+		//获取当前选中商品总价
+		getSelectItemPrice(item) {
+			let price = 0;
+			const { bigCount, smallCount, bigPrice, smallPrice } = item;
+			let sum =
+				Number(bigCount) * Number(bigPrice) +
+				Number(smallCount) * Number(smallPrice);
+			price = Math.round(sum * 100) / 100;
+			return price;
+		},
+		//通过id获取当前选中的商品信息
+		getSelectItemById(id, classId) {
+			let info = { bigCount: null, smallCount: null, autoPrice: null, itemPrice: null }
+			const item = this.selectList && this.selectList.find(ele => { return ele.id == id && ele.classId == classId })
+			if (item) {
+				info = { ...item, bigCount: Number(item.bigCount), smallCount: Number(item.smallCount), autoPrice: Number(item.autoPrice), itemPrice: Number(item.itemPrice)}
+			}
+			return info;
+		},
+		//添加删除和修改花材
+		//multiple 0单个加减 1弹框方式多个加减
+		//calc 当multiple=0时,add表示加,sub表示减
+		replaceItemFn(product,multiple=0,calc='add') {
+			let item = copyObject(product)
+			if(multiple == 0){
+				if(Number(item.smallCount)>0){
+					if(calc == 'add'){
+						item.smallCount++
+					}
+					if(calc == 'sub'){
+						item.smallCount--
+					}
+				}else{
+					if(calc == 'add'){
+						item.bigCount++
+					}
+					if(calc == 'sub'){
+						item.bigCount--
+					}					
+				}
+			}
+			console.log('........replace_item......')
+			console.log(item)
+			const list = this.selectList
+			if(this.checkStock){
+				if ((Number(item.bigCount) * item.ratio + Number(item.smallCount)) > (Number(item.bigNum) * item.ratio + Number(item.smallNum))) {
+					this.$util.noStockRemind()
+					this.$msg("库存不足哦")
+					return
+				}
+			}
+			let index = list.findIndex(element => element.id == item.id)
+			if(index == -1){
+				if(this.$util.isEmpty(item.userPrice) || Number(item.userPrice) == 0){
+					item.userPrice = item.bigPrice
+				}
+				list.push(item)			
+			}else{
+				if(item.bigCount <= 0 && item.smallCount <= 0){
+					//删除花材
+					list.splice(index,1)
+				}else{
+					list[index].bigCount = item.bigCount
+					list[index].smallCount = item.smallCount
+					list[index].userPrice = item.userPrice
+				}
+			}
+
+			if(this.kdType == 'HIT' && multiple ==0){
+				this.$util.hitRemind()
+			}
+
+			//数据放到仓库永久存放
+			this.pushToSave(list)
+
+		},
+		//大小单位切换
+		switchGlobalUnitType(){
+			if(this.globalUnitType == 0){
+				this.globalUnitType = 1
+				this.customData.userPrice = parseFloat(this.customData.smallPrice)
+				this.customData.bigCount = null
+			}else{
+				this.globalUnitType = 0
+				this.customData.userPrice = parseFloat(this.customData.bigPrice)
+				this.customData.smallCount = null
+			}
+		},
+		//显示可以修改花材的弹框
+		showAddModelFn(info) {
+			if(info.bigNum <= 0 && info.smallNum <= 0){
+				if(this.checkStock){
+					this.$util.noStockRemind()
+					this.$msg('库存不足哦..')
+					return false
+				}
+			}
+
+			//弹框时默认显示的单位
+			if(Number(info.smallCount>0)){
+				this.globalUnitType = 1
+			}else{
+				this.globalUnitType = 0
+			}
+
+			this.isAddModel = true;
+			this.customData = copyObject(info)
+			this.isAddInputFocus = false;
+			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.customData.userPrice == null || this.customData.userPrice == 0){
+						this.customData.userPrice =	this.customData.bigPrice;
+					}
+				}else{
+					this.customData.userPrice = this.customData.userPrice==0?null:this.customData.userPrice;
+				}
+				this.isAddInputFocus = true;
+			})
+		},
+		confirmAddItemModel(val) {
+			if (val.index === 0) {
+				this.addItemModelHidden();
+				return false
+			}
+
+			//二个都不是数值
+			if(/(^[1-9]\d*$)/.test(this.customData.bigCount) == false && /(^[1-9]\d*$)/.test(this.customData.smallCount) == false){
+				uni.showToast({title:"请填写数值",icon:"none"})
+				return;
+			}
+
+			if(/(^[1-9]\d*$)/.test(this.customData.bigCount)){
+				if(this.customData.bigCount<=0){
+					uni.showToast({title:"数量要大于0",icon:"none"})
+					return;
+				}
+			}
+
+			if(/(^[1-9]\d*$)/.test(this.customData.smallCount)){
+				if(this.customData.smallCount<=0){
+					uni.showToast({title:"数量要大于0",icon:"none"})
+					return;
+				}
+			}
+			//开单、采购花材 采购盆栽绿植需要使用价格
+			if(this.selectJobType == 'bill' || this.selectJobType == 'purchase' || this.selectJobType == 'cgPlant'){
+				if(/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(this.customData.userPrice) == false){
+					uni.showToast({title:"金额错误",icon:"none"})
+					return;
+				}
+				if(this.customData.userPrice <=0){
+					uni.showToast({title:"金额要大于0",icon:"none"})
+					return;
+				}
+			}
+			this.replaceItemFn(this.customData,1)
+			this.addItemModelHidden()			
+		},
+		addItemModelHidden() {
+			this.isAddModel = false;
+			this.customData = {};
+		}
+	}
+}

+ 3 - 1
hdApp/src/pages.json

@@ -185,7 +185,9 @@
 				{ "path": "goods-name", "style": { "navigationBarTitleText": "填写商品信息" } },
 				{ "path": "freight", "style": { "navigationBarTitleText": "运费设置" } },
 				{ "path": "price-increase", "style": { "navigationBarTitleText": "节日自动涨价" } },
-				{ "path": "plant", "style": { "navigationBarTitleText": "盆栽绿植资材" } }
+				{ "path": "plant", "style": { "navigationBarTitleText": "盆栽绿植资材" } },
+				{ "path": "plantConfirm", "style": { "navigationBarTitleText": "确认采购" } },
+				{ "path": "plantResult", "style": { "navigationBarTitleText": "结果" } }
 			]
 		},
 		{