XSLu08042 1 settimana fa
parent
commit
1cff79aac1
1 ha cambiato i file con 32 aggiunte e 8 eliminazioni
  1. 32 8
      pages_store/storeIndex.vue

+ 32 - 8
pages_store/storeIndex.vue

@@ -51,9 +51,9 @@
 					<view 
 						v-for="(item,index) in cates" 
 						:key="index" 
-						:class="cateSelect == item.cateId?'item active':'item'" 
+						:class="cateSelect == item.dictValue?'item active':'item'" 
 						@click="choseCate(item)"
-					>{{item.cateName }}</view>
+					>{{item.dictLabel }}</view>
 				</view>
 				<view class="medic">
 					<mescroll-body :top="mescrollTop+'px'" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
@@ -85,6 +85,7 @@
 </template>
 
 <script>
+	import {getDicts} from '@/api/common.js'
 	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	import tuiStoreProduct from './components/tuiStoreProduct.vue'
 	import qualifications from './components/qualifications.vue'
@@ -169,7 +170,8 @@
 					storeId: "",
 					cateId:'',
 					pid:'',
-					storeId: ''
+					storeId: '',
+					productType:''
 				},
 				mescrollTop: 200,
 				evaluate: [],
@@ -187,7 +189,7 @@
 				//小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
 				menus:["shareAppMessage","shareTimeline"] //不设置默认发送给朋友
 			})
-			this.getProductCate();
+			this.getProductType();
 			this.getStoreInfo();
 			this.getCommentByUser();
 		},
@@ -344,13 +346,35 @@
 					rej => {}
 				);
 			},
+			getProductType(){
+				let data = {};
+				getDicts(data).then(
+					res => {
+						if(res.code==200){
+							uni.setStorageSync('dicts', JSON.stringify(res));
+							const key = 'storeProductType'
+							let dict=Array.isArray(key) ? key : res[key];
+							this.cates=dict;
+							if(this.cates!=null&&this.cates.length>0){
+								this.cateSelect=this.cates[0].dictValue;
+								this.form.productType = this.cates[0].dictValue;
+								this.mescroll.resetUpScroll()
+							}
+						}else{
+							uni.showToast({
+								icon:'none',
+								title: "请求失败",
+							});
+						}
+					},
+					rej => {}
+				);
+			},
 			// 药品分类选择
 			choseCate(item) {
-				this.cateSelect = item.cateId;
-				// this.getSubCate()
-				this.form.cateId = item.cateId;
+				this.cateSelect = item.dictValue;
+				this.form.productType = item.dictValue;
 				this.mescroll.resetUpScroll()
-				
 			},
 			getSubCate(){
 				var that=this;