Commit f0cf57997c2438808bb572407021a3e3a18ee0fb

Authored by BigBoss
Exists in master

合并冲突

... ... @@ -7,13 +7,13 @@
7 7 onLaunch(options) {
8 8 const option = options || {};
9 9 // 获取用户来源
10   - console.log('软件启动,输出转来的参数:', option);
11   - console.log('场景值------------------:', option.scene);
  10 + // console.log('软件启动,输出转来的参数:', option);
  11 + // console.log('场景值------------------:', option.scene);
12 12 let loginQueryInfo = option ? option.query : {};
13 13 loginQueryInfo = loginQueryInfo || {};
14   - console.log('loginQueryInfo onShow===>', loginQueryInfo);
  14 + // console.log('loginQueryInfo onShow===>', loginQueryInfo);
15 15 const scene = decodeURIComponent(loginQueryInfo.scene);
16   - console.log('decodeURIComponent scense====>', scene);
  16 + // console.log('decodeURIComponent scense====>', scene);
17 17 let fromInfo = {};
18 18  
19 19 if(scene.length > 0 ) {
... ... @@ -35,9 +35,9 @@
35 35 scene: option.scene,
36 36 }
37 37 store.dispatch('user/setFrom', fromInfo);
38   - console.log('loginQueryInfo.hasOwnProperty=====111===>', getQueryString);
  38 + // console.log('loginQueryInfo.hasOwnProperty=====111===>', getQueryString);
39 39 } else {
40   - console.log('loginQueryInfo.hasOwnProperty====22222====>', loginQueryInfo);
  40 + // console.log('loginQueryInfo.hasOwnProperty====22222====>', loginQueryInfo);
41 41 if (loginQueryInfo.hasOwnProperty('sid') == false) {
42 42 loginQueryInfo.sid = 0;
43 43 }
... ... @@ -67,11 +67,10 @@
67 67 }
68 68 },
69 69 onShow() {
70   -
71   - console.log('App Show')
  70 + // console.log('App Show')
72 71 },
73 72 onHide() {
74   - console.log('App Hide')
  73 + // console.log('App Hide')
75 74 },
76 75 methods: {
77 76 }
... ...
src/components/CommodityCard/CommodityCard.vue
1 1 <template>
2   - <view class="card" @tap="toGoods(goods.id,goods.goodType)">
3   - <image mode="widthFix" :src="goods.imgurl" ></image>
4   - <view class="name">{{goods.name}}</view>
  2 + <view class="card" @tap="toGoods(goods.id?goods.id:goods.pid,goods.goodType?goods.goodType:goods.p_root_index)">
  3 + <image mode="widthFix" :src="goods.imgurl?goods.imgurl:goods.pic" ></image>
  4 + <view class="name">{{goods.name?goods.name:goods.p_name}}</view>
5 5 <view class="info">
6 6 <view class="priceBox">
7   - <view class="price">{{goods.price}}</view>
  7 + <view class="price">{{goods.price?goods.price:goods.real_price}}</view>
8 8 <view class="originCost">
9   - {{goods.rsSon.Max_Price}}
  9 + {{goods.rsSon.Max_Price?goods.rsSon.Max_Price:goods.old_price}}
10 10 </view>
11 11 </view>
12 12 <view class="trade_num">{{goods.trade_num}}人购买</view>
... ...
src/components/HMFilterDropdown/HMFilterDropdown.vue
... ... @@ -2,9 +2,25 @@
2 2 <view class="HMfilterDropdown" @touchmove.stop.prevent="discard" @tap.stop="discard">
3 3 <view class="nav">
4 4 <block v-for="(item,index) in menu" :key="index">
5   - <view class="first-menu" :class="{'on':showPage==index}" @tap="togglePage(index)">
  5 + <view
  6 + class="first-menu"
  7 + :class="{'on':showPage==index || on[index] === 1}"
  8 + @tap="togglePage(index)"
  9 + v-if="!item.isNoPull"
  10 + >
  11 + <text class="name">{{item.name}}</text>
  12 + <text
  13 + class="iconfont triangle"
  14 + :style="'transform:rotate('+triangleDeg[index]+'deg);'"
  15 + ></text>
  16 + </view>
  17 + <view
  18 + class="first-menu"
  19 + :class="{'on':showPage==index || on[index] === 1}"
  20 + @tap="showAll()"
  21 + v-else
  22 + >
6 23 <text class="name">{{item.name}}</text>
7   - <text class="iconfont triangle" :style="'transform:rotate('+triangleDeg[index]+'deg);'"></text>
8 24 </view>
9 25 </block>
10 26 </view>
... ... @@ -101,7 +117,8 @@
101 117 firstScrollInto: 0,
102 118 secondScrollInto: 0,
103 119 componentTop:0 ,//组件top
104   - isReadNewSelect:false
  120 + isReadNewSelect:false,
  121 + on: [1,0,0,0,0],
105 122 }
106 123 },
107 124 props: {
... ... @@ -136,9 +153,9 @@
136 153 this.defaultActive = JSON.parse(JSON.stringify(newVal));
137 154 this.activeMenuArr = JSON.parse(JSON.stringify(newVal));
138 155 this.shadowActiveMenuArr = JSON.parse(JSON.stringify(newVal));
139   - if(this.updateMenuName){
140   - this.setMenuName();
141   - }
  156 + // if(this.updateMenuName){
  157 + // this.setMenuName();
  158 + // }
142 159 }
143 160 },
144 161 methods: {
... ... @@ -150,53 +167,54 @@
150 167 tmpMenu.push({
151 168 //如果没有设置name,则取第一个菜单作为menu.name,filter类型则将"筛选"作为menu.name
152 169 name: tmpitem.name || (tmpitem.type == "filter" ? "筛选" : tmpitem.submenu[0].name),
153   - type: tmpitem.type
  170 + type: tmpitem.type,
  171 + isNoPull: tmpitem.isNoPull,
154 172 });
155   - //初始化选中项数组-ui状态
  173 + // 初始化选中项数组-ui状态
156 174 tmpMenuActiveArr.push(this.processActive(tmpitem));
157   - //初始化角度数组
  175 + // 初始化角度数组
158 176 this.triangleDeg.push(0);
159   - //初始化控制显示状态数组
  177 + // 初始化控制显示状态数组
160 178 this.pageState.push(false);
161   - //递归处理子菜单数据
  179 + // 递归处理子菜单数据
162 180 tmpitem = this.processSubMenu(tmpitem);
163 181 this.filterData[i] = tmpitem;
164 182 }
165 183 this.menu = tmpMenu;
166   - //初始化选中项数组
  184 + // 初始化选中项数组
167 185 tmpMenuActiveArr = this.defaultActive.length>0?this.defaultActive:this.activeMenuArr.length>0?this.activeMenuArr:tmpMenuActiveArr;
168 186 this.defaultActive = [];
169 187 this.activeMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr));
170 188 this.shadowActiveMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr));
171   - //加载菜单数据
  189 + // 加载菜单数据
172 190 this.subData = this.filterData;
173   - //设定顶部菜单名字
174   - if(this.updateMenuName){
175   - this.setMenuName();
176   - }
177   - },
178   - setMenuName(){
179   - for(var i=0;i<this.activeMenuArr.length;i++){
180   - let row = this.activeMenuArr[i];
181   - if (typeof(row[0]) != 'object'){
182   - var tmpsub = false;
183   - if(row.length>0 && row[0]!=null){
184   - tmpsub = this.subData[i].submenu[row[0]];
185   - if(row.length>1 && row[1]!=null){
186   - tmpsub = tmpsub.submenu[row[1]];
187   - if(row.length>2 && row[2]!=null){
188   - tmpsub = tmpsub.submenu[row[2]];
189   - }
190   - }
191   - }else{
192   - tmpsub = false;
193   - }
194   - if(tmpsub){
195   - this.menu[i].name = tmpsub.name;
196   - }
197   - }
198   - }
  191 + // 设定顶部菜单名字
  192 + // if(this.updateMenuName){
  193 + // this.setMenuName();
  194 + // }
199 195 },
  196 + // setMenuName(){
  197 + // for(var i=0;i<this.activeMenuArr.length;i++){
  198 + // let row = this.activeMenuArr[i];
  199 + // if (typeof(row[0]) != 'object'){
  200 + // var tmpsub = false;
  201 + // if(row.length>0 && row[0]!=null){
  202 + // tmpsub = this.subData[i].submenu[row[0]];
  203 + // if(row.length>1 && row[1]!=null){
  204 + // tmpsub = tmpsub.submenu[row[1]];
  205 + // if(row.length>2 && row[2]!=null){
  206 + // tmpsub = tmpsub.submenu[row[2]];
  207 + // }
  208 + // }
  209 + // }else{
  210 + // tmpsub = false;
  211 + // }
  212 + // if(tmpsub){
  213 + // this.menu[i].name = tmpsub.name;
  214 + // }
  215 + // }
  216 + // }
  217 + // },
200 218 //展开更多
201 219 showMoreSub(index) {
202 220 this.subData[this.showPage].submenu[this.activeMenuArr[this.showPage][0]].submenu[index].showAllSub = true;
... ... @@ -217,9 +235,9 @@
217 235 if (level3_index != null || level2_index != null || (level1_index != null && this.subData[page_index].submenu[level1_index].submenu.length == 0)
218 236 ) {
219 237 let sub = this.subData[page_index].submenu[level1_index].submenu[level2_index];
220   - if(this.updateMenuName){
221   - this.menu[page_index].name = (level3_index != null && sub.submenu[level3_index].name) || (level2_index != null && sub.name) || this.subData[page_index].submenu[level1_index].name;
222   - }
  238 + // if(this.updateMenuName){
  239 + // this.menu[page_index].name = (level3_index != null && sub.submenu[level3_index].name) || (level2_index != null && sub.name) || this.subData[page_index].submenu[level1_index].name;
  240 + // }
223 241 this.shadowActiveMenuArr[page_index] = JSON.parse(JSON.stringify(this.activeMenuArr[page_index]));
224 242 this.togglePage(this.showPage);
225 243 }
... ... @@ -286,6 +304,19 @@
286 304 this.showPageLayer(index);
287 305 this.showMask();
288 306 }
  307 + if(this.on[0] === 1) {
  308 + this.on[0] = 0;
  309 + }
  310 + this.on[index] = 1;
  311 + },
  312 + showAll() {
  313 + this.on = [1,0,0,0,0]
  314 + // 输出
  315 + this.$emit('search', {
  316 + index: {},
  317 + value: {},
  318 + on: this.on,
  319 + });
289 320 },
290 321 //hide遮罩层
291 322 hideMask() {
... ... @@ -343,8 +374,7 @@
343 374 });
344 375 }else{
345 376 let submenu = this.subData[i].submenu[item[0]];
346   - // console.log(this.subData[i])
347   - value[i][0] = submenu.value;
  377 + value[i][0] = submenu && submenu.value;
348 378 if(value[i].length>=2 && item[1]!=null){
349 379 if(submenu.submenu.length>0){
350 380 submenu = submenu.submenu[item[1]];
... ... @@ -366,9 +396,10 @@
366 396  
367 397 });
368 398 // 输出
369   - this.$emit('confirm', {
  399 + this.$emit('search', {
370 400 index: index,
371   - value: value
  401 + value: value,
  402 + on: this.on,
372 403 });
373 404 },
374 405 //show菜单页
... ... @@ -515,13 +546,12 @@
515 546 .nav {
516 547 width: 100%;
517 548 height: 44px;
518   - border-bottom: solid 1rpx #eee;
519 549 z-index: 12;
520 550 background-color: #ffffff;
521 551 flex-direction: row;
522 552 .first-menu {
523 553 width: 100%;
524   - font-size: 13px;
  554 + font-size: 16px;
525 555 color: #333333;
526 556 flex-direction: row;
527 557 align-items: center;
... ... @@ -537,6 +567,7 @@
537 567 }
538 568 .name {
539 569 height: 20px;
  570 + // font-size: 16px;
540 571 text-align: center;
541 572 text-overflow: clip;
542 573 overflow: hidden;
... ... @@ -544,6 +575,7 @@
544 575 .iconfont {
545 576 width: 13px;
546 577 height: 13px;
  578 + line-height: 16px;
547 579 align-items: center;
548 580 justify-content: center;
549 581 transition: transform .2s linear, color .2s linear;
... ... @@ -605,7 +637,7 @@
605 637 }
606 638 &.alone {
607 639 max-height: 345px;
608   - min-height: 170px;
  640 + min-height: 60rpx;
609 641 height: auto;
610 642 .sub-menu {
611 643 min-height: calc(44px - 1rpx);
... ... @@ -788,4 +820,4 @@
788 820 }
789 821 }
790 822 }
791   -</style>
  823 +</style>
... ...
src/components/UniSliper/UniSliper.vue
... ... @@ -167,7 +167,7 @@
167 167  
168 168 <style scoped lang="scss">
169 169 .c-progress {
170   - $width: 300px;
  170 + $width: 400rpx;
171 171 $radius: 5px;
172 172 display: flex;
173 173 align-items: center;
... ... @@ -187,9 +187,9 @@
187 187 align-items: center;
188 188  
189 189 .c-progress-inner {
190   - width: 100px;
  190 + width: 100rpx;
191 191 height: 10px;
192   - background: #409EFF;
  192 + background: #FF6B4A ;
193 193 }
194 194  
195 195 .c-progress-slider {
... ... @@ -197,7 +197,7 @@
197 197 height: 20px;
198 198 border-radius: 50%;
199 199 background: #fff;
200   - border: 1px solid #409EFF;
  200 + border: 1px solid #FF6B4A ;
201 201 position: absolute;
202 202 z-index: 10;
203 203 left: 10px;
... ...
src/pages/cart/cart.vue
1 1 <template>
2 2 <view class="content">
3   -
4   - <view class="card">
5   - <view class="cardHeader">
6   - <block v-if="pIsoPen">
7   - <view class="partentChecked" @click="pChange(pIsoPen)">
8   - <span class="status correct"></span>
9   - </view>
10   - </block>
11   - <block v-else>
12   - <view class="partentCheck" @click="pChange(pIsoPen)"></view>
13   - </block>
14   - <image src="../../static/store.png" mode="aspectFill"></image>
15   - <text>非常戴镜</text>
16   - </view>
  3 + <block v-if="cartList.length==0">
17 4  
18   - <view class="cardBody">
19   - <template v-if="childIsOpen.child1">
20   - <view class="partentChecked" @click="cChange(childIsOpen.child1,'child1')">
21   - <span class="status correct"></span>
  5 + </block>
  6 + <block v-else>
  7 + <view class="card">
  8 + <view class="cardHeader">
  9 + <view v-bind:class="pIsoPen? 'partentChecked' : 'partentCheck'"
  10 + @click="pChange(pIsoPen)">
  11 + <span class="correct"></span>
22 12 </view>
23   - </template>
24   - <template v-else>
25   - <view class="partentCheck" @click="cChange(childIsOpen.child1,'child1')"></view>
26   - </template>
27   - <view class="goodInfo">
28   - <view class="imageWrap">
29   - <image src="../../static/img/detail/d1.png" mode="aspectFill" style="width: 188rpx;height: 168rpx;"></image>
  13 + <image src="../../static/store.png" mode="aspectFill"></image>
  14 + <text>非常戴镜</text>
  15 + </view>
  16 +
  17 + <view class="cardBody" v-for="(item,index) in cartList" :key="item.cart_id"
  18 + @longpress="delCart(item.cart_id,index)">
  19 + <view v-bind:class="childIsOpen[index]? 'partentChecked':'partentCheck'"
  20 + @click="Change(childIsOpen[index],index)">
  21 + <span class="correct"></span>
30 22 </view>
31   - <view class="infoRight">
32   - <text class="goodName">眼镜名称眼镜名称眼镜名称眼镜名称</text>
33   - <view class="describ"><text>颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 … </text>
34   - <view class="icon"></view>
  23 + <view class="goodInfo">
  24 + <view class="imageWrap">
  25 + <image :src="item.img_index_url" mode="aspectFit" style="width: 188rpx;height: 168rpx;"></image>
35 26 </view>
36   - <view class="priceBox">
37   - <view class="price">¥{{198}}</view>
38   - <text>(限购{{maxCount}}副)</text>
39   - <view class="counter">
40   - <view class="btn" disabled="this.addDisabled" type="default" @click="counter(false)">-</view>
41   - <text>{{count}}</text>
42   - <view class="btn" disabled="this.desDisabled" type="default" @click="counter(true)">+</view>
  27 + <view class="infoRight">
  28 + <view class="goodName" @tap="toGoods(item.pid,item.p_root_index)">{{item.p_name}}</view>
  29 + <view class="describ" @tap="toshop(item.pid,item.p_root_index)">
  30 + <text>
  31 + <block v-for="tag in item.tag.prod_tag_fun" :key="tag.value">
  32 + {{tag.label+`&nbsp;&nbsp;`}}
  33 + </block>
  34 + </text>
  35 + <view class="icon"></view>
  36 + </view>
  37 + <view class="priceBox">
  38 + <view class="price">¥{{item.nowPrice*item.num}}</view>
  39 + <text>(限购{{maxCount}}副)</text>
  40 + <view class="counter">
  41 + <view class="btn" disabled="this.addDisabled" type="default"
  42 + @click="counter(index,false,item.mp_id,item.sk_id,item.num,item.cart_id)">-</view>
  43 + <text>{{item.num}}</text>
  44 + <view class="btn" disabled="this.desDisabled" type="default"
  45 + @click="counter(index,true,item.mp_id,item.sk_id,item.num,item.cart_id)">+</view>
  46 + </view>
43 47 </view>
44 48 </view>
45 49 </view>
46 50 </view>
47 51 </view>
48   - <view class="cardBody">
49   - <!-- <MyCheckbox :isOpenProp="controlCheck.child1"></MyCheckbox> -->
50   - <template v-if="childIsOpen.child2">
51   - <view class="partentChecked" @click="cChange(childIsOpen.child2,'child2')">
52   - <span class="status correct"></span>
53   - </view>
54   - </template>
55   - <template v-else>
56   - <view class="partentCheck" @click="cChange(childIsOpen.child2,'child2')"></view>
57   - </template>
58   - <view class="goodInfo">
59   - <view class="imageWrap">
60   - <image src="../../static/img/detail/d1.png" mode="aspectFill" style="width: 188rpx;height: 168rpx;"></image>
61   - </view>
62   - <view class="infoRight">
63   - <text class="goodName">眼镜名称眼镜名称眼镜名称眼镜名称</text>
64   - <view class="describ"><text>颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 … </text>
65   - <view class="icon"></view>
66   - </view>
67   - <view class="priceBox">
68   - <view class="price">¥198</view>
69   - <text>(限购{{maxCount}}副)</text>
70   - <view class="counter">
71   - <view class="btn" disabled="this.addDisabled" type="default" @click="counter(false)">-</view>
72   - <text>{{count}}</text>
73   - <view class="btn" disabled="this.desDisabled" type="default" @click="counter(true)">+</view>
74   - </view>
75   - </view>
76   - </view>
77   - </view>
78   - </view>
79   - </view>
80   -
  52 + </block>
81 53 <view class="footer">
82 54 <view class="footerLeft">实付金额:<text>¥{{totalPrice}}</text></view>
83 55 <view class="footerRight">
84   - <navigator url="/pages/myOrderPaying/myOrderPaying" hover-class="navigator-hover">
85   - <view class="paybtn">立即支付</view>
  56 + <navigator url="/pages/confirmOrder/confirmOrder" hover-class="navigator-hover">
  57 + <view class="paybtn" >立即结算</view>
86 58 </navigator>
87 59 </view>
88 60 </view>
... ... @@ -97,50 +69,273 @@
97 69  
98 70 data() {
99 71 return {
100   - totalPrice: 360,
101   - count:1,
  72 + totalPrice: 0,
  73 + pIsoPen:false,
  74 + // childIsOpen:[],
102 75 maxCount:20,
103   - pIsoPen: false,
104   - childIsOpen:{
105   - "child1":true,
106   - "child2":true
107   - },
108 76 }
109 77 },
110 78 computed:{
  79 +
111 80 cartList() {
112   - // 也可以从 getters 获取
113   - console.log('cart-list', this.$store.state.cart.cartList);
  81 + // console.log('cart-list', this.$store.state.cart.cartList);
114 82 return this.$store.state.cart.cartList;
  83 + },
  84 + childIsOpen(){
  85 + let temp=[];
  86 + temp.length=this.$store.state.cart.cartList.length;
  87 + for (let i = 0; i < temp.length; i++) {
  88 + temp[i]= false
  89 + }
  90 + console.log('this.childisOPne===>',temp)
  91 + return temp
115 92 }
116 93 },
117 94 onLoad: function() {
  95 + // 判断是否授权
  96 + // uni.getSetting({
  97 + // success(res) {
  98 + // console.log('authSetting',res.authSetting)
  99 + // if(res.authSetting['scope.userInfo'] !== true) {
  100 +
  101 + // uni.switchTab({
  102 + // url:'/pages/user/user'
  103 + // })
  104 + // }else {
  105 + // }
  106 + // }
  107 + // })
  108 +
  109 + // console.log('usr-my',this.$store.state.user.userInfo)
  110 + // store.dispatch('cart/addCart',{
  111 + // "num":1,
  112 + // "pid": 7,//产品id
  113 + // "uid":1,
  114 + // "sk_id": 72,
  115 + // "price": 120,
  116 + // "mp_id":1,
  117 + // "checkedSKU":{
  118 + // "discount": "45",
  119 + // "in_price": "6000",
  120 + // "kc": "0",
  121 + // "model_pic": null,
  122 + // "out_price": 191.8,
  123 + // "pic": "https://glass.xiuyetang.com//upload_jk/7/7_22AE0C.jpg",
  124 + // "pid": "7",
  125 + // "real_price": 99,
  126 + // "sk_id": "89",
  127 + // "sku_name": "1.56非球面防蓝光_黑",
  128 + // "sku_shop_value": "",
  129 + // "sku_value": "58_61",
  130 + // "status": "1",
  131 + // },
  132 + // });
118 133 store.dispatch('cart/getCartList',{
119 134 uid: 1, //用户id
120 135 });
121 136 },
  137 +
122 138 methods: {
123   - counter(isadd){
  139 + // 跳转到对应的选购页面
  140 + toshop(id,type){
  141 + console.log('===',id,type)
  142 + switch(type){
  143 + case 1:
  144 + uni.navigateTo({
  145 + url: `../detailsChoiceArgs/detailsChoiceArgs?oderId=`+id+`&goodType=`+type,
  146 + success: res => {},
  147 + fail: () => {},
  148 + complete: () => {}
  149 + });
  150 + break;
  151 + case 2:
  152 + uni.navigateTo({
  153 + url: `../detailStandard/detailStandard_k?oderId=`+id+`&goodType=`+type,
  154 + success: res => {},
  155 + fail: () => {},
  156 + complete: () => {}
  157 + });
  158 + break;
  159 + case 3||4:
  160 + uni.navigateTo({
  161 + url: `../detailStandard/detailStandard_sun?oderId=`+id+`&goodType=`+type,
  162 + success: res => {},
  163 + fail: () => {},
  164 + complete: () => {}
  165 + });
  166 + break;
  167 + // case 4:
  168 + // uni.navigateTo({
  169 + // url: `../detailStandard/detailStandard_sun?oderId=`+id+`&goodType=`+type,
  170 + // success: res => {},
  171 + // fail: () => {},
  172 + // complete: () => {}
  173 + // });
  174 + case 5:
  175 + uni.navigateTo({
  176 + url: `../purchaseLenses/purchaseLenses?oderId=`+id+`&goodType=`+type,
  177 + success: res => {},
  178 + fail: () => {},
  179 + complete: () => {}
  180 + });
  181 + break;
  182 + default :
  183 + break
  184 + }
  185 + },
  186 + toGoods(id,type){
  187 + uni.navigateTo({
  188 + url: `../frameDetail/frameDetail?oderId=`+id,
  189 + success: res => {},
  190 + fail: () => {},
  191 + complete: () => {}
  192 + });
  193 + console.log('toGoods =====> id:'+id +"======>type:"+type)
  194 + switch(type){
  195 + case 1:
  196 + uni.navigateTo({
  197 + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type,
  198 + success: res => {},
  199 + fail: () => {},
  200 + complete: () => {}
  201 + });
  202 + break;
  203 + case 2:
  204 + uni.navigateTo({
  205 + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type,
  206 + success: res => {},
  207 + fail: () => {},
  208 + complete: () => {}
  209 + });
  210 + break;
  211 + case 3:
  212 + uni.navigateTo({
  213 + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type,
  214 + success: res => {},
  215 + fail: () => {},
  216 + complete: () => {}
  217 + });
  218 + break;
  219 + case 4:
  220 + uni.navigateTo({
  221 + url: `../frameDetail/frameDetail?oderId=`+id+`&goodType=`+type,
  222 + success: res => {},
  223 + fail: () => {},
  224 + complete: () => {}
  225 + });
  226 + break;
  227 + default :
  228 + break
  229 + }
  230 + },
  231 +
  232 + counter(index,isadd,mp_id,sk_id,num,cart_id){
  233 + // console.log('===>>counter ===>num',num)
  234 + // console.log('===>>counter ===>isadd',isadd)
  235 + num=parseInt(num);
124 236 if(isadd){
125   - this.count >= this.maxCount? this.addDisabled = true:this.count++;
  237 + if(num>=this.maxCount){
  238 + this.addDisabled = true
  239 + } else{
  240 + this.addDisabled= true
  241 + // 修改num
  242 + store.dispatch('cart/modiCart',{
  243 + uid: 1,
  244 + // openid: '',
  245 + mp_id: mp_id,
  246 + sk_id: sk_id,
  247 + cart_id:cart_id,
  248 + num:num+1,
  249 + args:{
  250 + index:index,
  251 + isadd:isadd,
  252 + }
  253 + })
  254 + this.addDisabled= false
  255 + }
  256 + }else{
  257 + if(num<=1){
  258 + this.desDisabled = true
  259 + } else{
  260 + this.desDisabled = false
  261 + // post 请求修改相关参数
  262 + store.dispatch('cart/modiCart',{
  263 + uid: 1,
  264 + // openid: '',
  265 + mp_id: mp_id,
  266 + sk_id: sk_id,
  267 + cart_id:cart_id,
  268 + num:num-1,
  269 + args:{
  270 + index:index,
  271 + isadd:isadd,
  272 + }
  273 + })
  274 + this.desDisabled = true
  275 + }
  276 + }
  277 + },
  278 +
  279 + Change(isopen,indexC){
  280 + // console.log('lalla===>',isopen)
  281 + this.childIsOpen[indexC]=!isopen
  282 + if(!isopen){
  283 + this.totalPrice=this.totalPrice+(this.$store.state.cart.cartList[indexC].num*this.$store.state.cart.cartList[indexC].nowPrice)
126 284 }else{
127   - this.count <= 1? this.desDisabled = true:this.count--;
  285 + this.totalPrice=this.totalPrice-(this.$store.state.cart.cartList[indexC].num*this.$store.state.cart.cartList[indexC].nowPrice)
  286 + }
  287 + let m=true;
  288 + for (let i = 0; i < this.childIsOpen.length; i++) {
  289 + m=m&this.childIsOpen[i]
  290 + }
  291 + if(m==1){
  292 + this.pIsoPen=true
  293 + } else{
  294 + this.pIsoPen=false
128 295 }
129 296 },
130 297 pChange(isopen){
131   - // console.log(isopen)
132 298 this.pIsoPen=!isopen
133   - this.childIsOpen.child1=!isopen
134   - this.childIsOpen.child2=!isopen
135   - },
136   - cChange(isopen,child){
137   - // console.log(child)
138   - if(child==='child1'){
139   - this.childIsOpen.child1=!isopen
  299 + for (let i = 0; i < this.childIsOpen.length; i++) {
  300 + this.childIsOpen[i]=!isopen
140 301 }
141   - if(child==='child2'){
142   - this.childIsOpen.child2=!isopen
  302 + if(this.pIsoPen){
  303 + // 计算总价逻辑
  304 + if(this.childIsOpen.length!=0){
  305 + for (let i = 0; i < this.childIsOpen.length; i++) {
  306 + if(this.childIsOpen[i]){
  307 + this.totalPrice= this.totalPrice+(this.$store.state.cart.cartList[i].num*this.$store.state.cart.cartList[i].nowPrice)
  308 + }
  309 + }
  310 + }
  311 + } else{
  312 + this.totalPrice=0
143 313 }
  314 +
  315 + },
  316 + delCart(cart_id,index){
  317 + // console.log('userInfo',this.$store.state.user.userInfo)
  318 + cart_id=parseInt(cart_id)
  319 + // console.log('delcart------>cart_id',cart_id)
  320 + // console.log('cartlist====>delcart',this.$store.state.cart.cartList)
  321 + // console.log('delcart======>index',index)
  322 + uni.showModal({
  323 + title: "是否删除该商品",
  324 + // content: '是否删除该商品',
  325 + success: function (res) {
  326 + if (res.confirm) {
  327 + // this.$store.state.cart.cartList.splice(index,1)
  328 + store.dispatch('cart/delCart',{
  329 + uid: 1, //用户id
  330 + openid: "",
  331 + cart_id: cart_id, // 要修改的购物车id
  332 + arg:index, // 由于action 传参是能接收两参数,因此将index放入对象
  333 + });
  334 + console.log('用户点击确定');
  335 + }
  336 + }
  337 + });
  338 +
144 339 }
145 340 }
146 341 }
... ... @@ -171,21 +366,22 @@
171 366 background-color: #FF6B4A;
172 367 .correct {
173 368 display: inline-block;
174   - width: 5px;
175   - height: 1px;
  369 + position: relative;
  370 + width: 10rpx;
  371 + height: 2rpx;
176 372 background: #FFFFFF;
177 373 line-height: 0;
178 374 font-size: 0;
179 375 position: relative;
180   - top: -6px;
  376 + top: -7px;
181 377 left: 4px;
182 378 -webkit-transform: rotate(45deg);
183 379 }
184 380 .correct:after {
185 381 content: '/';
186 382 display: block;
187   - width: 8px;
188   - height: 1px;
  383 + width: 16rpx;
  384 + height: 2rpx;
189 385 background: #FFFFFF;
190 386 -webkit-transform: rotate(-90deg) translateY(50%) translateX(50%);
191 387 }
... ... @@ -200,6 +396,7 @@
200 396 flex-direction: column;
201 397 align-items: center;
202 398 justify-content: space-between;
  399 + margin-bottom: 180rpx;
203 400 .cardHeader{
204 401 width: 100%;
205 402 height: 36rpx;
... ... @@ -248,6 +445,11 @@
248 445 justify-content: space-between;
249 446 height: 240rpx;
250 447 .goodName{
  448 + display: -webkit-box;
  449 + -webkit-box-orient: vertical;
  450 + -webkit-line-clamp: 2;
  451 + text-align: justify;
  452 + overflow: hidden;
251 453 font-size: 28rpx;
252 454 color: #333333;
253 455 }
... ... @@ -257,8 +459,10 @@
257 459 box-sizing: border-box;
258 460 padding: 10rpx;
259 461 font-size: 20rpx;
  462 + letter-spacing: -0.23px;
  463 + text-align: justify;
260 464 color: #999999;
261   - background: #F2F2F2;
  465 + background: #F9F9F9;
262 466 display: flex;
263 467 justify-content: center;
264 468 align-items: center;
... ...
src/pages/detailStandard/detailStandard_k.vue
... ... @@ -10,7 +10,7 @@
10 10 </view>
11 11 <view class="choose">
12 12 <view class="colour">
13   - <view class="colour1"><span>框架颜色</span><image src="/static/img/detail/xiala2.png"></image></view>
  13 + <view class="colour1"><span>框架颜色</span><image src="/static/img/detail/xiala.png"></image></view>
14 14 <view class="colour_exp">*黑色 BHL192345</view>
15 15 <view class="colour2">
16 16 <view v-for="(colours) in colour" :key="colours.key"><image v-bind:src="colours.img"></image></view>
... ... @@ -20,7 +20,7 @@
20 20 <view class="size">
21 21 <view class="size1">
22 22 <view class="size1_1">框架尺寸</view>
23   - <view><span>+¥20</span><image src="/static/img/detail/xiala2.png"></image></view>
  23 + <view><span>+¥20</span><image src="/static/img/detail/xiala.png"></image></view>
24 24 </view>
25 25 <view class="size2">
26 26 <view>通用</view>
... ... @@ -31,13 +31,13 @@
31 31 <view><image class="D3_image" v-bind:src = "item.img"></image></view>
32 32 <view class="D3_list_jDu">
33 33 <!-- uni-sliper插件 -->
34   - <c-progress class="c-progress"
  34 + <!-- <c-progress class="c-progress"
35 35 :percent="item.percent"
36 36 :show-slider="false" :width="190"
37 37 :standard="item.standard_l"
38 38 :stand_width="item.slength"
39 39 progressColor="#FF6B4A"
40   - />
  40 + /> -->
41 41 <view>{{item.standard}}</view>
42 42 </view>
43 43 </view>
... ... @@ -47,7 +47,7 @@
47 47 <view class="part">
48 48 <view class="size1">
49 49 <view class="size1_1">配件</view>
50   - <view><span>+¥0.00</span><image src="/static/img/detail/xiala2.png"></image></view>
  50 + <view><span>+¥0.00</span><image src="/static/img/detail/xiala.png"></image></view>
51 51 </view>
52 52 <view class="colour_exp">*0290</view>
53 53 <view class="part_som">
... ... @@ -69,11 +69,9 @@
69 69 </template>
70 70 <script>
71 71 import CProgress from '../../components/UniSliper/UniSliper'
  72 +import store from '@/store'
72 73  
73 74 export default {
74   - components: {
75   - CProgress
76   - },
77 75 data(){
78 76 return{
79 77 detail:{
... ... @@ -112,7 +110,17 @@ export default {
112 110 {key: 7,img:'/static/img/detail/Kuang/g2.png'},
113 111 ],
114 112 }
115   - }
  113 + },
  114 +
  115 + components: {
  116 + detailStandard_k(){
  117 + console.log(detailStandard_k)
  118 + return this.$store.state.detailStandard_k.detailStandardList
  119 + }
  120 + },
  121 + onLoad:function(){
  122 + store.dispatch('detailStandard_k/getList')
  123 + },
116 124 }
117 125 </script>
118 126  
... ...
src/pages/detailsChoiceArgs/detailsChoiceArgs.vue
... ... @@ -16,12 +16,6 @@
16 16 </view>
17 17 </view>
18 18 <view class="goods-data">
19   - <!-- 实用功能折叠框 -->
20   - <MyCollapse :isOpenProps="funIsOpen" :funListProp="funList" :funContentProp="funContent" title="实用功能"></MyCollapse>
21   - <MyCollapse :isOpenProps="kindIsOpen" :funListProp="kindList1" :funList2Prop="kindList2" :funContentProp="kindContent" title="镜片种类"></MyCollapse>
22   - <MyCollapse :isOpenProps="maIsOpen" :funListProp="maList1" :funList2Prop="maList2" :funContentProp="maContent" title="材质选择"></MyCollapse>
23   - <MyCollapse :isOpenProps="reIsOpen" :funListProp="reList1" :funList2Prop="reList2" :funContentProp="reContent" title="折射率"></MyCollapse>
24   -
25 19 <view class="opCollapse">
26 20 <view class="head">
27 21 <view v-if="!opIsOpen">填写验光数据</view>
... ... @@ -157,7 +151,11 @@
157 151 </template>
158 152 </view>
159 153 </view>
160   -
  154 + <!-- 实用功能折叠框 -->
  155 + <MyCollapse :isOpenProps="funIsOpen" :funListProp="funList" :funContentProp="funContent" title="实用功能"></MyCollapse>
  156 + <MyCollapse :isOpenProps="kindIsOpen" :funListProp="kindList1" :funList2Prop="kindList2" :funContentProp="kindContent" title="镜片种类"></MyCollapse>
  157 + <MyCollapse :isOpenProps="maIsOpen" :funListProp="maList1" :funList2Prop="maList2" :funContentProp="maContent" title="材质选择"></MyCollapse>
  158 + <MyCollapse :isOpenProps="reIsOpen" :funListProp="reList1" :funList2Prop="reList2" :funContentProp="reContent" title="折射率"></MyCollapse>
161 159 </view>
162 160 <view class="submit">立即结算</view>
163 161 </view>
... ...
src/pages/index/index.vue
... ... @@ -4,11 +4,17 @@
4 4 <!-- 搜索-->
5 5 <view class="searchBar">
6 6 <icon class="searchIcon" type="search" size="14"></icon>
7   - <input class="searchIpt" placeholder="老花镜" confirm-type="search" />
  7 + <input
  8 + v-model="searchText"
  9 + class="searchIpt"
  10 + placeholder="老花镜"
  11 + confirm-type="search"
  12 + @blur="searchKey"
  13 + />
8 14 </view>
9 15  
10 16 <!-- 筛选栏-->
11   - <view class="screenBar">
  17 + <!-- <view class="screenBar">
12 18 <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)">
13 19 <view
14 20 class="screenItem"
... ... @@ -35,7 +41,7 @@
35 41 >{{ item.text }}</view>
36 42 </view>
37 43 </view>
38   - </view>
  44 + </view>-->
39 45 </view>
40 46 <Uni-drawer
41 47 ref="showRight"
... ... @@ -55,11 +61,12 @@
55 61 <!-- 筛选菜单-->
56 62 <view class="content-wrap">
57 63 <view>
58   - <HMfilterDropdown
59   - :filterData="filterData"
  64 + <HMfilterDropdown
  65 + :filterData="categoryList"
60 66 :defaultSelected="filterDropdownValue"
61 67 :updateMenuName="true"
62   - @confirm="confirm"
  68 + @search="search"
  69 + @getList="getList"
63 70 data-format="Object"
64 71 ></HMfilterDropdown>
65 72 <!-- 商品列表 -->
... ... @@ -91,20 +98,21 @@ export default {
91 98 },
92 99 data() {
93 100 return {
94   - screenItems: [
95   - { current: 0, text: "全部", hasIcon: false },
96   - { current: 1, text: "销量", hasIcon: false },
97   - { current: 2, text: "价格", hasIcon: true },
98   - { current: 3, text: "折扣", hasIcon: false },
99   - { current: 4, text: "筛选", hasIcon: true }
100   - ],
101   - current: 0,
102   - showRight: false,
  101 + // screenItems: [
  102 + // { current: 0, text: "全部", hasIcon: false },
  103 + // { current: 1, text: "销量", hasIcon: false },
  104 + // { current: 2, text: "价格", hasIcon: true },
  105 + // { current: 3, text: "折扣", hasIcon: false },
  106 + // { current: 4, text: "筛选", hasIcon: true }
  107 + // ],
  108 + // current: 0,
  109 + // showRight: false,
103 110 indexArr: "",
104 111 valueArr: "",
105 112 loadingText: "~~到底了~~",
106 113 filterDropdownValue: [],
107 114 filterData: [],
  115 + searchText: '',
108 116 // goodsList:[
109 117 // { goods_id: 0, img: "/static/img/goods/p1.jpg", name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 },
110 118 // { goods_id: 1, img: '/static/img/goods/p2.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 },
... ... @@ -120,62 +128,12 @@ export default {
120 128 };
121 129 },
122 130 computed: {
123   - goodsList() {
124   - // 也可以从 getters 获取
125   - return this.$store.state.test.list;
126   - },
  131 + goodsList() {
  132 + // 也可以从 getters 获取
  133 + return this.$store.state.index.list;
  134 + },
127 135 categoryList(){
128   - // console.log(this.$store.state.categoryOrder.categoryList);
129   - const categoryList = this.$store.state.categoryOrder.categoryList
130   - let newData = [
131   - {
132   - "name":'产品',
133   - "type": 'filter',
134   - "submenu": [{
135   - "submenu": [
136   -
137   - ]
138   - },
139   - ],
140   - },
141   - {
142   - "name":'品牌',
143   - "type": 'filter',
144   - "submenu": [{
145   - "submenu": [
146   - ]
147   - },
148   - ]
149   - },
150   - {
151   - "name":'使用场景',
152   - "type": 'filter',
153   - "submenu": [{
154   - "submenu": [
155   - ]
156   - }
157   - ]
158   - },
159   - {
160   - "name":'材质',
161   - "type": 'filter',
162   - "submenu": [{
163   - "submenu": [
164   - ]
165   - }
166   - ]
167   - },
168   - {
169   - "name":'筛选',
170   - "type": 'filter',
171   - "submenu": [{
172   - // "name": "折扣(多选)",
173   - "submenu": [
174   - ]
175   - }
176   - ]
177   - }
178   - ]
  136 + return this.$store.state.index.categoryList;
179 137 // newData[0].submenu[0].submenu = categoryList[0].submenu
180 138 // newData[1].submenu[0].submenu = categoryList[3].submenu[5].submenu
181 139 // newData[2].submenu[0].submenu = categoryList[3].submenu[2].submenu
... ... @@ -183,26 +141,29 @@ export default {
183 141 // newData[4].submenu[0] = categoryList[3]
184 142 this.filterData = newData;
185 143 // this.filterData = categoryList;
186   - }
187   -
  144 + },
188 145 },
189 146 filters: {
190 147 outData(value) {
191 148 return JSON.stringify(value);
192 149 }
193 150 },
194   - onLoad: function() {
195   - store.dispatch('test/fetch');
196   - store.dispatch('categoryOrder/fetch')
197   -
198   - // 登陆
199   - // store.dispatch('user/login')
200   -
  151 + onLoad() {
  152 + console.log('onload')
  153 + store.dispatch('index/category');
  154 + // this.getList();
  155 + store.dispatch('index/list');
201 156 },
202 157 methods: {
203 158 showDrawer(e) {
204 159 this.$refs[e].open();
205 160 },
  161 + getList() {
  162 + store.dispatch('index/list');
  163 + },
  164 + // search(params) {
  165 + // this.$store.index.
  166 + // },
206 167 closeDrawer(e) {
207 168 this.$refs[e].close();
208 169 },
... ... @@ -217,16 +178,35 @@ export default {
217 178 dropDown() {
218 179 console.log("下拉");
219 180 },
  181 + searchKey(e) {
  182 + const { value: keyword } = e.detail;
  183 + this.keyWords = keyword;
  184 + console.log('e', e, keyword);
  185 + store.dispatch('index/search', {
  186 + params: {},
  187 + keyword,
  188 + });
  189 + },
220 190 //接收菜单结果
221   - confirm(e) {
222   - this.indexArr = e.index;
223   - this.valueArr = e.value;
224   - return;
225   - console.log("修改菜单");
226   - this.filterData[4].submenu[1] = {
227   - name: "项目2",
228   - submenu: []
229   - };
  191 + search(e) {
  192 + console.log("修改菜单-----", e, this.categoryList);
  193 + const { on, value, index } = e;
  194 + let params = {}
  195 + if(on[0] === 1) {
  196 + this.searchText = '';
  197 + store.dispatch('index/list');
  198 + } else {
  199 + for(let i = 1; i<=on.length; i++){ // on[0]是全部
  200 + if(on[i] === 1) { // 若该选项被选中
  201 + console.log('---', `${this.categoryList[i].value}`);
  202 + params[`${this.categoryList[i].value}`] = value[i][0];
  203 + }
  204 + }
  205 + store.dispatch('index/search', {
  206 + params,
  207 + keyword: this.keyWords
  208 + });
  209 + }
230 210 }
231 211 },
232 212  
... ...
src/pages/user/user.vue
... ... @@ -47,11 +47,13 @@
47 47 </view>
48 48 <!-- 商品列表 -->
49 49 <view class="goods-list">
50   - <view class="product-list">
51   - <view class="product" v-for="(goods) in goodsList" :key="goods.goods_id" >
52   - <Card :goods = "goods"></Card>
53   - </view>
54   - </view>
  50 + <scroll-view enable-flex @scrolltolower="handleScrolltolower" scroll-y class="product-list">
  51 + <block v-for="(goods) in userRecommandList " :key="goods.list.sk_id">
  52 + <view class="product" v-for="(item) in goods.list" :key="item.sk_id">
  53 + <Card :goods="item" ></Card>
  54 + </view>
  55 + </block>
  56 + </scroll-view>
55 57 <view class="loading-text">{{loadingText}}</view>
56 58 </view>
57 59 </view>
... ... @@ -93,7 +95,8 @@
93 95 { goods_id: 8, img: '/static/img/goods/p9.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' },
94 96 { goods_id: 9, img: '/static/img/goods/p10.jpg', name: '商品名称',originCost:'¥198',price: '¥168', slogan:'1235人浏览' }
95 97 ],
96   - isAuth: true, // 是否显示授权页面
  98 + isAuth: true, // 是否显示授权页面,
  99 + pagesnum:1 // 分页请求初始值
97 100 }
98 101 },
99 102 onLoad() {
... ... @@ -108,6 +111,7 @@
108 111 }
109 112 }
110 113 })
  114 +
111 115 },
112 116 computed: {
113 117 nickName() {
... ... @@ -122,11 +126,18 @@
122 126 return this.$store.state.userRecommand.recommandList;
123 127 }
124 128 },
125   - onLoad: function() {
  129 + onLoad:function(){
  130 + console.log('usr-my',this.$store.state.user.userInfo)
  131 +
126 132 store.dispatch('userRecommand/getRecommandList', {
127   - uid: 2,
  133 + // uid:468,
  134 + uid: this.$store.state.user.userInfo.uid,
  135 + // openid:"oc8cg0d-0mFIInO4LyrCFtInPWr4",
  136 + openid:this.$store.state.user.userInfo.openid,
  137 + page: this.pagesnum
128 138 });
129 139 },
  140 +
130 141 methods: {
131 142 // 授权
132 143 onGotUserInfo(e) {
... ... @@ -172,6 +183,15 @@
172 183 uni.navigateTo({
173 184 url:'../refundProgress/refundProgress'
174 185 })
  186 + },
  187 + handleScrolltolower(){
  188 + // console.log('usr-my',this.$store.state.user.userInfo)
  189 + this.pagesnum++;
  190 + store.dispatch('userRecommand/getRecommandList', {
  191 + uid: this.$store.state.user.userInfo.uid,
  192 + openid:this.$store.state.user.userInfo.openid,
  193 + page: this.pagesnum
  194 + });
175 195 }
176 196 }
177 197 }
... ... @@ -334,6 +354,7 @@
334 354 width: 92%;
335 355 padding: 0 4% 3vw 4%;
336 356 display: flex;
  357 + height: 200px;
337 358 justify-content: space-between;
338 359 flex-wrap: wrap;
339 360 .product{
... ...
src/store/modules/cart.js
1 1 import urlAlias from '../url';
2 2 import request from '../request';
3 3  
4   -const { cartList } = urlAlias;
  4 +const { cartList , cartModi, cartDel, cartAdd } = urlAlias;
5 5  
6 6 const state = {
7 7 cartList: [],
8 8 };
9 9  
  10 +
  11 +const data = {
  12 + data:{
  13 + // list 购物车列表
  14 + list:[
  15 + {
  16 + goods_name: "1.56非球面防蓝光_黑01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流", //商品名称
  17 + pid: "6",//产品id
  18 + real_price: 99,
  19 + checked: true,//是否选中
  20 + name: "颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射防日光 / 配件 免费送 /折射",//属性名称 ,颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 …
  21 + cart_id: "39", //购物车唯一序列号
  22 + num: "1", //此购物
  23 + pics: "/static/myorder-paying-pic.png", //商品图片
  24 + goodsType:2,// 商品种类
  25 + },
  26 + {
  27 + goods_name: "1.56非球面防蓝光_黑01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流", //商品名称
  28 + pid: "4",//产品id
  29 + real_price: 189,
  30 + checked: false,//是否选中
  31 + name: "颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射防日光 / 配件 免费送 /折射",//属性名称 ,颜色 玫瑰金 /材质 钛合金 / 功能 防日光 / 配件 免费送 /折射 …
  32 + cart_id: "38", //购物车唯一序列号
  33 + num: "2", //此购物
  34 + pics: "/static/myorder-paying-pic.png", //商品图片
  35 + goodsType:3,// 商品种类
  36 + },
  37 + ],
  38 + mp_id: "1",
  39 + mp_list://使用人,一个产品只有一个使用人
  40 + [
  41 + {
  42 + glassWidth: "54",//镜宽
  43 + img_url2: "http://localhost:8087/images/shop_1/1/",//使用人的头像,根据此头像,AI识别出数据。
  44 + in_time: "2020-02-22 03:19:38",//使用人加入的时间
  45 + leftAxi: "124",//左眼数据
  46 + leftCyl: "-2",//左眼数据
  47 + leftSph: "-1",//左眼数据
  48 + leftVis: "5",//左眼数据
  49 + legWidth: "158",//镜腿长
  50 + metal: null,//使用人的其它定义(材质过敏之类的)
  51 + mp_id: "1",//使用的id
  52 + name: "me",//使用人的名字
  53 + norseWidth: "18",//鼻宽
  54 + pd: "89.6",//瞳距
  55 + price: "0",//此人偏好的价格
  56 + rightAxi: "123",//右眼数据
  57 + rightCyl: "24",//右眼数据
  58 + rightSph: "-4",//右眼数据
  59 + rightVis: "5.1",//右眼数据
  60 + uid: "1",//购买人的uid
  61 + }
  62 + ],
  63 + sk_id: "80",//此产品下的sku的唯一id
  64 + skuList:[//sku清单
  65 + {
  66 + discount: "45",//折扣,数据库中以int型存储,所以要除100
  67 + in_price: "6000",//进货价格,数据库中以int型存储,单位是分,所以显示时要除以100
  68 + kc: "0",//库存
  69 + model_pic: null,//模型试戴图
  70 + out_price: 191.8,//销售价格,元
  71 + pic: "https://glass.xiuyetang.com//upload_jk/6/6_321EB1.jpg",//可供查看图
  72 + pid: "6",//索引产品id
  73 + real_price: 99,//真实可成交价格
  74 + sk_id: "74",//成交时的sku_id
  75 + sku_name: "1.56非球面防蓝光_黑色",//sku名称
  76 + sku_shop_value: "",//sku商家定义值
  77 + sku_value: "47_51",//sku系统生成值
  78 + status: "1",//此产品下的sku状态
  79 + }
  80 + ]
  81 + }, // 一个产品下,会有多个sku,都在这个skuList数组下
  82 + msg: "ok",
  83 + status: 1,
  84 +}
  85 +
10 86 const mutations = {
11 87 INIT: (state, cartList) => {
12 88 state.cartList = cartList;
13 89 },
  90 + DEL:(state,index)=>{
  91 + console.log('mutations====>',state.cartList)
  92 + state.cartList.splice(index,1)
  93 + console.log('mutations====>index',index)
  94 + // state.cartList=delList
  95 + },
  96 + MODI:(state,args) => {
  97 + console.log('the num',state.cartList[args.index].num)
  98 + console.log('mutations====>isadd',args)
  99 + if(args.isadd)
  100 + {
  101 + state.cartList[args.index].num=args.num
  102 + } else{
  103 + state.cartList[args.index].num=args.num
  104 + }
  105 + console.log('the num',state.cartList[args.index].num)
  106 + },
  107 +
14 108 };
15 109  
16   -
17   -
18 110 const actions = {
19 111  
20   - getCartList({ commit }, param) {
21   - request({
22   - url: cartList,
23   - success: (res) => {
24   -
25   - commit('INIT', res.data.data)
26   - },
27   - fail: (res) => {
28   - console.log("fail status === > ", res);
29   - },
30   - complete: (res) => {
31   - console.log("complete status === > ", res);
32   - },
33   - })
34   - }
35   -
  112 + getCartList({ commit }, param) {
  113 + request({
  114 + url: cartList,
  115 + data:param,
  116 + success: (res) => {
  117 + console.log('cart===>接口数据',res.data.data)
  118 + // const resData = {
  119 + // ...res,
  120 + // data,
  121 + // }
  122 + commit('INIT', res.data.data)
  123 + },
  124 + fail: (res) => {
  125 + console.log("fail status === > ", res);
  126 + },
  127 + complete: (res) => {
  128 + console.log("complete status === > ", res);
  129 + },
  130 + })
  131 + },
  132 +
  133 + modiCart({ commit }, param) {
  134 + const args=Object.assign({num:param.num},param.args)
  135 + delete param.args
  136 + request({
  137 + url: cartModi,
  138 + data: param,
  139 + success: (res) => {
  140 + console.log('modi-parm',param)
  141 + commit('MODI',args)
  142 + },
  143 + fail: (res) => {
  144 + console.log("fail status === > ", res);
  145 + },
  146 + complete: (res) => {
  147 + console.log("complete status === > ", res);
  148 + },
  149 + })
  150 + },
  151 +
  152 + delCart({ commit },param ) {
  153 + let arg = param.arg;
  154 + delete param.arg
  155 + request({
  156 + url: cartDel,
  157 + data: param,
  158 + success: (res) => {
  159 + console.log('del-parm',param)
  160 + console.log('del-myparms==>',arg)
  161 + // console.log('deacart====>cartList',this.$store.state.cart.cartList)
  162 +
  163 + commit('DEL',arg)
  164 + },
  165 + fail: (res) => {
  166 + console.log("fail status === > ", res);
  167 + },
  168 + complete: (res) => {
  169 + console.log("complete status === > ", res);
  170 + },
  171 + })
  172 + },
  173 +
  174 + addCart({ commit }, param) {
  175 + console.log('请求接口开始')
  176 + request({
  177 + url: cartAdd,
  178 + data:param,
  179 + success: (res) => {
  180 + console.log('add-parm',param)
  181 + console.log('addcart===>res.data===>',res.data)
  182 + // commit('INIT', res.data.data)
  183 + },
  184 + fail: (res) => {
  185 + console.log("fail status === > ", res);
  186 + },
  187 + complete: (res) => {
  188 + console.log("complete status === > ", res);
  189 + },
  190 + })
  191 + },
  192 +
36 193 }
37 194  
38 195 export default {
... ...
src/store/modules/categoryOrder.js
... ... @@ -1,40 +0,0 @@
1   - import urlAlias from '../url';
2   - import request from '../request';
3   -
4   - const {
5   - category
6   - } = urlAlias;
7   -
8   -const state = {
9   - categoryList: [],
10   -};
11   -
12   -const mutations = {
13   - INIT: (state, categoryList) => {
14   - state.categoryList = categoryList;
15   - },
16   -};
17   -
18   -const actions = {
19   - fetch({ commit }, param) {
20   - request({
21   - url: category,
22   - success: (res) => {
23   - commit('INIT', res.data.data)
24   - },
25   - fail: (res) => {
26   - console.log("fail status === > ", res);
27   - },
28   - complete: (res) => {
29   - console.log("complete status === > ", res);
30   - },
31   - })
32   - },
33   -};
34   -
35   -export default {
36   - namespaced: true,
37   - state,
38   - mutations,
39   - actions,
40   -};
src/store/modules/detailStandard_k.js
... ... @@ -0,0 +1,42 @@
  1 +import urlAlias from '../url';
  2 +import request from '../request';
  3 +
  4 +const {
  5 + detailStandardList
  6 +} = urlAlias
  7 +
  8 +const state = {
  9 + list:[],
  10 +};
  11 +
  12 +const mutations = {
  13 + INIT: (state, detailStandardList) => {
  14 + state.detailStandardList = detailStandardList;
  15 + },
  16 +};
  17 +
  18 +const actions = {
  19 + getList({ commit }, param){
  20 + request({
  21 + detailStandardList,
  22 + success: (res) => {
  23 +
  24 + commit('INIT', res.data.data)
  25 + console,log('success')
  26 + },
  27 + fail: (res) => {
  28 + console.log("detail status === > ", res);
  29 + },
  30 + complete: (res) => {
  31 + console.log("detail compete status === > ", res);
  32 + },
  33 + })
  34 + }
  35 +}
  36 +
  37 +export default {
  38 + namespaced: true,
  39 + state,
  40 + mutations,
  41 + actions,
  42 +}
0 43 \ No newline at end of file
... ...
src/store/modules/index.js
... ... @@ -0,0 +1,95 @@
  1 + import urlAlias from '../url';
  2 + import request from '../request';
  3 +
  4 + const {
  5 + category,
  6 + shopList,
  7 + search,
  8 + } = urlAlias;
  9 +
  10 +const state = {
  11 + categoryList: [],
  12 + list: [],
  13 +};
  14 +
  15 +const mutations = {
  16 + LIST: (state, list) => {
  17 + state.list = list;
  18 + },
  19 + CATEGORY: (state, categoryList) => {
  20 + state.categoryList = categoryList;
  21 + },
  22 +};
  23 +
  24 +const actions = {
  25 + category({ commit }, param) {
  26 + request({
  27 + url: category,
  28 + success: (res) => {
  29 + console.log('category', res);
  30 + let data = res.data.data;
  31 + for(let i = 0; i<=data.length; i++) {
  32 + if(data[i] && data[i].type !== 'filter'){
  33 + data[i].type = 'hierarchy';
  34 + }
  35 + }
  36 + data.unshift({
  37 + type: "hierarchy",
  38 + name: "全部",
  39 + value: "all",
  40 + isNoPull: true,
  41 + });
  42 + commit('CATEGORY', data);
  43 + },
  44 + fail: (res) => {
  45 + console.log("fail status === > ", res);
  46 + },
  47 + complete: (res) => {
  48 + console.log("complete status === > ", res);
  49 + },
  50 + })
  51 + },
  52 + list({ commit }, param) {
  53 + request({
  54 + url: shopList,
  55 + success: (res) => {
  56 + commit('LIST', res.data.data)
  57 + },
  58 + fail: (res) => {
  59 + console.log("fail status === > ", res);
  60 + },
  61 + complete: (res) => {
  62 + console.log("complete status === > ", res);
  63 + },
  64 + })
  65 + },
  66 + search({ commit }, { params, keyword }) {
  67 + const uid = uni.getStorageSync('uid');
  68 + console.log("params",params, keyword);
  69 + request({
  70 + url: search,
  71 + data: {
  72 + params: JSON.stringify(params),
  73 + uid,
  74 + way: 1,
  75 + keyword,
  76 + },
  77 + success: (res) => {
  78 + commit('LIST', res.data.data);
  79 + },
  80 + fail: (res) => {
  81 + console.log("fail status === > ", res);
  82 + },
  83 + complete: (res) => {
  84 + console.log("complete status === > ", res);
  85 + },
  86 + })
  87 + }
  88 +};
  89 +
  90 +export default {
  91 + namespaced: true,
  92 + state,
  93 + mutations,
  94 + actions,
  95 +};
... ...
src/store/modules/user.js
... ... @@ -73,6 +73,7 @@ const actions = {
73 73 success: (res) => {
74 74 console.log('userInfo=====', res);
75 75 const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res;
  76 + uni.setStorageSync('uid', uid);
76 77 const userInfo = {
77 78 uid,
78 79 openid,
... ... @@ -112,6 +113,7 @@ const actions = {
112 113 success: (res) => {
113 114 console.log('userInfo=====', res);
114 115 const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res;
  116 + uni.setStorageSync('uid', uid);
115 117 const userInfo = {
116 118 uid,
117 119 openid,
... ...
src/store/modules/userRecommand.js
... ... @@ -9,21 +9,65 @@ const state = {
9 9 recommandList: [],
10 10 };
11 11  
  12 +const data = {
  13 + "code": 1,
  14 + "msg": "请求成功",
  15 + "data": {
  16 + // list 表示商品数据列表
  17 + "list": [
  18 + {
  19 + model_pic: null,
  20 + p_name: "1.61防蓝光镜片 非球面_枪色款镜架商务男士防蓝光眼镜",
  21 + p_root_index: "1", //对应goodType
  22 + pic: "http://localhost/sys-glass/image/picture.png",
  23 + pid: "96",
  24 + real_price: "17800",
  25 + sk_id: "1448",
  26 + sku_name: "1.61防蓝光镜片 非球面_枪色款镜架",
  27 + trade_num: "0",
  28 + },
  29 + {
  30 + "sk_id": "39",
  31 + "pic": "/static/img/goods/p1.jpg",
  32 + "p_name": "1.56防蓝光镜片非球面_黑银色镜架防蓝光眼镜超轻不压鼻",
  33 + "old_price": "18000",
  34 + "real_price": "9900",
  35 + "trade_num": 123, // 对应购买人数
  36 + "p_root_index": 2, // 对应跳转的详情页
  37 + "pid":4, // 产品id
  38 + },
  39 + ],
  40 + pagesnum:1, // 懒加载要用到的页数
  41 + pagessize:10,// 每次请求返回的list长度
  42 + }
  43 +
  44 +}
  45 +
12 46 const mutations = {
13 47 INIT: (state, list) => {
14 48 state.recommandList = list;
15 49 },
16 50 };
17 51  
  52 +let goodsList=[];
  53 +
18 54 const actions = {
19 55 getRecommandList({ commit }, param) {
20 56 request({
21 57 url: recommandList,
22 58 success: (res) => {
23   - console.log(res.data)
24   - commit('INIT', res.data.data)
  59 + console.log('userRecommand-parm',param)
  60 + console.log(res.data.data)
  61 + // const Res={...res.data.data.list,...data.data.list}
  62 + goodsList=[...goodsList,...res.data.data]
  63 + // console.log(res.data)
  64 + commit('INIT', goodsList)
25 65 },
26 66 fail: (res) => {
  67 + uni.showToast({
  68 + title:"数据加载完了",
  69 + icon:"none"
  70 + })
27 71 console.log("fail status === > ", res);
28 72 },
29 73 complete: (res) => {
... ...
src/store/request.js
... ... @@ -18,7 +18,6 @@ export default async function request({
18 18 console.log("complete status === > ", res);
19 19 },
20 20 }) {
21   - console.log("DOMAIN", DOMAIN, url);
22 21 uni
23 22 .request({
24 23 url: DOMAIN + url,
... ...
1 1 const urlAlias = {
2   - // 获取首页商品列表
3   - shopList: '/app/prod/list',
4   -
5   - // 获取首页商品列表
6   - category: '/app/prod/category2',
7   - // 获取商品信息
8   - read: '/app/prod/read',
  2 + // 获取商品信息
  3 + read: '/app/prod/read',
9 4  
10 5 // 首页
11 6 shopList: '/app/prod/list', // 获取首页商品列表
12   - category: '/app/prod/category', // 获取首页商品分类
  7 + category: '/app/prod/category2', // 获取首页商品分类
  8 + search: '/app/prod/search', // 首页搜索商品
13 9  
14 10 // 登陆
15 11 login: '/app/glass/getOpenId', // 登陆
... ... @@ -20,9 +16,16 @@ const urlAlias = {
20 16  
21 17 // 购物车
22 18 cartList: '/app/cart/list', // 获取购物车列表
  19 + cartModi: '/app/cart/modi', // 修改购物车
  20 + cartDel: '/app/cart/del', // 删除购物车
  21 + cartAdd: '/app/cart/add',// 添加购物车
23 22  
24 23 // 我的
25   - recommandList:'/app/prod/recommand', // 获取用户个性化推荐商品
  24 + recommandList:'/app/prod/recommand', // 获取用户个性化推荐商品
  25 +
  26 + // 镜框选购页
  27 + detailStandardList: '/app/prod/read', //获取商品的详细信息
  28 +
26 29 }
27 30  
28 31 export default urlAlias;
... ...