Commit c300654f9c8e285c91a4228cd1007d6d567befda
1 parent
c4c4f1251c
Exists in
master
首页部分功能
Showing
9 changed files
with
264 additions
and
203 deletions
Show diff stats
src/App.vue
1 | <script> | 1 | <script> |
2 | import Vue from 'vue'; | 2 | import Vue from 'vue'; |
3 | import store from '@/store'; | 3 | import store from '@/store'; |
4 | 4 | ||
5 | export default Vue.extend({ | 5 | export default Vue.extend({ |
6 | mpType: 'app', | 6 | mpType: 'app', |
7 | onLaunch(options) { | 7 | onLaunch(options) { |
8 | const option = options || {}; | 8 | const option = options || {}; |
9 | // 获取用户来源 | 9 | // 获取用户来源 |
10 | console.log('软件启动,输出转来的参数:', option); | 10 | // console.log('软件启动,输出转来的参数:', option); |
11 | console.log('场景值------------------:', option.scene); | 11 | // console.log('场景值------------------:', option.scene); |
12 | let loginQueryInfo = option ? option.query : {}; | 12 | let loginQueryInfo = option ? option.query : {}; |
13 | loginQueryInfo = loginQueryInfo || {}; | 13 | loginQueryInfo = loginQueryInfo || {}; |
14 | console.log('loginQueryInfo onShow===>', loginQueryInfo); | 14 | // console.log('loginQueryInfo onShow===>', loginQueryInfo); |
15 | const scene = decodeURIComponent(loginQueryInfo.scene); | 15 | const scene = decodeURIComponent(loginQueryInfo.scene); |
16 | console.log('decodeURIComponent scense====>', scene); | 16 | // console.log('decodeURIComponent scense====>', scene); |
17 | let fromInfo = {}; | 17 | let fromInfo = {}; |
18 | 18 | ||
19 | if(scene.length > 0 ) { | 19 | if(scene.length > 0 ) { |
20 | const getQueryString = { | 20 | const getQueryString = { |
21 | uid: undefined, | 21 | uid: undefined, |
22 | sid: undefined, | 22 | sid: undefined, |
23 | pid: undefined | 23 | pid: undefined |
24 | }; | 24 | }; |
25 | const strB = scene.split('&'); | 25 | const strB = scene.split('&'); |
26 | 26 | ||
27 | for(let i = 0; i < strB.length; i += 1) { | 27 | for(let i = 0; i < strB.length; i += 1) { |
28 | getQueryString[strB[i].split('=')[0]] = unescape(strB[i].split('=')[1]); | 28 | getQueryString[strB[i].split('=')[0]] = unescape(strB[i].split('=')[1]); |
29 | } | 29 | } |
30 | fromInfo = { | 30 | fromInfo = { |
31 | loginQueryInfo, | 31 | loginQueryInfo, |
32 | fromuid: getQueryString.uid, | 32 | fromuid: getQueryString.uid, |
33 | fromsid: getQueryString.sid, | 33 | fromsid: getQueryString.sid, |
34 | frompid: getQueryString.pid, | 34 | frompid: getQueryString.pid, |
35 | scene: option.scene, | 35 | scene: option.scene, |
36 | } | 36 | } |
37 | store.dispatch('user/setFrom', fromInfo); | 37 | store.dispatch('user/setFrom', fromInfo); |
38 | console.log('loginQueryInfo.hasOwnProperty=====111===>', getQueryString); | 38 | // console.log('loginQueryInfo.hasOwnProperty=====111===>', getQueryString); |
39 | } else { | 39 | } else { |
40 | console.log('loginQueryInfo.hasOwnProperty====22222====>', loginQueryInfo); | 40 | // console.log('loginQueryInfo.hasOwnProperty====22222====>', loginQueryInfo); |
41 | if (loginQueryInfo.hasOwnProperty('sid') == false) { | 41 | if (loginQueryInfo.hasOwnProperty('sid') == false) { |
42 | loginQueryInfo.sid = 0; | 42 | loginQueryInfo.sid = 0; |
43 | } | 43 | } |
44 | if (loginQueryInfo.hasOwnProperty('pid') == false) { | 44 | if (loginQueryInfo.hasOwnProperty('pid') == false) { |
45 | loginQueryInfo.pid = 0; | 45 | loginQueryInfo.pid = 0; |
46 | } | 46 | } |
47 | if (loginQueryInfo.hasOwnProperty('uid') == false) { | 47 | if (loginQueryInfo.hasOwnProperty('uid') == false) { |
48 | loginQueryInfo.uid = 0; | 48 | loginQueryInfo.uid = 0; |
49 | } | 49 | } |
50 | fromInfo = { | 50 | fromInfo = { |
51 | loginQueryInfo, | 51 | loginQueryInfo, |
52 | fromuid: loginQueryInfo.uid, | 52 | fromuid: loginQueryInfo.uid, |
53 | fromsid: loginQueryInfo.sid, | 53 | fromsid: loginQueryInfo.sid, |
54 | frompid: loginQueryInfo.pid, | 54 | frompid: loginQueryInfo.pid, |
55 | scene: option.scene, | 55 | scene: option.scene, |
56 | } | 56 | } |
57 | store.dispatch('user/setFrom', fromInfo) | 57 | store.dispatch('user/setFrom', fromInfo) |
58 | } | 58 | } |
59 | 59 | ||
60 | // 登陆 | 60 | // 登陆 |
61 | const openId = uni.getStorageSync('openid') || ""; | 61 | const openId = uni.getStorageSync('openid') || ""; |
62 | if(openId.length <= 10) { | 62 | if(openId.length <= 10) { |
63 | uni.clearStorageSync() | 63 | uni.clearStorageSync() |
64 | store.dispatch("user/login", fromInfo); | 64 | store.dispatch("user/login", fromInfo); |
65 | } else { | 65 | } else { |
66 | store.dispatch("user/getUserInfo", fromInfo); | 66 | store.dispatch("user/getUserInfo", fromInfo); |
67 | } | 67 | } |
68 | }, | 68 | }, |
69 | onShow() { | 69 | onShow() { |
70 | 70 | // console.log('App Show') | |
71 | console.log('App Show') | ||
72 | }, | 71 | }, |
73 | onHide() { | 72 | onHide() { |
74 | console.log('App Hide') | 73 | // console.log('App Hide') |
75 | }, | 74 | }, |
76 | methods: { | 75 | methods: { |
77 | } | 76 | } |
78 | }); | 77 | }); |
79 | </script> | 78 | </script> |
80 | 79 | ||
81 | <style> | 80 | <style> |
82 | /*每个页面公共css */ | 81 | /*每个页面公共css */ |
83 | </style> | 82 | </style> |
84 | 83 |
src/components/HMFilterDropdown/HMFilterDropdown.vue
1 | <template> | 1 | <template> |
2 | <view class="HMfilterDropdown" @touchmove.stop.prevent="discard" @tap.stop="discard"> | 2 | <view class="HMfilterDropdown" @touchmove.stop.prevent="discard" @tap.stop="discard"> |
3 | <view class="nav"> | 3 | <view class="nav"> |
4 | <block v-for="(item,index) in menu" :key="index"> | 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 | <text class="name">{{item.name}}</text> | 23 | <text class="name">{{item.name}}</text> |
7 | <text class="iconfont triangle" :style="'transform:rotate('+triangleDeg[index]+'deg);'"></text> | ||
8 | </view> | 24 | </view> |
9 | </block> | 25 | </block> |
10 | </view> | 26 | </view> |
11 | <view class="mask" :class="{'show':isShowMask,'hide':maskVisibility!=true}" @tap="togglePage(showPage)"></view> | 27 | <view class="mask" :class="{'show':isShowMask,'hide':maskVisibility!=true}" @tap="togglePage(showPage)"></view> |
12 | <block v-for="(page,page_index) in subData" :key="page_index"> | 28 | <block v-for="(page,page_index) in subData" :key="page_index"> |
13 | <view class="sub-menu-class" :class="{'show':showPage==page_index,'hide':pageState[page_index]!=true}"> | 29 | <view class="sub-menu-class" :class="{'show':showPage==page_index,'hide':pageState[page_index]!=true}"> |
14 | <block v-if="page.type=='hierarchy'&& page.submenu.length>0"> | 30 | <block v-if="page.type=='hierarchy'&& page.submenu.length>0"> |
15 | <scroll-view class="sub-menu-list" :class="[activeMenuArr[page_index].length>1?'first':'alone']" | 31 | <scroll-view class="sub-menu-list" :class="[activeMenuArr[page_index].length>1?'first':'alone']" |
16 | :scroll-y="true" :scroll-into-view="'first_id'+firstScrollInto"> | 32 | :scroll-y="true" :scroll-into-view="'first_id'+firstScrollInto"> |
17 | <block v-for="(sub,index) in page.submenu" :key="index"> | 33 | <block v-for="(sub,index) in page.submenu" :key="index"> |
18 | <view class="sub-menu" :id="'first_id'+index" :class="{'on':activeMenuArr[page_index][0]==index}" @tap="selectHierarchyMenu(page_index,index,null,null)"> | 34 | <view class="sub-menu" :id="'first_id'+index" :class="{'on':activeMenuArr[page_index][0]==index}" @tap="selectHierarchyMenu(page_index,index,null,null)"> |
19 | <view class="menu-name"> | 35 | <view class="menu-name"> |
20 | <text>{{sub.name}}</text> | 36 | <text>{{sub.name}}</text> |
21 | <text class="iconfont selected"></text> | 37 | <text class="iconfont selected"></text> |
22 | </view> | 38 | </view> |
23 | </view> | 39 | </view> |
24 | </block> | 40 | </block> |
25 | </scroll-view> | 41 | </scroll-view> |
26 | <block v-for="(sub,index) in page.submenu" :key="index"> | 42 | <block v-for="(sub,index) in page.submenu" :key="index"> |
27 | <scroll-view class="sub-menu-list not-first" :scroll-y="true" v-if="activeMenuArr[page_index][0]==index&&sub.submenu.length>0" | 43 | <scroll-view class="sub-menu-list not-first" :scroll-y="true" v-if="activeMenuArr[page_index][0]==index&&sub.submenu.length>0" |
28 | :scroll-into-view="'second_id'+secondScrollInto"> | 44 | :scroll-into-view="'second_id'+secondScrollInto"> |
29 | <block v-for="(sub_second,second_index) in sub.submenu" :key="second_index"> | 45 | <block v-for="(sub_second,second_index) in sub.submenu" :key="second_index"> |
30 | <view class="sub-menu" :id="'second_id'+second_index" :class="{'on':activeMenuArr[page_index][1]==second_index}"> | 46 | <view class="sub-menu" :id="'second_id'+second_index" :class="{'on':activeMenuArr[page_index][1]==second_index}"> |
31 | <view class="menu-name" @tap="selectHierarchyMenu(page_index,activeMenuArr[page_index][0],second_index,null)"> | 47 | <view class="menu-name" @tap="selectHierarchyMenu(page_index,activeMenuArr[page_index][0],second_index,null)"> |
32 | <text>{{sub_second.name}}</text> | 48 | <text>{{sub_second.name}}</text> |
33 | <text class="iconfont selected"></text> | 49 | <text class="iconfont selected"></text> |
34 | </view> | 50 | </view> |
35 | <view class="more-sub-menu" v-if="sub_second.submenu&&sub.submenu.length>0&&sub_second.submenu.length>0"> | 51 | <view class="more-sub-menu" v-if="sub_second.submenu&&sub.submenu.length>0&&sub_second.submenu.length>0"> |
36 | <block v-for="(sub2,sub2_index) in sub_second.submenu" :key="sub2_index"> | 52 | <block v-for="(sub2,sub2_index) in sub_second.submenu" :key="sub2_index"> |
37 | <text v-if="sub_second.showAllSub || (sub2_index<8)" :class="{'on':activeMenuArr[page_index][1]==second_index&&activeMenuArr[page_index][2]==sub2_index}" | 53 | <text v-if="sub_second.showAllSub || (sub2_index<8)" :class="{'on':activeMenuArr[page_index][1]==second_index&&activeMenuArr[page_index][2]==sub2_index}" |
38 | @tap="selectHierarchyMenu(page_index,activeMenuArr[page_index][0],second_index,sub2_index)">{{sub2.name}}</text> | 54 | @tap="selectHierarchyMenu(page_index,activeMenuArr[page_index][0],second_index,sub2_index)">{{sub2.name}}</text> |
39 | <text v-if="sub_second.showAllSub!=true && sub2_index==8 && sub_second.submenu.length>9" @tap="showMoreSub(second_index)">更多<text | 55 | <text v-if="sub_second.showAllSub!=true && sub2_index==8 && sub_second.submenu.length>9" @tap="showMoreSub(second_index)">更多<text |
40 | class="iconfont triangle"></text></text> | 56 | class="iconfont triangle"></text></text> |
41 | </block> | 57 | </block> |
42 | </view> | 58 | </view> |
43 | </view> | 59 | </view> |
44 | </block> | 60 | </block> |
45 | </scroll-view> | 61 | </scroll-view> |
46 | </block> | 62 | </block> |
47 | </block> | 63 | </block> |
48 | <block v-if="page.type=='filter'||page.type=='checkbox'"> | 64 | <block v-if="page.type=='filter'||page.type=='checkbox'"> |
49 | <view class="filter"> | 65 | <view class="filter"> |
50 | <scroll-view class="menu-box" :scroll-y="true"> | 66 | <scroll-view class="menu-box" :scroll-y="true"> |
51 | <view class="box" v-for="(box,box_index) in page.submenu" :key="box_index"> | 67 | <view class="box" v-for="(box,box_index) in page.submenu" :key="box_index"> |
52 | <view class="title">{{box.name}}</view> | 68 | <view class="title">{{box.name}}</view> |
53 | <view class="labels"> | 69 | <view class="labels"> |
54 | <view v-for="(label,label_index) in box.submenu" :key="label_index" @tap="selectFilterLabel(page_index,box_index,label_index)" | 70 | <view v-for="(label,label_index) in box.submenu" :key="label_index" @tap="selectFilterLabel(page_index,box_index,label_index)" |
55 | :class="{'on':label.selected}">{{label.name}}</view> | 71 | :class="{'on':label.selected}">{{label.name}}</view> |
56 | </view> | 72 | </view> |
57 | </view> | 73 | </view> |
58 | </scroll-view> | 74 | </scroll-view> |
59 | <view class="btn-box"> | 75 | <view class="btn-box"> |
60 | <view class="reset" @tap="resetFilterData(page_index)">重置</view> | 76 | <view class="reset" @tap="resetFilterData(page_index)">重置</view> |
61 | <view class="submit" @tap="setFilterData(page_index)">确定</view> | 77 | <view class="submit" @tap="setFilterData(page_index)">确定</view> |
62 | </view> | 78 | </view> |
63 | </view> | 79 | </view> |
64 | </block> | 80 | </block> |
65 | <block v-if="page.type=='radio'"> | 81 | <block v-if="page.type=='radio'"> |
66 | <view class="filter"> | 82 | <view class="filter"> |
67 | <scroll-view class="menu-box" :scroll-y="true"> | 83 | <scroll-view class="menu-box" :scroll-y="true"> |
68 | <view class="box" v-for="(box,box_index) in page.submenu" :key="box_index"> | 84 | <view class="box" v-for="(box,box_index) in page.submenu" :key="box_index"> |
69 | <view class="title">{{box.name}}</view> | 85 | <view class="title">{{box.name}}</view> |
70 | <view class="labels"> | 86 | <view class="labels"> |
71 | <view v-for="(label,label_index) in box.submenu" :key="label_index" @tap="selectRadioLabel(page_index,box_index,label_index)" | 87 | <view v-for="(label,label_index) in box.submenu" :key="label_index" @tap="selectRadioLabel(page_index,box_index,label_index)" |
72 | :class="{'on':label.selected}">{{label.name}}</view> | 88 | :class="{'on':label.selected}">{{label.name}}</view> |
73 | </view> | 89 | </view> |
74 | </view> | 90 | </view> |
75 | </scroll-view> | 91 | </scroll-view> |
76 | <view class="btn-box"> | 92 | <view class="btn-box"> |
77 | <view class="reset" @tap="resetFilterData(page_index)">重置</view> | 93 | <view class="reset" @tap="resetFilterData(page_index)">重置</view> |
78 | <view class="submit" @tap="setFilterData(page_index)">确定</view> | 94 | <view class="submit" @tap="setFilterData(page_index)">确定</view> |
79 | </view> | 95 | </view> |
80 | </view> | 96 | </view> |
81 | </block> | 97 | </block> |
82 | </view> | 98 | </view> |
83 | </block> | 99 | </block> |
84 | </view> | 100 | </view> |
85 | </template> | 101 | </template> |
86 | <script> | 102 | <script> |
87 | export default { | 103 | export default { |
88 | data() { | 104 | data() { |
89 | return { | 105 | return { |
90 | subData: [], //菜单数据 | 106 | subData: [], //菜单数据 |
91 | menu: [], //顶部横条数据 | 107 | menu: [], //顶部横条数据 |
92 | showPage: -1, //菜单页面显示/隐藏动画控制 | 108 | showPage: -1, //菜单页面显示/隐藏动画控制 |
93 | pageState: [], //页面的状态 | 109 | pageState: [], //页面的状态 |
94 | activeMenuArr: [], //UI状态 | 110 | activeMenuArr: [], //UI状态 |
95 | shadowActiveMenuArr: [], //记录选中 | 111 | shadowActiveMenuArr: [], //记录选中 |
96 | defaultActive:[], | 112 | defaultActive:[], |
97 | triangleDeg: [], //小三角形的翻转动画控制 | 113 | triangleDeg: [], //小三角形的翻转动画控制 |
98 | isShowMask: false, //遮罩层显示/隐藏动画控制 | 114 | isShowMask: false, //遮罩层显示/隐藏动画控制 |
99 | maskVisibility: false, //遮罩层显示/隐藏状态 | 115 | maskVisibility: false, //遮罩层显示/隐藏状态 |
100 | //滚动区域定位 | 116 | //滚动区域定位 |
101 | firstScrollInto: 0, | 117 | firstScrollInto: 0, |
102 | secondScrollInto: 0, | 118 | secondScrollInto: 0, |
103 | componentTop:0 ,//组件top | 119 | componentTop:0 ,//组件top |
104 | isReadNewSelect:false | 120 | isReadNewSelect:false, |
121 | on: [1,0,0,0,0], | ||
105 | } | 122 | } |
106 | }, | 123 | }, |
107 | props: { | 124 | props: { |
108 | filterData: { | 125 | filterData: { |
109 | value: Array, | 126 | value: Array, |
110 | default: [] | 127 | default: [] |
111 | }, | 128 | }, |
112 | defaultSelected:{ | 129 | defaultSelected:{ |
113 | value: Array, | 130 | value: Array, |
114 | default: [] | 131 | default: [] |
115 | }, | 132 | }, |
116 | updateMenuName:{ | 133 | updateMenuName:{ |
117 | value: Boolean, | 134 | value: Boolean, |
118 | default: true | 135 | default: true |
119 | }, | 136 | }, |
120 | dataFormat:{ | 137 | dataFormat:{ |
121 | value: String, | 138 | value: String, |
122 | default: 'Array' | 139 | default: 'Array' |
123 | } | 140 | } |
124 | }, | 141 | }, |
125 | watch: { | 142 | watch: { |
126 | filterData: { | 143 | filterData: { |
127 | handler() { | 144 | handler() { |
128 | this.initMenu(); //filterData重新赋值初始化菜单 | 145 | this.initMenu(); //filterData重新赋值初始化菜单 |
129 | }, | 146 | }, |
130 | immediate: true | 147 | immediate: true |
131 | }, | 148 | }, |
132 | defaultSelected(newVal) { | 149 | defaultSelected(newVal) { |
133 | if(newVal.length==0){ | 150 | if(newVal.length==0){ |
134 | return; | 151 | return; |
135 | } | 152 | } |
136 | this.defaultActive = JSON.parse(JSON.stringify(newVal)); | 153 | this.defaultActive = JSON.parse(JSON.stringify(newVal)); |
137 | this.activeMenuArr = JSON.parse(JSON.stringify(newVal)); | 154 | this.activeMenuArr = JSON.parse(JSON.stringify(newVal)); |
138 | this.shadowActiveMenuArr = JSON.parse(JSON.stringify(newVal)); | 155 | this.shadowActiveMenuArr = JSON.parse(JSON.stringify(newVal)); |
139 | if(this.updateMenuName){ | 156 | // if(this.updateMenuName){ |
140 | this.setMenuName(); | 157 | // this.setMenuName(); |
141 | } | 158 | // } |
142 | } | 159 | } |
143 | }, | 160 | }, |
144 | methods: { | 161 | methods: { |
145 | initMenu() { | 162 | initMenu() { |
146 | let tmpMenuActiveArr=[]; | 163 | let tmpMenuActiveArr=[]; |
147 | let tmpMenu=[]; | 164 | let tmpMenu=[]; |
148 | for (let i = 0; i < this.filterData.length; i++) { | 165 | for (let i = 0; i < this.filterData.length; i++) { |
149 | let tmpitem = this.filterData[i]; | 166 | let tmpitem = this.filterData[i]; |
150 | tmpMenu.push({ | 167 | tmpMenu.push({ |
151 | //如果没有设置name,则取第一个菜单作为menu.name,filter类型则将"筛选"作为menu.name | 168 | //如果没有设置name,则取第一个菜单作为menu.name,filter类型则将"筛选"作为menu.name |
152 | name: tmpitem.name || (tmpitem.type == "filter" ? "筛选" : tmpitem.submenu[0].name), | 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 | tmpMenuActiveArr.push(this.processActive(tmpitem)); | 174 | tmpMenuActiveArr.push(this.processActive(tmpitem)); |
157 | //初始化角度数组 | 175 | // 初始化角度数组 |
158 | this.triangleDeg.push(0); | 176 | this.triangleDeg.push(0); |
159 | //初始化控制显示状态数组 | 177 | // 初始化控制显示状态数组 |
160 | this.pageState.push(false); | 178 | this.pageState.push(false); |
161 | //递归处理子菜单数据 | 179 | // 递归处理子菜单数据 |
162 | tmpitem = this.processSubMenu(tmpitem); | 180 | tmpitem = this.processSubMenu(tmpitem); |
163 | this.filterData[i] = tmpitem; | 181 | this.filterData[i] = tmpitem; |
164 | } | 182 | } |
165 | this.menu = tmpMenu; | 183 | this.menu = tmpMenu; |
166 | //初始化选中项数组 | 184 | // 初始化选中项数组 |
167 | tmpMenuActiveArr = this.defaultActive.length>0?this.defaultActive:this.activeMenuArr.length>0?this.activeMenuArr:tmpMenuActiveArr; | 185 | tmpMenuActiveArr = this.defaultActive.length>0?this.defaultActive:this.activeMenuArr.length>0?this.activeMenuArr:tmpMenuActiveArr; |
168 | this.defaultActive = []; | 186 | this.defaultActive = []; |
169 | this.activeMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr)); | 187 | this.activeMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr)); |
170 | this.shadowActiveMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr)); | 188 | this.shadowActiveMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr)); |
171 | //加载菜单数据 | 189 | // 加载菜单数据 |
172 | this.subData = this.filterData; | 190 | this.subData = this.filterData; |
173 | //设定顶部菜单名字 | 191 | // 设定顶部菜单名字 |
174 | if(this.updateMenuName){ | 192 | // if(this.updateMenuName){ |
175 | this.setMenuName(); | 193 | // this.setMenuName(); |
176 | } | 194 | // } |
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 | } | ||
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 | showMoreSub(index) { | 219 | showMoreSub(index) { |
202 | this.subData[this.showPage].submenu[this.activeMenuArr[this.showPage][0]].submenu[index].showAllSub = true; | 220 | this.subData[this.showPage].submenu[this.activeMenuArr[this.showPage][0]].submenu[index].showAllSub = true; |
203 | this.$forceUpdate(); | 221 | this.$forceUpdate(); |
204 | }, | 222 | }, |
205 | //选中 | 223 | //选中 |
206 | selectHierarchyMenu(page_index, level1_index, level2_index, level3_index) { | 224 | selectHierarchyMenu(page_index, level1_index, level2_index, level3_index) { |
207 | //读取记录 | 225 | //读取记录 |
208 | if (level1_index != null && level2_index == null && level3_index == null && this.shadowActiveMenuArr[page_index][0] == | 226 | if (level1_index != null && level2_index == null && level3_index == null && this.shadowActiveMenuArr[page_index][0] == |
209 | level1_index) { | 227 | level1_index) { |
210 | this.activeMenuArr.splice(page_index, 1, JSON.parse(JSON.stringify(this.shadowActiveMenuArr[page_index]))); | 228 | this.activeMenuArr.splice(page_index, 1, JSON.parse(JSON.stringify(this.shadowActiveMenuArr[page_index]))); |
211 | } else { | 229 | } else { |
212 | this.activeMenuArr[page_index].splice(0, 1, level1_index); | 230 | this.activeMenuArr[page_index].splice(0, 1, level1_index); |
213 | (level2_index!=null||this.activeMenuArr[page_index].length>=2)&&this.activeMenuArr[page_index].splice(1, 1, level2_index) || this.activeMenuArr[page_index].splice(1, 1); | 231 | (level2_index!=null||this.activeMenuArr[page_index].length>=2)&&this.activeMenuArr[page_index].splice(1, 1, level2_index) || this.activeMenuArr[page_index].splice(1, 1); |
214 | (level3_index!=null||this.activeMenuArr[page_index].length>=3)&&this.activeMenuArr[page_index].splice(2, 1, level3_index) || this.activeMenuArr[page_index].splice(2, 1); | 232 | (level3_index!=null||this.activeMenuArr[page_index].length>=3)&&this.activeMenuArr[page_index].splice(2, 1, level3_index) || this.activeMenuArr[page_index].splice(2, 1); |
215 | } | 233 | } |
216 | //写入结果 | 234 | //写入结果 |
217 | if (level3_index != null || level2_index != null || (level1_index != null && this.subData[page_index].submenu[level1_index].submenu.length == 0) | 235 | if (level3_index != null || level2_index != null || (level1_index != null && this.subData[page_index].submenu[level1_index].submenu.length == 0) |
218 | ) { | 236 | ) { |
219 | let sub = this.subData[page_index].submenu[level1_index].submenu[level2_index]; | 237 | let sub = this.subData[page_index].submenu[level1_index].submenu[level2_index]; |
220 | if(this.updateMenuName){ | 238 | // 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; | 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; |
222 | } | 240 | // } |
223 | this.shadowActiveMenuArr[page_index] = JSON.parse(JSON.stringify(this.activeMenuArr[page_index])); | 241 | this.shadowActiveMenuArr[page_index] = JSON.parse(JSON.stringify(this.activeMenuArr[page_index])); |
224 | this.togglePage(this.showPage); | 242 | this.togglePage(this.showPage); |
225 | } | 243 | } |
226 | }, | 244 | }, |
227 | //写入结果,筛选 | 245 | //写入结果,筛选 |
228 | setFilterData(page_index) { | 246 | setFilterData(page_index) { |
229 | this.shadowActiveMenuArr[page_index] = JSON.parse(JSON.stringify(this.activeMenuArr[page_index])); | 247 | this.shadowActiveMenuArr[page_index] = JSON.parse(JSON.stringify(this.activeMenuArr[page_index])); |
230 | this.togglePage(this.showPage); | 248 | this.togglePage(this.showPage); |
231 | }, | 249 | }, |
232 | //重置结果和ui,筛选 | 250 | //重置结果和ui,筛选 |
233 | resetFilterData(page_index) { | 251 | resetFilterData(page_index) { |
234 | let tmpArr = []; | 252 | let tmpArr = []; |
235 | let level = this.shadowActiveMenuArr[page_index].length; | 253 | let level = this.shadowActiveMenuArr[page_index].length; |
236 | while (level > 0) { | 254 | while (level > 0) { |
237 | tmpArr.push([]); | 255 | tmpArr.push([]); |
238 | let box = this.subData[page_index].submenu[level - 1].submenu; | 256 | let box = this.subData[page_index].submenu[level - 1].submenu; |
239 | for (let i = 0; i < box.length; i++) { | 257 | for (let i = 0; i < box.length; i++) { |
240 | this.subData[page_index].submenu[level - 1].submenu[i].selected = false; | 258 | this.subData[page_index].submenu[level - 1].submenu[i].selected = false; |
241 | } | 259 | } |
242 | level--; | 260 | level--; |
243 | } | 261 | } |
244 | this.activeMenuArr[page_index] = JSON.parse(JSON.stringify(tmpArr)); | 262 | this.activeMenuArr[page_index] = JSON.parse(JSON.stringify(tmpArr)); |
245 | this.$forceUpdate(); | 263 | this.$forceUpdate(); |
246 | }, | 264 | }, |
247 | //选中筛选类label-UI状态 | 265 | //选中筛选类label-UI状态 |
248 | selectFilterLabel(page_index, box_index, label_index) { | 266 | selectFilterLabel(page_index, box_index, label_index) { |
249 | let find_index = this.activeMenuArr[page_index][box_index].indexOf(label_index); | 267 | let find_index = this.activeMenuArr[page_index][box_index].indexOf(label_index); |
250 | if (find_index > -1) { | 268 | if (find_index > -1) { |
251 | this.activeMenuArr[page_index][box_index].splice(find_index, 1); | 269 | this.activeMenuArr[page_index][box_index].splice(find_index, 1); |
252 | this.subData[page_index].submenu[box_index].submenu[label_index].selected = false; | 270 | this.subData[page_index].submenu[box_index].submenu[label_index].selected = false; |
253 | } else { | 271 | } else { |
254 | this.activeMenuArr[page_index][box_index].push(label_index); | 272 | this.activeMenuArr[page_index][box_index].push(label_index); |
255 | this.subData[page_index].submenu[box_index].submenu[label_index].selected = true; | 273 | this.subData[page_index].submenu[box_index].submenu[label_index].selected = true; |
256 | } | 274 | } |
257 | this.$forceUpdate(); | 275 | this.$forceUpdate(); |
258 | }, | 276 | }, |
259 | //选中单选类label-UI状态 | 277 | //选中单选类label-UI状态 |
260 | selectRadioLabel(page_index, box_index, label_index) { | 278 | selectRadioLabel(page_index, box_index, label_index) { |
261 | 279 | ||
262 | let activeIndex = this.activeMenuArr[page_index][box_index][0]; | 280 | let activeIndex = this.activeMenuArr[page_index][box_index][0]; |
263 | if(activeIndex == label_index){ | 281 | if(activeIndex == label_index){ |
264 | this.subData[page_index].submenu[box_index].submenu[activeIndex].selected = false; | 282 | this.subData[page_index].submenu[box_index].submenu[activeIndex].selected = false; |
265 | this.activeMenuArr[page_index][box_index][0] = null; | 283 | this.activeMenuArr[page_index][box_index][0] = null; |
266 | }else{ | 284 | }else{ |
267 | if(activeIndex!=null && activeIndex<this.subData[page_index].submenu[box_index].submenu.length){ | 285 | if(activeIndex!=null && activeIndex<this.subData[page_index].submenu[box_index].submenu.length){ |
268 | this.subData[page_index].submenu[box_index].submenu[activeIndex].selected = false; | 286 | this.subData[page_index].submenu[box_index].submenu[activeIndex].selected = false; |
269 | } | 287 | } |
270 | 288 | ||
271 | this.subData[page_index].submenu[box_index].submenu[label_index].selected = true; | 289 | this.subData[page_index].submenu[box_index].submenu[label_index].selected = true; |
272 | this.activeMenuArr[page_index][box_index][0] = label_index; | 290 | this.activeMenuArr[page_index][box_index][0] = label_index; |
273 | } | 291 | } |
274 | this.$forceUpdate(); | 292 | this.$forceUpdate(); |
275 | }, | 293 | }, |
276 | //菜单开关 | 294 | //菜单开关 |
277 | togglePage(index) { | 295 | togglePage(index) { |
278 | if (index == this.showPage) { | 296 | if (index == this.showPage) { |
279 | this.hidePageLayer(true); | 297 | this.hidePageLayer(true); |
280 | this.hideMask(); | 298 | this.hideMask(); |
281 | this.showPage = -1; | 299 | this.showPage = -1; |
282 | } else { | 300 | } else { |
283 | if (this.showPage > -1) { | 301 | if (this.showPage > -1) { |
284 | this.hidePageLayer(false); | 302 | this.hidePageLayer(false); |
285 | } | 303 | } |
286 | this.showPageLayer(index); | 304 | this.showPageLayer(index); |
287 | this.showMask(); | 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 | //hide遮罩层 | 321 | //hide遮罩层 |
291 | hideMask() { | 322 | hideMask() { |
292 | this.isShowMask = false; | 323 | this.isShowMask = false; |
293 | setTimeout(() => { | 324 | setTimeout(() => { |
294 | this.maskVisibility = false; | 325 | this.maskVisibility = false; |
295 | }, 200); | 326 | }, 200); |
296 | }, | 327 | }, |
297 | //show遮罩层 | 328 | //show遮罩层 |
298 | showMask() { | 329 | showMask() { |
299 | this.maskVisibility = true; | 330 | this.maskVisibility = true; |
300 | this.$nextTick(() => { | 331 | this.$nextTick(() => { |
301 | setTimeout(() => { | 332 | setTimeout(() => { |
302 | this.isShowMask = true; | 333 | this.isShowMask = true; |
303 | }, 0); | 334 | }, 0); |
304 | }) | 335 | }) |
305 | }, | 336 | }, |
306 | //hide菜单页 | 337 | //hide菜单页 |
307 | hidePageLayer(isAnimation) { | 338 | hidePageLayer(isAnimation) { |
308 | this.triangleDeg[this.showPage] = 0; | 339 | this.triangleDeg[this.showPage] = 0; |
309 | let tmpIndex = this.showPage; | 340 | let tmpIndex = this.showPage; |
310 | if (isAnimation) { | 341 | if (isAnimation) { |
311 | setTimeout(() => { | 342 | setTimeout(() => { |
312 | this.pageState.splice(tmpIndex, 1, false); | 343 | this.pageState.splice(tmpIndex, 1, false); |
313 | }, 200); | 344 | }, 200); |
314 | this.confirm(); | 345 | this.confirm(); |
315 | } else { | 346 | } else { |
316 | this.pageState.splice(tmpIndex, 1, false) | 347 | this.pageState.splice(tmpIndex, 1, false) |
317 | } | 348 | } |
318 | this.firstScrollInto = null; | 349 | this.firstScrollInto = null; |
319 | this.secondScrollInto = null; | 350 | this.secondScrollInto = null; |
320 | }, | 351 | }, |
321 | confirm() { | 352 | confirm() { |
322 | let index = JSON.parse(JSON.stringify(this.shadowActiveMenuArr)); | 353 | let index = JSON.parse(JSON.stringify(this.shadowActiveMenuArr)); |
323 | let value = JSON.parse(JSON.stringify(this.shadowActiveMenuArr)); | 354 | let value = JSON.parse(JSON.stringify(this.shadowActiveMenuArr)); |
324 | 355 | ||
325 | //对结果做一下处理 | 356 | //对结果做一下处理 |
326 | index.forEach((item, i) => { | 357 | index.forEach((item, i) => { |
327 | if (typeof(item[0]) == 'object') { | 358 | if (typeof(item[0]) == 'object') { |
328 | //针对筛选结果过一个排序 | 359 | //针对筛选结果过一个排序 |
329 | item.forEach((s, j) => { | 360 | item.forEach((s, j) => { |
330 | if(s!=null){ | 361 | if(s!=null){ |
331 | s.sort((val1, val2) => { | 362 | s.sort((val1, val2) => { |
332 | return val1 - val2; | 363 | return val1 - val2; |
333 | }); | 364 | }); |
334 | item[j] = s; | 365 | item[j] = s; |
335 | s.forEach((v, k) => { | 366 | s.forEach((v, k) => { |
336 | value[i][j][k] = (v==null||v>=this.subData[i].submenu[j].submenu.length)?null:this.subData[i].submenu[j].submenu[v].value; | 367 | value[i][j][k] = (v==null||v>=this.subData[i].submenu[j].submenu.length)?null:this.subData[i].submenu[j].submenu[v].value; |
337 | if(this.subData[i].type == 'radio' && value[i][j][k] == null){ | 368 | if(this.subData[i].type == 'radio' && value[i][j][k] == null){ |
338 | value[i][j] = []; | 369 | value[i][j] = []; |
339 | index[i][j] = []; | 370 | index[i][j] = []; |
340 | } | 371 | } |
341 | }); | 372 | }); |
342 | } | 373 | } |
343 | }); | 374 | }); |
344 | }else{ | 375 | }else{ |
345 | let submenu = this.subData[i].submenu[item[0]]; | 376 | let submenu = this.subData[i].submenu[item[0]]; |
346 | // console.log(this.subData[i]) | 377 | value[i][0] = submenu && submenu.value; |
347 | value[i][0] = submenu.value; | ||
348 | if(value[i].length>=2 && item[1]!=null){ | 378 | if(value[i].length>=2 && item[1]!=null){ |
349 | if(submenu.submenu.length>0){ | 379 | if(submenu.submenu.length>0){ |
350 | submenu = submenu.submenu[item[1]]; | 380 | submenu = submenu.submenu[item[1]]; |
351 | value[i][1] = submenu.hasOwnProperty('value')?submenu.value:null; | 381 | value[i][1] = submenu.hasOwnProperty('value')?submenu.value:null; |
352 | }else{ | 382 | }else{ |
353 | value[i][1] = null | 383 | value[i][1] = null |
354 | } | 384 | } |
355 | if(value[i].length>=3 && item[2]!=null){ | 385 | if(value[i].length>=3 && item[2]!=null){ |
356 | if(submenu.submenu.length>0){ | 386 | if(submenu.submenu.length>0){ |
357 | submenu = submenu.submenu[item[2]]; | 387 | submenu = submenu.submenu[item[2]]; |
358 | value[i][2] = submenu.hasOwnProperty('value')?submenu.value:null; | 388 | value[i][2] = submenu.hasOwnProperty('value')?submenu.value:null; |
359 | }else{ | 389 | }else{ |
360 | value[i][2] = null; | 390 | value[i][2] = null; |
361 | } | 391 | } |
362 | } | 392 | } |
363 | } | 393 | } |
364 | } | 394 | } |
365 | index[i] = item; | 395 | index[i] = item; |
366 | 396 | ||
367 | }); | 397 | }); |
368 | // 输出 | 398 | // 输出 |
369 | this.$emit('confirm', { | 399 | this.$emit('search', { |
370 | index: index, | 400 | index: index, |
371 | value: value | 401 | value: value, |
402 | on: this.on, | ||
372 | }); | 403 | }); |
373 | }, | 404 | }, |
374 | //show菜单页 | 405 | //show菜单页 |
375 | showPageLayer(index) { | 406 | showPageLayer(index) { |
376 | this.processPage(index); | 407 | this.processPage(index); |
377 | this.pageState.splice(index, 1, true); | 408 | this.pageState.splice(index, 1, true); |
378 | this.$nextTick(() => { | 409 | this.$nextTick(() => { |
379 | setTimeout(() => { | 410 | setTimeout(() => { |
380 | this.showPage = index; | 411 | this.showPage = index; |
381 | }, 0); | 412 | }, 0); |
382 | }) | 413 | }) |
383 | this.triangleDeg[index] = 180; | 414 | this.triangleDeg[index] = 180; |
384 | }, | 415 | }, |
385 | reloadActiveMenuArr(){ | 416 | reloadActiveMenuArr(){ |
386 | for (let i = 0; i < this.filterData.length; i++) { | 417 | for (let i = 0; i < this.filterData.length; i++) { |
387 | let tmpitem = this.filterData[i]; | 418 | let tmpitem = this.filterData[i]; |
388 | let tmpArr = this.processActive(tmpitem); | 419 | let tmpArr = this.processActive(tmpitem); |
389 | tmpitem = this.processSubMenu(tmpitem); | 420 | tmpitem = this.processSubMenu(tmpitem); |
390 | if(this.activeMenuArr[i].length!=tmpArr.length){ | 421 | if(this.activeMenuArr[i].length!=tmpArr.length){ |
391 | this.filterData[i] = tmpitem; | 422 | this.filterData[i] = tmpitem; |
392 | this.activeMenuArr.splice(i, 1, JSON.parse(JSON.stringify(tmpArr))); | 423 | this.activeMenuArr.splice(i, 1, JSON.parse(JSON.stringify(tmpArr))); |
393 | this.shadowActiveMenuArr.splice(i, 1, JSON.parse(JSON.stringify(tmpArr))); | 424 | this.shadowActiveMenuArr.splice(i, 1, JSON.parse(JSON.stringify(tmpArr))); |
394 | } | 425 | } |
395 | } | 426 | } |
396 | this.subData = this.filterData; | 427 | this.subData = this.filterData; |
397 | this.$forceUpdate(); | 428 | this.$forceUpdate(); |
398 | }, | 429 | }, |
399 | processPage(index) { | 430 | processPage(index) { |
400 | //check UI控制数组,结果数组,防止传入数据层级和UI控制数组不同步 | 431 | //check UI控制数组,结果数组,防止传入数据层级和UI控制数组不同步 |
401 | this.reloadActiveMenuArr(); | 432 | this.reloadActiveMenuArr(); |
402 | //重置UI控制数组 | 433 | //重置UI控制数组 |
403 | this.activeMenuArr.splice(index, 1, JSON.parse(JSON.stringify(this.shadowActiveMenuArr[index]))); | 434 | this.activeMenuArr.splice(index, 1, JSON.parse(JSON.stringify(this.shadowActiveMenuArr[index]))); |
404 | if (this.menu[index].type == 'filter') { | 435 | if (this.menu[index].type == 'filter') { |
405 | //重载筛选页选中状态 | 436 | //重载筛选页选中状态 |
406 | let level = this.shadowActiveMenuArr[index].length; | 437 | let level = this.shadowActiveMenuArr[index].length; |
407 | for (let i = 0; i < level; i++) { | 438 | for (let i = 0; i < level; i++) { |
408 | let box = this.subData[index].submenu[i].submenu; | 439 | let box = this.subData[index].submenu[i].submenu; |
409 | for (let j = 0; j < box.length; j++) { | 440 | for (let j = 0; j < box.length; j++) { |
410 | if (this.shadowActiveMenuArr[index][i].indexOf(j) > -1) { | 441 | if (this.shadowActiveMenuArr[index][i].indexOf(j) > -1) { |
411 | this.subData[index].submenu[i].submenu[j].selected = true; | 442 | this.subData[index].submenu[i].submenu[j].selected = true; |
412 | } else { | 443 | } else { |
413 | this.subData[index].submenu[i].submenu[j].selected = false; | 444 | this.subData[index].submenu[i].submenu[j].selected = false; |
414 | } | 445 | } |
415 | } | 446 | } |
416 | } | 447 | } |
417 | } else if (this.menu[index].type == 'hierarchy') { | 448 | } else if (this.menu[index].type == 'hierarchy') { |
418 | this.$nextTick(() => { | 449 | this.$nextTick(() => { |
419 | setTimeout(() => { | 450 | setTimeout(() => { |
420 | //滚动到选中项 | 451 | //滚动到选中项 |
421 | this.firstScrollInto = parseInt(this.activeMenuArr[index][0]); | 452 | this.firstScrollInto = parseInt(this.activeMenuArr[index][0]); |
422 | this.secondScrollInto = parseInt(this.activeMenuArr[index][1]); | 453 | this.secondScrollInto = parseInt(this.activeMenuArr[index][1]); |
423 | }, 0); | 454 | }, 0); |
424 | }) | 455 | }) |
425 | } else if (this.menu[index].type == 'radio') { | 456 | } else if (this.menu[index].type == 'radio') { |
426 | //重载筛选页选中状态 | 457 | //重载筛选页选中状态 |
427 | let level = this.shadowActiveMenuArr[index].length; | 458 | let level = this.shadowActiveMenuArr[index].length; |
428 | for (let i = 0; i < level; i++) { | 459 | for (let i = 0; i < level; i++) { |
429 | let box = this.subData[index].submenu[i].submenu; | 460 | let box = this.subData[index].submenu[i].submenu; |
430 | for (let j = 0; j < box.length; j++) { | 461 | for (let j = 0; j < box.length; j++) { |
431 | if (this.shadowActiveMenuArr[index][i].indexOf(j) > -1) { | 462 | if (this.shadowActiveMenuArr[index][i].indexOf(j) > -1) { |
432 | this.subData[index].submenu[i].submenu[j].selected = true; | 463 | this.subData[index].submenu[i].submenu[j].selected = true; |
433 | } else { | 464 | } else { |
434 | this.subData[index].submenu[i].submenu[j].selected = false; | 465 | this.subData[index].submenu[i].submenu[j].selected = false; |
435 | } | 466 | } |
436 | } | 467 | } |
437 | } | 468 | } |
438 | } | 469 | } |
439 | }, | 470 | }, |
440 | processActive(tmpitem) { | 471 | processActive(tmpitem) { |
441 | let tmpArr = [] | 472 | let tmpArr = [] |
442 | if (tmpitem.type == 'hierarchy'&&tmpitem.hasOwnProperty('submenu')&&tmpitem.submenu.length>0) { | 473 | if (tmpitem.type == 'hierarchy'&&tmpitem.hasOwnProperty('submenu')&&tmpitem.submenu.length>0) { |
443 | let level = this.getMaxFloor(tmpitem.submenu); | 474 | let level = this.getMaxFloor(tmpitem.submenu); |
444 | while (level > 0) { | 475 | while (level > 0) { |
445 | tmpArr.push(0); | 476 | tmpArr.push(0); |
446 | level--; | 477 | level--; |
447 | } | 478 | } |
448 | } else if (tmpitem.type == 'filter') { | 479 | } else if (tmpitem.type == 'filter') { |
449 | let level = tmpitem.submenu.length; | 480 | let level = tmpitem.submenu.length; |
450 | while (level > 0) { | 481 | while (level > 0) { |
451 | tmpArr.push([]); | 482 | tmpArr.push([]); |
452 | level--; | 483 | level--; |
453 | } | 484 | } |
454 | } else if (tmpitem.type == 'radio') { | 485 | } else if (tmpitem.type == 'radio') { |
455 | let level = tmpitem.submenu.length; | 486 | let level = tmpitem.submenu.length; |
456 | while (level > 0) { | 487 | while (level > 0) { |
457 | tmpArr.push([]); | 488 | tmpArr.push([]); |
458 | level--; | 489 | level--; |
459 | } | 490 | } |
460 | } | 491 | } |
461 | return tmpArr; | 492 | return tmpArr; |
462 | }, | 493 | }, |
463 | processSubMenu(menu) { | 494 | processSubMenu(menu) { |
464 | if (menu.hasOwnProperty('submenu') && menu.submenu.length > 0) { | 495 | if (menu.hasOwnProperty('submenu') && menu.submenu.length > 0) { |
465 | for (let i = 0; i < menu.submenu.length; i++) { | 496 | for (let i = 0; i < menu.submenu.length; i++) { |
466 | menu.submenu[i] = this.processSubMenu(menu.submenu[i]); | 497 | menu.submenu[i] = this.processSubMenu(menu.submenu[i]); |
467 | } | 498 | } |
468 | } else { | 499 | } else { |
469 | menu.submenu = []; | 500 | menu.submenu = []; |
470 | } | 501 | } |
471 | return menu; | 502 | return menu; |
472 | }, | 503 | }, |
473 | //计算菜单层级 | 504 | //计算菜单层级 |
474 | getMaxFloor(treeData) { | 505 | getMaxFloor(treeData) { |
475 | let floor = 0 | 506 | let floor = 0 |
476 | let max = 0 | 507 | let max = 0 |
477 | function each(data, floor) { | 508 | function each(data, floor) { |
478 | data.forEach(e => { | 509 | data.forEach(e => { |
479 | max = floor > max ? floor : max; | 510 | max = floor > max ? floor : max; |
480 | if (e.hasOwnProperty('submenu') && e.submenu.length > 0) { | 511 | if (e.hasOwnProperty('submenu') && e.submenu.length > 0) { |
481 | each(e.submenu, floor + 1) | 512 | each(e.submenu, floor + 1) |
482 | } | 513 | } |
483 | }) | 514 | }) |
484 | } | 515 | } |
485 | each(treeData, 1) | 516 | each(treeData, 1) |
486 | return max; | 517 | return max; |
487 | }, | 518 | }, |
488 | discard() { | 519 | discard() { |
489 | 520 | ||
490 | } | 521 | } |
491 | } | 522 | } |
492 | } | 523 | } |
493 | </script> | 524 | </script> |
494 | <style lang="scss"> | 525 | <style lang="scss"> |
495 | .HMfilterDropdown { | 526 | .HMfilterDropdown { |
496 | flex-shrink: 0; | 527 | flex-shrink: 0; |
497 | width: 100%; | 528 | width: 100%; |
498 | height: 44px; | 529 | height: 44px; |
499 | position: fixed; | 530 | position: fixed; |
500 | z-index: 997; | 531 | z-index: 997; |
501 | flex-wrap: nowrap; | 532 | flex-wrap: nowrap; |
502 | display: flex; | 533 | display: flex; |
503 | flex-direction: row; | 534 | flex-direction: row; |
504 | top: var(--window-top); | 535 | top: var(--window-top); |
505 | left:0; | 536 | left:0; |
506 | view { | 537 | view { |
507 | display: flex; | 538 | display: flex; |
508 | flex-wrap: nowrap; | 539 | flex-wrap: nowrap; |
509 | } | 540 | } |
510 | } | 541 | } |
511 | .region { | 542 | .region { |
512 | flex: 1; | 543 | flex: 1; |
513 | height: 44px; | 544 | height: 44px; |
514 | } | 545 | } |
515 | .nav { | 546 | .nav { |
516 | width: 100%; | 547 | width: 100%; |
517 | height: 44px; | 548 | height: 44px; |
518 | border-bottom: solid 1rpx #eee; | ||
519 | z-index: 12; | 549 | z-index: 12; |
520 | background-color: #ffffff; | 550 | background-color: #ffffff; |
521 | flex-direction: row; | 551 | flex-direction: row; |
522 | .first-menu { | 552 | .first-menu { |
523 | width: 100%; | 553 | width: 100%; |
524 | font-size: 13px; | 554 | font-size: 16px; |
525 | color: #333333; | 555 | color: #333333; |
526 | flex-direction: row; | 556 | flex-direction: row; |
527 | align-items: center; | 557 | align-items: center; |
528 | justify-content: center; | 558 | justify-content: center; |
529 | transition: color .2s linear; | 559 | transition: color .2s linear; |
530 | 560 | ||
531 | &.on { | 561 | &.on { |
532 | color: #FF6B4A; | 562 | color: #FF6B4A; |
533 | 563 | ||
534 | .iconfont { | 564 | .iconfont { |
535 | color: #FF6B4A; | 565 | color: #FF6B4A; |
536 | } | 566 | } |
537 | } | 567 | } |
538 | .name { | 568 | .name { |
539 | height: 20px; | 569 | height: 20px; |
570 | // font-size: 16px; | ||
540 | text-align: center; | 571 | text-align: center; |
541 | text-overflow: clip; | 572 | text-overflow: clip; |
542 | overflow: hidden; | 573 | overflow: hidden; |
543 | } | 574 | } |
544 | .iconfont { | 575 | .iconfont { |
545 | width: 13px; | 576 | width: 13px; |
546 | height: 13px; | 577 | height: 13px; |
578 | line-height: 16px; | ||
547 | align-items: center; | 579 | align-items: center; |
548 | justify-content: center; | 580 | justify-content: center; |
549 | transition: transform .2s linear, color .2s linear; | 581 | transition: transform .2s linear, color .2s linear; |
550 | } | 582 | } |
551 | } | 583 | } |
552 | } | 584 | } |
553 | .sub-menu-class { | 585 | .sub-menu-class { |
554 | width: 100%; | 586 | width: 100%; |
555 | position: absolute; | 587 | position: absolute; |
556 | left: 0; | 588 | left: 0; |
557 | transform: translate3d(0, - 100%, 0); | 589 | transform: translate3d(0, - 100%, 0); |
558 | max-height: 345px; | 590 | max-height: 345px; |
559 | background-color: #ffffff; | 591 | background-color: #ffffff; |
560 | z-index: 11; | 592 | z-index: 11; |
561 | box-shadow: 0 5px 5px rgba(0, 0, 0, .1); | 593 | box-shadow: 0 5px 5px rgba(0, 0, 0, .1); |
562 | overflow: hidden; | 594 | overflow: hidden; |
563 | flex-direction: row; | 595 | flex-direction: row; |
564 | transition: transform .15s linear; | 596 | transition: transform .15s linear; |
565 | &.hide { | 597 | &.hide { |
566 | display: none; | 598 | display: none; |
567 | } | 599 | } |
568 | 600 | ||
569 | &.show { | 601 | &.show { |
570 | transform: translate3d(0, calc(44px + 1rpx), 0); | 602 | transform: translate3d(0, calc(44px + 1rpx), 0); |
571 | } | 603 | } |
572 | } | 604 | } |
573 | .sub-menu-list { | 605 | .sub-menu-list { |
574 | width: 100%; | 606 | width: 100%; |
575 | height: 345px; | 607 | height: 345px; |
576 | flex-direction: column; | 608 | flex-direction: column; |
577 | .sub-menu { | 609 | .sub-menu { |
578 | min-height: 44px; | 610 | min-height: 44px; |
579 | font-size: 13px; | 611 | font-size: 13px; |
580 | flex-direction: column; | 612 | flex-direction: column; |
581 | padding-right: 15px; | 613 | padding-right: 15px; |
582 | >.menu-name { | 614 | >.menu-name { |
583 | height: 44px; | 615 | height: 44px; |
584 | flex-direction: row; | 616 | flex-direction: row; |
585 | align-items: center; | 617 | align-items: center; |
586 | justify-content: space-between; | 618 | justify-content: space-between; |
587 | >.iconfont { | 619 | >.iconfont { |
588 | display: none; | 620 | display: none; |
589 | font-size: 18px; | 621 | font-size: 18px; |
590 | color: #FF6B4A; | 622 | color: #FF6B4A; |
591 | } | 623 | } |
592 | } | 624 | } |
593 | } | 625 | } |
594 | &.first { | 626 | &.first { |
595 | flex-shrink: 0; | 627 | flex-shrink: 0; |
596 | width: 236rpx; | 628 | width: 236rpx; |
597 | background-color: #f0f0f0; | 629 | background-color: #f0f0f0; |
598 | .sub-menu { | 630 | .sub-menu { |
599 | padding-left: 15px; | 631 | padding-left: 15px; |
600 | 632 | ||
601 | &.on { | 633 | &.on { |
602 | background-color: #fff; | 634 | background-color: #fff; |
603 | } | 635 | } |
604 | } | 636 | } |
605 | } | 637 | } |
606 | &.alone { | 638 | &.alone { |
607 | max-height: 345px; | 639 | max-height: 345px; |
608 | min-height: 170px; | 640 | min-height: 60rpx; |
609 | height: auto; | 641 | height: auto; |
610 | .sub-menu { | 642 | .sub-menu { |
611 | min-height: calc(44px - 1rpx); | 643 | min-height: calc(44px - 1rpx); |
612 | margin-left: 15px; | 644 | margin-left: 15px; |
613 | border-bottom: solid 1rpx #e5e5e5; | 645 | border-bottom: solid 1rpx #e5e5e5; |
614 | 646 | ||
615 | &.on { | 647 | &.on { |
616 | color: #FF6B4A; | 648 | color: #FF6B4A; |
617 | 649 | ||
618 | >.menu-name { | 650 | >.menu-name { |
619 | >.iconfont { | 651 | >.iconfont { |
620 | display: block; | 652 | display: block; |
621 | } | 653 | } |
622 | } | 654 | } |
623 | } | 655 | } |
624 | } | 656 | } |
625 | } | 657 | } |
626 | &.not-first { | 658 | &.not-first { |
627 | .sub-menu { | 659 | .sub-menu { |
628 | min-height: calc(44px - 1rpx); | 660 | min-height: calc(44px - 1rpx); |
629 | margin-left: 15px; | 661 | margin-left: 15px; |
630 | border-bottom: solid 1rpx #e5e5e5; | 662 | border-bottom: solid 1rpx #e5e5e5; |
631 | >.menu-name { | 663 | >.menu-name { |
632 | height: calc(44px - 1rpx); | 664 | height: calc(44px - 1rpx); |
633 | >.iconfont { | 665 | >.iconfont { |
634 | display: none; | 666 | display: none; |
635 | font-size: 18px; | 667 | font-size: 18px; |
636 | color: #FF6B4A; | 668 | color: #FF6B4A; |
637 | } | 669 | } |
638 | } | 670 | } |
639 | &.on { | 671 | &.on { |
640 | color: #FF6B4A; | 672 | color: #FF6B4A; |
641 | >.menu-name { | 673 | >.menu-name { |
642 | >.iconfont { | 674 | >.iconfont { |
643 | display: block; | 675 | display: block; |
644 | } | 676 | } |
645 | } | 677 | } |
646 | } | 678 | } |
647 | .more-sub-menu { | 679 | .more-sub-menu { |
648 | flex-direction: row; | 680 | flex-direction: row; |
649 | flex-wrap: wrap; | 681 | flex-wrap: wrap; |
650 | padding-bottom: 9px; | 682 | padding-bottom: 9px; |
651 | >text { | 683 | >text { |
652 | height: 30px; | 684 | height: 30px; |
653 | border-radius: 3px; | 685 | border-radius: 3px; |
654 | background-color: #f5f5f5; | 686 | background-color: #f5f5f5; |
655 | color: #9b9b9b; | 687 | color: #9b9b9b; |
656 | margin-bottom: 6px; | 688 | margin-bottom: 6px; |
657 | margin-right: 6px; | 689 | margin-right: 6px; |
658 | text-align: center; | 690 | text-align: center; |
659 | line-height: 30px; | 691 | line-height: 30px; |
660 | border: solid #f5f5f5 1rpx; | 692 | border: solid #f5f5f5 1rpx; |
661 | flex: 0 0 calc(33.33% - 6px); | 693 | flex: 0 0 calc(33.33% - 6px); |
662 | overflow: hidden; | 694 | overflow: hidden; |
663 | font-size: 12px; | 695 | font-size: 12px; |
664 | &:nth-child(3n) { | 696 | &:nth-child(3n) { |
665 | margin-right: 0; | 697 | margin-right: 0; |
666 | } | 698 | } |
667 | &.on { | 699 | &.on { |
668 | border-color: #f6c8ac; | 700 | border-color: #f6c8ac; |
669 | color: #FF6B4A; | 701 | color: #FF6B4A; |
670 | } | 702 | } |
671 | .iconfont { | 703 | .iconfont { |
672 | color: #9b9b9b; | 704 | color: #9b9b9b; |
673 | } | 705 | } |
674 | } | 706 | } |
675 | } | 707 | } |
676 | } | 708 | } |
677 | } | 709 | } |
678 | } | 710 | } |
679 | .filter { | 711 | .filter { |
680 | width: 100%; | 712 | width: 100%; |
681 | height: 345px; | 713 | height: 345px; |
682 | display: flex; | 714 | display: flex; |
683 | flex-direction: column; | 715 | flex-direction: column; |
684 | justify-content: space-between; | 716 | justify-content: space-between; |
685 | align-items: center; | 717 | align-items: center; |
686 | .menu-box { | 718 | .menu-box { |
687 | width: 698rpx; | 719 | width: 698rpx; |
688 | height: calc(345px - 75px); | 720 | height: calc(345px - 75px); |
689 | flex-shrink: 1; | 721 | flex-shrink: 1; |
690 | .box { | 722 | .box { |
691 | width: 100%; | 723 | width: 100%; |
692 | margin-top: 16px; | 724 | margin-top: 16px; |
693 | flex-direction: column; | 725 | flex-direction: column; |
694 | .title { | 726 | .title { |
695 | width: 100%; | 727 | width: 100%; |
696 | font-size: 13px; | 728 | font-size: 13px; |
697 | color: #888; | 729 | color: #888; |
698 | } | 730 | } |
699 | .labels { | 731 | .labels { |
700 | flex-direction: row; | 732 | flex-direction: row; |
701 | flex-wrap: wrap; | 733 | flex-wrap: wrap; |
702 | .on { | 734 | .on { |
703 | border-color: #FF6B4A; | 735 | border-color: #FF6B4A; |
704 | background-color: #FF6B4A; | 736 | background-color: #FF6B4A; |
705 | color: #fff; | 737 | color: #fff; |
706 | } | 738 | } |
707 | >view { | 739 | >view { |
708 | width: 148rpx; | 740 | width: 148rpx; |
709 | height: 30px; | 741 | height: 30px; |
710 | border: solid 1rpx #adadad; | 742 | border: solid 1rpx #adadad; |
711 | border-radius: 2px; | 743 | border-radius: 2px; |
712 | margin-right: 15px; | 744 | margin-right: 15px; |
713 | margin-top: 8px; | 745 | margin-top: 8px; |
714 | padding: 0 16rpx; | 746 | padding: 0 16rpx; |
715 | box-sizing: border-box; | 747 | box-sizing: border-box; |
716 | font-size: 12px; | 748 | font-size: 12px; |
717 | flex-direction: row; | 749 | flex-direction: row; |
718 | justify-content: center; | 750 | justify-content: center; |
719 | align-items: center; | 751 | align-items: center; |
720 | overflow: hidden; | 752 | overflow: hidden; |
721 | white-space: nowrap; | 753 | white-space: nowrap; |
722 | text-overflow: ellipsis; | 754 | text-overflow: ellipsis; |
723 | &:nth-child(4n) { | 755 | &:nth-child(4n) { |
724 | margin-right: 0; | 756 | margin-right: 0; |
725 | } | 757 | } |
726 | } | 758 | } |
727 | } | 759 | } |
728 | } | 760 | } |
729 | } | 761 | } |
730 | .btn-box { | 762 | .btn-box { |
731 | flex-shrink: 0; | 763 | flex-shrink: 0; |
732 | width: 100%; | 764 | width: 100%; |
733 | height: 75px; | 765 | height: 75px; |
734 | flex-direction: row !important; | 766 | flex-direction: row !important; |
735 | align-items: center; | 767 | align-items: center; |
736 | justify-content: space-between; | 768 | justify-content: space-between; |
737 | >view { | 769 | >view { |
738 | width: 320rpx; | 770 | width: 320rpx; |
739 | height: 40px; | 771 | height: 40px; |
740 | border-radius: 40px; | 772 | border-radius: 40px; |
741 | border: solid 1rpx #FF6B4A; | 773 | border: solid 1rpx #FF6B4A; |
742 | align-items: center; | 774 | align-items: center; |
743 | justify-content: center; | 775 | justify-content: center; |
744 | } | 776 | } |
745 | .reset { | 777 | .reset { |
746 | color: #FF6B4A; | 778 | color: #FF6B4A; |
747 | } | 779 | } |
748 | .submit { | 780 | .submit { |
749 | color: #fff; | 781 | color: #fff; |
750 | background-color: #FF6B4A; | 782 | background-color: #FF6B4A; |
751 | } | 783 | } |
752 | } | 784 | } |
753 | } | 785 | } |
754 | .mask { | 786 | .mask { |
755 | z-index: 10; | 787 | z-index: 10; |
756 | position: fixed; | 788 | position: fixed; |
757 | top: 0; | 789 | top: 0; |
758 | left: 0; | 790 | left: 0; |
759 | right: 0; | 791 | right: 0; |
760 | bottom: 0; | 792 | bottom: 0; |
761 | background-color: rgba(0, 0, 0, 0); | 793 | background-color: rgba(0, 0, 0, 0); |
762 | transition: background-color .15s linear; | 794 | transition: background-color .15s linear; |
763 | &.show { | 795 | &.show { |
764 | background-color: rgba(0, 0, 0, 0.5); | 796 | background-color: rgba(0, 0, 0, 0.5); |
765 | } | 797 | } |
766 | &.hide { | 798 | &.hide { |
767 | display: none; | 799 | display: none; |
src/pages/detailsChoiceArgs/detailsChoiceArgs.vue
1 | <template> | 1 | <template> |
2 | <view class="content"> | 2 | <view class="content"> |
3 | <view class="goods-info"> | 3 | <view class="goods-info"> |
4 | <image src="../../static/myorder-paying-pic.png"></image> | 4 | <image src="../../static/myorder-paying-pic.png"></image> |
5 | <view class="box-right"> | 5 | <view class="box-right"> |
6 | <text class="p1">镜片名称型号功能镜片名称型镜片名称型号功能非球面…</text> | 6 | <text class="p1">镜片名称型号功能镜片名称型镜片名称型号功能非球面…</text> |
7 | <text class="p2">支持7天无理由退货 顺丰发货</text> | 7 | <text class="p2">支持7天无理由退货 顺丰发货</text> |
8 | <view class="priceBox"> | 8 | <view class="priceBox"> |
9 | <view class="price">¥{{price*count}}</view> | 9 | <view class="price">¥{{price*count}}</view> |
10 | <view class="counter"> | 10 | <view class="counter"> |
11 | <view class="btn" disabled="this.disabled" @click="counter(false)">-</view> | 11 | <view class="btn" disabled="this.disabled" @click="counter(false)">-</view> |
12 | <text>{{count}}</text> | 12 | <text>{{count}}</text> |
13 | <view class="btn" @click="counter(true)">+</view> | 13 | <view class="btn" @click="counter(true)">+</view> |
14 | </view> | 14 | </view> |
15 | </view> | 15 | </view> |
16 | </view> | 16 | </view> |
17 | </view> | 17 | </view> |
18 | <view class="goods-data"> | 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 | <view class="opCollapse"> | 19 | <view class="opCollapse"> |
26 | <view class="head"> | 20 | <view class="head"> |
27 | <view v-if="!opIsOpen">填写验光数据</view> | 21 | <view v-if="!opIsOpen">填写验光数据</view> |
28 | <view v-else></view> | 22 | <view v-else></view> |
29 | <view class="headRighted" v-if="opIsOpen" @click="myCollapseChange(opIsOpen)"></view> | 23 | <view class="headRighted" v-if="opIsOpen" @click="myCollapseChange(opIsOpen)"></view> |
30 | <view class="headRight" v-else @click="myCollapseChange(opIsOpen)" ></view> | 24 | <view class="headRight" v-else @click="myCollapseChange(opIsOpen)" ></view> |
31 | </view> | 25 | </view> |
32 | <view class="body"> | 26 | <view class="body"> |
33 | <template v-if="opIsOpen"> | 27 | <template v-if="opIsOpen"> |
34 | 28 | ||
35 | <view class="goods-form"> | 29 | <view class="goods-form"> |
36 | <text class="p1">填写验光数据</text> | 30 | <text class="p1">填写验光数据</text> |
37 | <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> | 31 | <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> |
38 | <view class="picker" > | 32 | <view class="picker" > |
39 | <view class="picker-choice"> | 33 | <view class="picker-choice"> |
40 | <view class="choice-left"> | 34 | <view class="choice-left"> |
41 | <text class="p11">{{pickerInfoList[0].nameC}}</text> | 35 | <text class="p11">{{pickerInfoList[0].nameC}}</text> |
42 | <text class="p12">{{pickerInfoList[0].nameE}}</text> | 36 | <text class="p12">{{pickerInfoList[0].nameE}}</text> |
43 | </view> | 37 | </view> |
44 | <text class="p13">左 (OD)</text> | 38 | <text class="p13">左 (OD)</text> |
45 | <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> | 39 | <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> |
46 | <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1"> | 40 | <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1"> |
47 | <image src="../../static/detail-tabicon.png" ></image> | 41 | <image src="../../static/detail-tabicon.png" ></image> |
48 | </picker> | 42 | </picker> |
49 | <text class="p13">右 (OS)</text> | 43 | <text class="p13">右 (OS)</text> |
50 | <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> | 44 | <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> |
51 | <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2"> | 45 | <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2"> |
52 | <image src="../../static/detail-tabicon.png" ></image> | 46 | <image src="../../static/detail-tabicon.png" ></image> |
53 | </picker> | 47 | </picker> |
54 | </view> | 48 | </view> |
55 | </view> | 49 | </view> |
56 | <view class="picker" > | 50 | <view class="picker" > |
57 | <view class="picker-choice"> | 51 | <view class="picker-choice"> |
58 | <view class="choice-left"> | 52 | <view class="choice-left"> |
59 | <text class="p11">{{pickerInfoList[1].nameC}}</text> | 53 | <text class="p11">{{pickerInfoList[1].nameC}}</text> |
60 | <text class="p12">{{pickerInfoList[1].nameE}}</text> | 54 | <text class="p12">{{pickerInfoList[1].nameE}}</text> |
61 | </view> | 55 | </view> |
62 | <text class="p13">左 (OD)</text> | 56 | <text class="p13">左 (OD)</text> |
63 | <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> | 57 | <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> |
64 | <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1"> | 58 | <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1"> |
65 | <image src="../../static/detail-tabicon.png" ></image> | 59 | <image src="../../static/detail-tabicon.png" ></image> |
66 | </picker> | 60 | </picker> |
67 | <text class="p13">右 (OS)</text> | 61 | <text class="p13">右 (OS)</text> |
68 | <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> | 62 | <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> |
69 | <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2"> | 63 | <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2"> |
70 | <image src="../../static/detail-tabicon.png" ></image> | 64 | <image src="../../static/detail-tabicon.png" ></image> |
71 | </picker> | 65 | </picker> |
72 | </view> | 66 | </view> |
73 | </view> | 67 | </view> |
74 | <view class="picker" > | 68 | <view class="picker" > |
75 | <view class="picker-choice"> | 69 | <view class="picker-choice"> |
76 | <view class="choice-left"> | 70 | <view class="choice-left"> |
77 | <text class="p11">{{pickerInfoList[2].nameC}}</text> | 71 | <text class="p11">{{pickerInfoList[2].nameC}}</text> |
78 | <text class="p12">{{pickerInfoList[2].nameE}}</text> | 72 | <text class="p12">{{pickerInfoList[2].nameE}}</text> |
79 | </view> | 73 | </view> |
80 | <text class="p13">左 (OD)</text> | 74 | <text class="p13">左 (OD)</text> |
81 | <text class="p14">{{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}}</text> | 75 | <text class="p14">{{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}}</text> |
82 | <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1"> | 76 | <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1"> |
83 | <image src="../../static/detail-tabicon.png" ></image> | 77 | <image src="../../static/detail-tabicon.png" ></image> |
84 | </picker> | 78 | </picker> |
85 | <text class="p13">右 (OS)</text> | 79 | <text class="p13">右 (OS)</text> |
86 | <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> | 80 | <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> |
87 | <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2"> | 81 | <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2"> |
88 | <image src="../../static/detail-tabicon.png" ></image> | 82 | <image src="../../static/detail-tabicon.png" ></image> |
89 | </picker> | 83 | </picker> |
90 | </view> | 84 | </view> |
91 | </view> | 85 | </view> |
92 | <view class="picker" > | 86 | <view class="picker" > |
93 | <view class="picker-choice"> | 87 | <view class="picker-choice"> |
94 | <view class="choice-left"> | 88 | <view class="choice-left"> |
95 | <text class="p11">{{pickerInfoList[3].nameC}}</text> | 89 | <text class="p11">{{pickerInfoList[3].nameC}}</text> |
96 | <text class="p12">{{pickerInfoList[3].nameE}}</text> | 90 | <text class="p12">{{pickerInfoList[3].nameE}}</text> |
97 | </view> | 91 | </view> |
98 | <text class="p13">左 (OD)</text> | 92 | <text class="p13">左 (OD)</text> |
99 | <text class="p14">{{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}}</text> | 93 | <text class="p14">{{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}}</text> |
100 | <picker @change="bindPickerChange31" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> | 94 | <picker @change="bindPickerChange31" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> |
101 | <image src="../../static/detail-tabicon.png" ></image> | 95 | <image src="../../static/detail-tabicon.png" ></image> |
102 | </picker> | 96 | </picker> |
103 | <text class="p13">右 (OS)</text> | 97 | <text class="p13">右 (OS)</text> |
104 | <text class="p14">{{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}}</text> | 98 | <text class="p14">{{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}}</text> |
105 | <picker @change="bindPickerChange32" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> | 99 | <picker @change="bindPickerChange32" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> |
106 | <image src="../../static/detail-tabicon.png" ></image> | 100 | <image src="../../static/detail-tabicon.png" ></image> |
107 | </picker> | 101 | </picker> |
108 | </view> | 102 | </view> |
109 | </view> | 103 | </view> |
110 | <view class="picker" > | 104 | <view class="picker" > |
111 | <view class="picker-choice"> | 105 | <view class="picker-choice"> |
112 | <view class="choice-left"> | 106 | <view class="choice-left"> |
113 | <text class="p11">{{pickerInfoList[4].nameC}}</text> | 107 | <text class="p11">{{pickerInfoList[4].nameC}}</text> |
114 | </view> | 108 | </view> |
115 | <text class="p13-date">年 (Y)</text> | 109 | <text class="p13-date">年 (Y)</text> |
116 | <text class="p14" style="width: 34px;">{{pickerInfoList[4].nameArray1[pickerInfoList[4].nameIndex1]}}</text> | 110 | <text class="p14" style="width: 34px;">{{pickerInfoList[4].nameArray1[pickerInfoList[4].nameIndex1]}}</text> |
117 | <picker @change="bindPickerChange41" :value="pickerInfoList[4].nameIndex1" :range="pickerInfoList[4].nameArray1"> | 111 | <picker @change="bindPickerChange41" :value="pickerInfoList[4].nameIndex1" :range="pickerInfoList[4].nameArray1"> |
118 | <image src="../../static/detail-tabicon.png" ></image> | 112 | <image src="../../static/detail-tabicon.png" ></image> |
119 | </picker> | 113 | </picker> |
120 | <text class="p13-date">月 (M)</text> | 114 | <text class="p13-date">月 (M)</text> |
121 | <text class="p14" style="width: 30px;">{{pickerInfoList[4].nameArray2[pickerInfoList[4].nameIndex2]}}</text> | 115 | <text class="p14" style="width: 30px;">{{pickerInfoList[4].nameArray2[pickerInfoList[4].nameIndex2]}}</text> |
122 | <picker @change="bindPickerChange42" :value="pickerInfoList[4].nameIndex2" :range="pickerInfoList[4].nameArray2"> | 116 | <picker @change="bindPickerChange42" :value="pickerInfoList[4].nameIndex2" :range="pickerInfoList[4].nameArray2"> |
123 | <image src="../../static/detail-tabicon.png" ></image> | 117 | <image src="../../static/detail-tabicon.png" ></image> |
124 | </picker> | 118 | </picker> |
125 | <text class="p13-date">日 (D)</text> | 119 | <text class="p13-date">日 (D)</text> |
126 | <text class="p14" style="width: 30px;">{{pickerInfoList[4].nameArray3[pickerInfoList[4].nameIndex3]}}</text> | 120 | <text class="p14" style="width: 30px;">{{pickerInfoList[4].nameArray3[pickerInfoList[4].nameIndex3]}}</text> |
127 | <picker @change="bindPickerChange43" :value="pickerInfoList[4].nameIndex3" :range="pickerInfoList[4].nameArray3"> | 121 | <picker @change="bindPickerChange43" :value="pickerInfoList[4].nameIndex3" :range="pickerInfoList[4].nameArray3"> |
128 | <image src="../../static/detail-tabicon.png" ></image> | 122 | <image src="../../static/detail-tabicon.png" ></image> |
129 | </picker> | 123 | </picker> |
130 | </view> | 124 | </view> |
131 | </view> | 125 | </view> |
132 | <view class="confirm"> | 126 | <view class="confirm"> |
133 | <image :src="tablist.confirm ? tabicon[0] : tabicon[1]" @click="changeConfirm"></image> | 127 | <image :src="tablist.confirm ? tabicon[0] : tabicon[1]" @click="changeConfirm"></image> |
134 | <text>确认以上输入信息来源于我的验光数据!</text> | 128 | <text>确认以上输入信息来源于我的验光数据!</text> |
135 | </view> | 129 | </view> |
136 | </view> | 130 | </view> |
137 | 131 | ||
138 | </template> | 132 | </template> |
139 | <template v-else> | 133 | <template v-else> |
140 | <view v-for="item in pickerInfoList" :key="item.key" class="bodyBox"> | 134 | <view v-for="item in pickerInfoList" :key="item.key" class="bodyBox"> |
141 | <template v-if="item.nameC==='验光日期'"> | 135 | <template v-if="item.nameC==='验光日期'"> |
142 | <text class="names">{{item.nameC}}</text> | 136 | <text class="names">{{item.nameC}}</text> |
143 | <text style="margin-right: 5px;">{{item.nameArray1[item.nameIndex1]}}年</text> | 137 | <text style="margin-right: 5px;">{{item.nameArray1[item.nameIndex1]}}年</text> |
144 | <text style="margin-right: 5px;">{{item.nameArray2[item.nameIndex2]}}月</text> | 138 | <text style="margin-right: 5px;">{{item.nameArray2[item.nameIndex2]}}月</text> |
145 | <text>{{item.nameArray3[item.nameIndex2]}}日</text> | 139 | <text>{{item.nameArray3[item.nameIndex2]}}日</text> |
146 | </template> | 140 | </template> |
147 | <template v-else> | 141 | <template v-else> |
148 | <template v-if="item.nameC==='度数'"> | 142 | <template v-if="item.nameC==='度数'"> |
149 | <text style="display: inline;">*</text> | 143 | <text style="display: inline;">*</text> |
150 | </template> | 144 | </template> |
151 | 145 | ||
152 | <text class="names">{{item.nameC}}</text> | 146 | <text class="names">{{item.nameC}}</text> |
153 | <text style="margin-right: 10px;">左 {{item.nameArray1[item.nameIndex1]}}</text> | 147 | <text style="margin-right: 10px;">左 {{item.nameArray1[item.nameIndex1]}}</text> |
154 | <text>右 {{item.nameArray2[item.nameIndex2]}}</text> | 148 | <text>右 {{item.nameArray2[item.nameIndex2]}}</text> |
155 | </template> | 149 | </template> |
156 | </view> | 150 | </view> |
157 | </template> | 151 | </template> |
158 | </view> | 152 | </view> |
159 | </view> | 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 | </view> | 159 | </view> |
162 | <view class="submit">立即结算</view> | 160 | <view class="submit">立即结算</view> |
163 | </view> | 161 | </view> |
164 | </template> | 162 | </template> |
165 | 163 | ||
166 | <script> | 164 | <script> |
167 | import MyCollapse from './compoents/MyCollapse.vue' | 165 | import MyCollapse from './compoents/MyCollapse.vue' |
168 | export default { | 166 | export default { |
169 | components: { | 167 | components: { |
170 | MyCollapse | 168 | MyCollapse |
171 | }, | 169 | }, |
172 | data() { | 170 | data() { |
173 | return { | 171 | return { |
174 | count:1, | 172 | count:1, |
175 | disabled:false, | 173 | disabled:false, |
176 | price:180, | 174 | price:180, |
177 | // 实用功能参数 | 175 | // 实用功能参数 |
178 | funIsOpen:true, // 默认myCollapse开启 | 176 | funIsOpen:true, // 默认myCollapse开启 |
179 | funList: [ | 177 | funList: [ |
180 | {"name":"防紫外线","isChioce": false,"key":1,"type": "fun"}, | 178 | {"name":"防紫外线","isChioce": false,"key":1,"type": "fun"}, |
181 | {"name":"防蓝光","isChioce": false,"key":2,"type": "fun"}, | 179 | {"name":"防蓝光","isChioce": false,"key":2,"type": "fun"}, |
182 | {"name":"智能变色","isChioce": false,"key":3,"type": "fun"}, | 180 | {"name":"智能变色","isChioce": false,"key":3,"type": "fun"}, |
183 | {"name":"易清洁","isChioce": false,"key":4,"type": "fun"}, | 181 | {"name":"易清洁","isChioce": false,"key":4,"type": "fun"}, |
184 | {"name":"防辐射","isChioce": false,"key":5,"type": "fun"}, | 182 | {"name":"防辐射","isChioce": false,"key":5,"type": "fun"}, |
185 | {"name":"抗疲劳","isChioce": false,"key":6,"type": "fun"}, | 183 | {"name":"抗疲劳","isChioce": false,"key":6,"type": "fun"}, |
186 | ], | 184 | ], |
187 | funContent:[], | 185 | funContent:[], |
188 | 186 | ||
189 | // 镜片种类参数 | 187 | // 镜片种类参数 |
190 | kindIsOpen:true, | 188 | kindIsOpen:true, |
191 | kindList1: [ | 189 | kindList1: [ |
192 | {"name":"染色","isChioce":false,key:1,"type": "kind"}, | 190 | {"name":"染色","isChioce":false,key:1,"type": "kind"}, |
193 | {"name":"渐变","isChioce":false,key:2,"type": "kind"}, | 191 | {"name":"渐变","isChioce":false,key:2,"type": "kind"}, |
194 | ], | 192 | ], |
195 | kindList2: [ | 193 | kindList2: [ |
196 | {"name":"JB234759","isChioce":false,key:3,"type": "kind"}, | 194 | {"name":"JB234759","isChioce":false,key:3,"type": "kind"}, |
197 | {"name":"JB234759","isChioce":false,key:4,"type": "kind"}, | 195 | {"name":"JB234759","isChioce":false,key:4,"type": "kind"}, |
198 | {"name":"JB234759","isChioce":false,key:5,"type": "kind"}, | 196 | {"name":"JB234759","isChioce":false,key:5,"type": "kind"}, |
199 | {"name":"JB234759","isChioce":false,key:6,"type": "kind"}, | 197 | {"name":"JB234759","isChioce":false,key:6,"type": "kind"}, |
200 | {"name":"JB234759","isChioce":false,key:7,"type": "kind"}, | 198 | {"name":"JB234759","isChioce":false,key:7,"type": "kind"}, |
201 | ], | 199 | ], |
202 | kindContent:[], | 200 | kindContent:[], |
203 | // 材质选择 | 201 | // 材质选择 |
204 | maIsOpen:true, | 202 | maIsOpen:true, |
205 | maList1: [ | 203 | maList1: [ |
206 | {"name":"树脂镜片","isChioce":false,key:1,"range":"0-300度","isRange":true}, | 204 | {"name":"树脂镜片","isChioce":false,key:1,"range":"0-300度","isRange":true}, |
207 | {"name":"特殊镜片","isChioce":false,key:2}, | 205 | {"name":"特殊镜片","isChioce":false,key:2}, |
208 | ], | 206 | ], |
209 | maList2: [ | 207 | maList2: [ |
210 | {"name":"玻璃镜片","isChioce":false,key:3,"range":"300-1000度","isRange":true}, | 208 | {"name":"玻璃镜片","isChioce":false,key:3,"range":"300-1000度","isRange":true}, |
211 | {"name":"玻璃镜片","isChioce":false,key:4}, | 209 | {"name":"玻璃镜片","isChioce":false,key:4}, |
212 | ], | 210 | ], |
213 | maContent:[], | 211 | maContent:[], |
214 | // 折射率参数 | 212 | // 折射率参数 |
215 | reIsOpen:true, | 213 | reIsOpen:true, |
216 | reList1: [ | 214 | reList1: [ |
217 | {"name":"1.56(推荐)","isChioce":false,key:1,"range":"0-300度","isRange":true}, | 215 | {"name":"1.56(推荐)","isChioce":false,key:1,"range":"0-300度","isRange":true}, |
218 | {"name":"1.60","isChioce":false,key:2}, | 216 | {"name":"1.60","isChioce":false,key:2}, |
219 | ], | 217 | ], |
220 | reList2: [ | 218 | reList2: [ |
221 | {"name":"1.71(推荐)","isChioce":false,key:3,"range":"300-1000度","isRange":true}, | 219 | {"name":"1.71(推荐)","isChioce":false,key:3,"range":"300-1000度","isRange":true}, |
222 | {"name":"1.67","isChioce":false,key:4}, | 220 | {"name":"1.67","isChioce":false,key:4}, |
223 | {"name":"1.71","isChioce":false,key:5}, | 221 | {"name":"1.71","isChioce":false,key:5}, |
224 | {"name":"1.74","isChioce":false,key:6}, | 222 | {"name":"1.74","isChioce":false,key:6}, |
225 | ], | 223 | ], |
226 | reContent:[], | 224 | reContent:[], |
227 | // 验光参数 | 225 | // 验光参数 |
228 | opIsOpen:true, | 226 | opIsOpen:true, |
229 | tablist: { | 227 | tablist: { |
230 | // read: true, | 228 | // read: true, |
231 | // seeLong: false, | 229 | // seeLong: false, |
232 | confirm: false | 230 | confirm: false |
233 | }, | 231 | }, |
234 | tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'], | 232 | tabicon:['/static/detail-button.png','/static/detail-button-unselected.png'], |
235 | // 度数相关数据 | 233 | // 度数相关数据 |
236 | pickerInfoList:[ | 234 | pickerInfoList:[ |
237 | {nameC:"度数",nameE:"(SPH)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:0}, | 235 | {nameC:"度数",nameE:"(SPH)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:0}, |
238 | {nameC:"散光",nameE:"(CYL)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:1}, | 236 | {nameC:"散光",nameE:"(CYL)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:1}, |
239 | {nameC:"散光轴位",nameE:"(AXI)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:2}, | 237 | {nameC:"散光轴位",nameE:"(AXI)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:2}, |
240 | {nameC:"双眼瞳距",nameE:"(PD)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:3}, | 238 | {nameC:"双眼瞳距",nameE:"(PD)",nameArray1:[1.5,2.5,3.5,4.5],nameIndex1:0,nameArray2:[1.5,2.5,3.5,4.5],nameIndex2:0,key:3}, |
241 | {nameC:"验光日期",nameE:'',nameArray1:[2017,2018,2019,2020,2021],nameIndex1:0,nameArray2:[1,2,3,4,5,6,7],nameIndex2:0,nameArray3:[1,2,3,4,5,6],nameIndex3:0} | 239 | {nameC:"验光日期",nameE:'',nameArray1:[2017,2018,2019,2020,2021],nameIndex1:0,nameArray2:[1,2,3,4,5,6,7],nameIndex2:0,nameArray3:[1,2,3,4,5,6],nameIndex3:0} |
242 | ], | 240 | ], |
243 | 241 | ||
244 | } | 242 | } |
245 | }, | 243 | }, |
246 | methods: { | 244 | methods: { |
247 | counter(isadd){ | 245 | counter(isadd){ |
248 | if(isadd){ | 246 | if(isadd){ |
249 | this.count++ | 247 | this.count++ |
250 | }else{ | 248 | }else{ |
251 | this.count <= 1? this.disabled = true:this.count-- | 249 | this.count <= 1? this.disabled = true:this.count-- |
252 | } | 250 | } |
253 | }, | 251 | }, |
254 | myCollapseChange(isopen){ | 252 | myCollapseChange(isopen){ |
255 | // console.log(isopen) | 253 | // console.log(isopen) |
256 | this.opIsOpen = !isopen | 254 | this.opIsOpen = !isopen |
257 | }, | 255 | }, |
258 | changeConfirm() { | 256 | changeConfirm() { |
259 | this.tablist.confirm = !this.tablist.confirm | 257 | this.tablist.confirm = !this.tablist.confirm |
260 | }, | 258 | }, |
261 | 259 | ||
262 | bindPickerChange01: function(e) { | 260 | bindPickerChange01: function(e) { |
263 | this.pickerInfoList[0].nameIndex1 = e.target.value | 261 | this.pickerInfoList[0].nameIndex1 = e.target.value |
264 | }, | 262 | }, |
265 | bindPickerChange02: function(e) { | 263 | bindPickerChange02: function(e) { |
266 | this.pickerInfoList[0].nameIndex2 = e.target.value | 264 | this.pickerInfoList[0].nameIndex2 = e.target.value |
267 | }, | 265 | }, |
268 | 266 | ||
269 | bindPickerChange11: function(e) { | 267 | bindPickerChange11: function(e) { |
270 | this.pickerInfoList[1].nameIndex1 = e.target.value | 268 | this.pickerInfoList[1].nameIndex1 = e.target.value |
271 | }, | 269 | }, |
272 | bindPickerChange12: function(e) { | 270 | bindPickerChange12: function(e) { |
273 | this.pickerInfoList[1].nameIndex2 = e.target.value | 271 | this.pickerInfoList[1].nameIndex2 = e.target.value |
274 | }, | 272 | }, |
275 | 273 | ||
276 | bindPickerChange21: function(e) { | 274 | bindPickerChange21: function(e) { |
277 | this.pickerInfoList[2].nameIndex1 = e.target.value | 275 | this.pickerInfoList[2].nameIndex1 = e.target.value |
278 | }, | 276 | }, |
279 | bindPickerChange22: function(e) { | 277 | bindPickerChange22: function(e) { |
280 | this.pickerInfoList[2].nameIndex2 = e.target.value | 278 | this.pickerInfoList[2].nameIndex2 = e.target.value |
281 | }, | 279 | }, |
282 | 280 | ||
283 | bindPickerChange31: function(e) { | 281 | bindPickerChange31: function(e) { |
284 | this.pickerInfoList[3].nameIndex1 = e.target.value | 282 | this.pickerInfoList[3].nameIndex1 = e.target.value |
285 | }, | 283 | }, |
286 | bindPickerChange32: function(e) { | 284 | bindPickerChange32: function(e) { |
287 | this.pickerInfoList[3].nameIndex2 = e.target.value | 285 | this.pickerInfoList[3].nameIndex2 = e.target.value |
288 | }, | 286 | }, |
289 | 287 | ||
290 | bindPickerChange41: function(e) { | 288 | bindPickerChange41: function(e) { |
291 | this.pickerInfoList[4].nameIndex1 = e.target.value | 289 | this.pickerInfoList[4].nameIndex1 = e.target.value |
292 | }, | 290 | }, |
293 | bindPickerChange42: function(e) { | 291 | bindPickerChange42: function(e) { |
294 | this.pickerInfoList[4].nameIndex2 = e.target.value | 292 | this.pickerInfoList[4].nameIndex2 = e.target.value |
295 | }, | 293 | }, |
296 | bindPickerChange43: function(e) { | 294 | bindPickerChange43: function(e) { |
297 | this.pickerInfoList[4].nameIndex3 = e.target.value | 295 | this.pickerInfoList[4].nameIndex3 = e.target.value |
298 | }, | 296 | }, |
299 | } | 297 | } |
300 | } | 298 | } |
301 | </script> | 299 | </script> |
302 | 300 | ||
303 | <style lang="scss" scoped> | 301 | <style lang="scss" scoped> |
304 | .content{ | 302 | .content{ |
305 | width: 100%; | 303 | width: 100%; |
306 | background-color: #F2F2F2; | 304 | background-color: #F2F2F2; |
307 | display: flex; | 305 | display: flex; |
308 | flex-direction: column; | 306 | flex-direction: column; |
309 | align-items: center; | 307 | align-items: center; |
310 | } | 308 | } |
311 | 309 | ||
312 | .goods-info{ | 310 | .goods-info{ |
313 | width: 100%; | 311 | width: 100%; |
314 | height: 272rpx; | 312 | height: 272rpx; |
315 | box-sizing: border-box; | 313 | box-sizing: border-box; |
316 | padding: 40rpx 40rpx 36rpx 36rpx; | 314 | padding: 40rpx 40rpx 36rpx 36rpx; |
317 | margin: 36rpx 0 18rpx 0; | 315 | margin: 36rpx 0 18rpx 0; |
318 | // margin-bottom: -18rpx; | 316 | // margin-bottom: -18rpx; |
319 | // margin-top: -36rpx; | 317 | // margin-top: -36rpx; |
320 | background: #FFFFFF; | 318 | background: #FFFFFF; |
321 | border-radius: 16rpx; | 319 | border-radius: 16rpx; |
322 | display: flex; | 320 | display: flex; |
323 | image{ | 321 | image{ |
324 | width: 94px; | 322 | width: 94px; |
325 | height: 94px; | 323 | height: 94px; |
326 | margin-right: 28rpx; | 324 | margin-right: 28rpx; |
327 | } | 325 | } |
328 | .box-right{ | 326 | .box-right{ |
329 | width: 458rpx; | 327 | width: 458rpx; |
330 | display: flex; | 328 | display: flex; |
331 | flex-direction: column; | 329 | flex-direction: column; |
332 | align-items: flex-start; | 330 | align-items: flex-start; |
333 | justify-content: space-between; | 331 | justify-content: space-between; |
334 | .p1 { | 332 | .p1 { |
335 | // font-family: PingFangSC-Regular; | 333 | // font-family: PingFangSC-Regular; |
336 | font-size: 14px; | 334 | font-size: 14px; |
337 | color: #333333; | 335 | color: #333333; |
338 | letter-spacing: -0.26px; | 336 | letter-spacing: -0.26px; |
339 | text-align: justify; | 337 | text-align: justify; |
340 | line-height: 18px; | 338 | line-height: 18px; |
341 | } | 339 | } |
342 | .p2 { | 340 | .p2 { |
343 | // font-family: PingFangSC-Regular; | 341 | // font-family: PingFangSC-Regular; |
344 | font-size: 10px; | 342 | font-size: 10px; |
345 | color: #999999; | 343 | color: #999999; |
346 | letter-spacing: -0.19px; | 344 | letter-spacing: -0.19px; |
347 | margin-top: -20rpx; | 345 | margin-top: -20rpx; |
348 | } | 346 | } |
349 | .priceBox{ | 347 | .priceBox{ |
350 | display: flex; | 348 | display: flex; |
351 | flex-direction: row; | 349 | flex-direction: row; |
352 | justify-content: space-between; | 350 | justify-content: space-between; |
353 | width: 100%; | 351 | width: 100%; |
354 | .price{ | 352 | .price{ |
355 | color: #FF6B4A; | 353 | color: #FF6B4A; |
356 | font-size: 28rpx; | 354 | font-size: 28rpx; |
357 | } | 355 | } |
358 | .counter{ | 356 | .counter{ |
359 | display: flex; | 357 | display: flex; |
360 | flex-direction: row; | 358 | flex-direction: row; |
361 | justify-content: space-between; | 359 | justify-content: space-between; |
362 | font-size: 28rpx; | 360 | font-size: 28rpx; |
363 | color: #333333; | 361 | color: #333333; |
364 | width: 122rpx; | 362 | width: 122rpx; |
365 | .btn{ | 363 | .btn{ |
366 | display: flex; | 364 | display: flex; |
367 | justify-content: center; | 365 | justify-content: center; |
368 | line-height: 32rpx; | 366 | line-height: 32rpx; |
369 | height: 32rpx; | 367 | height: 32rpx; |
370 | width: 32rpx; | 368 | width: 32rpx; |
371 | background-color: #F2F2F2; | 369 | background-color: #F2F2F2; |
372 | color: #CFCFCF; | 370 | color: #CFCFCF; |
373 | } | 371 | } |
374 | } | 372 | } |
375 | } | 373 | } |
376 | } | 374 | } |
377 | } | 375 | } |
378 | 376 | ||
379 | .goods-data{ | 377 | .goods-data{ |
380 | width: 100%; | 378 | width: 100%; |
381 | box-sizing: border-box; | 379 | box-sizing: border-box; |
382 | padding: 37rpx 40rpx 0 40rpx; | 380 | padding: 37rpx 40rpx 0 40rpx; |
383 | background: #FFFFFF; | 381 | background: #FFFFFF; |
384 | border-radius: 12rpx; | 382 | border-radius: 12rpx; |
385 | margin-bottom: 92px; | 383 | margin-bottom: 92px; |
386 | .opCollapse{ | 384 | .opCollapse{ |
387 | width: 100%; | 385 | width: 100%; |
388 | padding-bottom: 28rpx; | 386 | padding-bottom: 28rpx; |
389 | margin-top: 7px; | 387 | margin-top: 7px; |
390 | border-bottom: 1px solid #E9E9E9; | 388 | border-bottom: 1px solid #E9E9E9; |
391 | .head{ | 389 | .head{ |
392 | display: flex; | 390 | display: flex; |
393 | justify-content: space-between; | 391 | justify-content: space-between; |
394 | height: 24px; | 392 | height: 24px; |
395 | // font-family: PingFangSC-Medium; | 393 | // font-family: PingFangSC-Medium; |
396 | font-size: 16px; | 394 | font-size: 16px; |
397 | color: #333333; | 395 | color: #333333; |
398 | letter-spacing: -0.3px; | 396 | letter-spacing: -0.3px; |
399 | text-align: justify; | 397 | text-align: justify; |
400 | line-height: 24px; | 398 | line-height: 24px; |
401 | margin-bottom: 18rpx; | 399 | margin-bottom: 18rpx; |
402 | .headRighted{ | 400 | .headRighted{ |
403 | width: 0; | 401 | width: 0; |
404 | height: 0; | 402 | height: 0; |
405 | border-left: 4px solid transparent; | 403 | border-left: 4px solid transparent; |
406 | border-right: 4px solid transparent; | 404 | border-right: 4px solid transparent; |
407 | border-bottom: 4px solid #CFCFCF; | 405 | border-bottom: 4px solid #CFCFCF; |
408 | transform: scaleY(-1); | 406 | transform: scaleY(-1); |
409 | margin-top: 10px; | 407 | margin-top: 10px; |
410 | } | 408 | } |
411 | .headMid{ | 409 | .headMid{ |
412 | // font-family: PingFangSC-Regular; | 410 | // font-family: PingFangSC-Regular; |
413 | font-size: 10px; | 411 | font-size: 10px; |
414 | color: #999999; | 412 | color: #999999; |
415 | letter-spacing: -0.19px; | 413 | letter-spacing: -0.19px; |
416 | margin-left: -120rpx; | 414 | margin-left: -120rpx; |
417 | } | 415 | } |
418 | .headRight{ | 416 | .headRight{ |
419 | width: 0; | 417 | width: 0; |
420 | height: 0; | 418 | height: 0; |
421 | border-left: 4px solid transparent; | 419 | border-left: 4px solid transparent; |
422 | border-right: 4px solid transparent; | 420 | border-right: 4px solid transparent; |
423 | border-bottom: 4px solid #CFCFCF; | 421 | border-bottom: 4px solid #CFCFCF; |
424 | margin-top: 10px; | 422 | margin-top: 10px; |
425 | } | 423 | } |
426 | } | 424 | } |
427 | .body{ | 425 | .body{ |
428 | // font-family: PingFangSC-Regular; | 426 | // font-family: PingFangSC-Regular; |
429 | font-size: 12px; | 427 | font-size: 12px; |
430 | color: #666666; | 428 | color: #666666; |
431 | letter-spacing: 0; | 429 | letter-spacing: 0; |
432 | .bodyBox{ | 430 | .bodyBox{ |
433 | margin-top: 15px; | 431 | margin-top: 15px; |
434 | .names{ | 432 | .names{ |
435 | // font-family: PingFangSC-Regular; | 433 | // font-family: PingFangSC-Regular; |
436 | font-size: 12px; | 434 | font-size: 12px; |
437 | color: #151515; | 435 | color: #151515; |
438 | letter-spacing: 0; | 436 | letter-spacing: 0; |
439 | text-align: justify; | 437 | text-align: justify; |
440 | line-height: 17px; | 438 | line-height: 17px; |
441 | margin-left: 5px; | 439 | margin-left: 5px; |
442 | margin-right: 10px; | 440 | margin-right: 10px; |
443 | } | 441 | } |
444 | text{ | 442 | text{ |
445 | // font-family: PingFangSC-Regular; | 443 | // font-family: PingFangSC-Regular; |
446 | font-size: 12px; | 444 | font-size: 12px; |
447 | color: #666666; | 445 | color: #666666; |
448 | letter-spacing: 0; | 446 | letter-spacing: 0; |
449 | text-align: justify; | 447 | text-align: justify; |
450 | } | 448 | } |
451 | } | 449 | } |
452 | 450 | ||
453 | } | 451 | } |
454 | } | 452 | } |
455 | 453 | ||
456 | } | 454 | } |
457 | 455 | ||
458 | .goods-form { | 456 | .goods-form { |
459 | display: flex; | 457 | display: flex; |
460 | flex-direction: column; | 458 | flex-direction: column; |
461 | align-items: center; | 459 | align-items: center; |
462 | justify-content: center; | 460 | justify-content: center; |
463 | background-color: #fff; | 461 | background-color: #fff; |
464 | width: 100%; | 462 | width: 100%; |
465 | 463 | ||
466 | .p1 { | 464 | .p1 { |
467 | font-size: 16px; | 465 | font-size: 16px; |
468 | color: #333333; | 466 | color: #333333; |
469 | letter-spacing: -0.3px; | 467 | letter-spacing: -0.3px; |
470 | text-align: justify; | 468 | text-align: justify; |
471 | line-height: 24px; | 469 | line-height: 24px; |
472 | margin: 4px 0; | 470 | margin: 4px 0; |
473 | 471 | ||
474 | } | 472 | } |
475 | .p2 { | 473 | .p2 { |
476 | font-size: 12px; | 474 | font-size: 12px; |
477 | color: #999999; | 475 | color: #999999; |
478 | letter-spacing: -0.23px; | 476 | letter-spacing: -0.23px; |
479 | margin-bottom: 18rpx; | 477 | margin-bottom: 18rpx; |
480 | } | 478 | } |
481 | image{ | 479 | image{ |
482 | width: 28rpx; | 480 | width: 28rpx; |
483 | height: 26rpx; | 481 | height: 26rpx; |
484 | } | 482 | } |
485 | .confirm { | 483 | .confirm { |
486 | display: flex; | 484 | display: flex; |
487 | align-items: center; | 485 | align-items: center; |
488 | font-size: 12px; | 486 | font-size: 12px; |
489 | color: #666666; | 487 | color: #666666; |
490 | letter-spacing: -0.23px; | 488 | letter-spacing: -0.23px; |
491 | width: 684rpx; | 489 | width: 684rpx; |
492 | image{ | 490 | image{ |
493 | margin-right:25rpx; | 491 | margin-right:25rpx; |
494 | } | 492 | } |
495 | } | 493 | } |
496 | .picker{ | 494 | .picker{ |
497 | display: flex; | 495 | display: flex; |
498 | flex-direction: column; | 496 | flex-direction: column; |
499 | justify-content: center; | 497 | justify-content: center; |
500 | align-items: center; | 498 | align-items: center; |
501 | width: 100%; | 499 | width: 100%; |
502 | image{ | 500 | image{ |
503 | width: 10px; | 501 | width: 10px; |
504 | height: 10px; | 502 | height: 10px; |
505 | margin-right: 5px; | 503 | margin-right: 5px; |
506 | } | 504 | } |
507 | .picker-choice{ | 505 | .picker-choice{ |
508 | display: flex; | 506 | display: flex; |
509 | width: 684rpx; | 507 | width: 684rpx; |
510 | align-items: center; | 508 | align-items: center; |
511 | margin-bottom: 40rpx; | 509 | margin-bottom: 40rpx; |
512 | .choice-left{ | 510 | .choice-left{ |
513 | width: 210rpx; | 511 | width: 210rpx; |
514 | .p11 { | 512 | .p11 { |
515 | font-size: 14px; | 513 | font-size: 14px; |
516 | color: #333333; | 514 | color: #333333; |
517 | letter-spacing: -0.26px; | 515 | letter-spacing: -0.26px; |
518 | text-align: justify; | 516 | text-align: justify; |
519 | line-height: 24px; | 517 | line-height: 24px; |
520 | // margin-right: 10px; | 518 | // margin-right: 10px; |
521 | } | 519 | } |
522 | .p12 { | 520 | .p12 { |
523 | font-size: 10px; | 521 | font-size: 10px; |
524 | color: #3F3F3F; | 522 | color: #3F3F3F; |
525 | letter-spacing: -0.19px; | 523 | letter-spacing: -0.19px; |
526 | text-align: justify; | 524 | text-align: justify; |
527 | line-height: 24px; | 525 | line-height: 24px; |
528 | } | 526 | } |
529 | 527 | ||
530 | 528 | ||
531 | } | 529 | } |
532 | .p13 { | 530 | .p13 { |
533 | font-size: 10px; | 531 | font-size: 10px; |
534 | color: #999999; | 532 | color: #999999; |
535 | letter-spacing: -0.19px; | 533 | letter-spacing: -0.19px; |
536 | margin-right: 10px; | 534 | margin-right: 10px; |
537 | } | 535 | } |
538 | .p13-date { | 536 | .p13-date { |
539 | font-size: 10px; | 537 | font-size: 10px; |
540 | color: #999999; | 538 | color: #999999; |
541 | letter-spacing: -0.19px; | 539 | letter-spacing: -0.19px; |
542 | margin-right: 5px; | 540 | margin-right: 5px; |
543 | } | 541 | } |
544 | .p14 { | 542 | .p14 { |
545 | font-size: 14px; | 543 | font-size: 14px; |
546 | color: #666666; | 544 | color: #666666; |
547 | letter-spacing: -0.26px; | 545 | letter-spacing: -0.26px; |
548 | text-align: center; | 546 | text-align: center; |
549 | width: 124rpx; | 547 | width: 124rpx; |
550 | border-bottom: 1px solid #CFCFCF; | 548 | border-bottom: 1px solid #CFCFCF; |
551 | } | 549 | } |
552 | 550 | ||
553 | } | 551 | } |
554 | } | 552 | } |
555 | } | 553 | } |
556 | 554 | ||
557 | .submit{ | 555 | .submit{ |
558 | width: 100%; | 556 | width: 100%; |
559 | height: 112rpx; | 557 | height: 112rpx; |
560 | background: #FF6B4A; | 558 | background: #FF6B4A; |
561 | position: fixed; | 559 | position: fixed; |
562 | bottom: 0; | 560 | bottom: 0; |
563 | text-align: center; | 561 | text-align: center; |
564 | line-height: 112rpx; | 562 | line-height: 112rpx; |
565 | // font-family: PingFangSC-Regular; | 563 | // font-family: PingFangSC-Regular; |
566 | font-size: 16px; | 564 | font-size: 16px; |
567 | color: #FFFFFF; | 565 | color: #FFFFFF; |
568 | letter-spacing: -0.3px; | 566 | letter-spacing: -0.3px; |
src/pages/index/index.vue
1 | <template> | 1 | <template> |
2 | <view class="content"> | 2 | <view class="content"> |
3 | <view class="header"> | 3 | <view class="header"> |
4 | <!-- 搜索--> | 4 | <!-- 搜索--> |
5 | <view class="searchBar"> | 5 | <view class="searchBar"> |
6 | <icon class="searchIcon" type="search" size="14"></icon> | 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 | </view> | 14 | </view> |
9 | 15 | ||
10 | <!-- 筛选栏--> | 16 | <!-- 筛选栏--> |
11 | <view class="screenBar"> | 17 | <!-- <view class="screenBar"> |
12 | <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)"> | 18 | <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)"> |
13 | <view | 19 | <view |
14 | class="screenItem" | 20 | class="screenItem" |
15 | v-bind:class="{ active: current === item.current }" | 21 | v-bind:class="{ active: current === item.current }" |
16 | v-if="item.current === 2" | 22 | v-if="item.current === 2" |
17 | @click="dropDown" | 23 | @click="dropDown" |
18 | > | 24 | > |
19 | {{ item.text }} | 25 | {{ item.text }} |
20 | <icon type="info" size="14"></icon> | 26 | <icon type="info" size="14"></icon> |
21 | </view> | 27 | </view> |
22 | <view | 28 | <view |
23 | class="screenItem" | 29 | class="screenItem" |
24 | v-bind:class="{ active: current === item.current }" | 30 | v-bind:class="{ active: current === item.current }" |
25 | v-if="item.current === 4" | 31 | v-if="item.current === 4" |
26 | @click="showDrawer('showRight')" | 32 | @click="showDrawer('showRight')" |
27 | > | 33 | > |
28 | {{ item.text }} | 34 | {{ item.text }} |
29 | <icon type="info" size="14"></icon> | 35 | <icon type="info" size="14"></icon> |
30 | </view> | 36 | </view> |
31 | <view v-if="item.current !== 2&&item.current!==4"> | 37 | <view v-if="item.current !== 2&&item.current!==4"> |
32 | <view | 38 | <view |
33 | class="screenItem" | 39 | class="screenItem" |
34 | v-bind:class="{ active: current === item.current }" | 40 | v-bind:class="{ active: current === item.current }" |
35 | >{{ item.text }}</view> | 41 | >{{ item.text }}</view> |
36 | </view> | 42 | </view> |
37 | </view> | 43 | </view> |
38 | </view> | 44 | </view>--> |
39 | </view> | 45 | </view> |
40 | <Uni-drawer | 46 | <Uni-drawer |
41 | ref="showRight" | 47 | ref="showRight" |
42 | mask="true" | 48 | mask="true" |
43 | maskClick="true" | 49 | maskClick="true" |
44 | mode="right" | 50 | mode="right" |
45 | :width="320" | 51 | :width="320" |
46 | @change="change($event,'showRight')" | 52 | @change="change($event,'showRight')" |
47 | > | 53 | > |
48 | <view class="close"> | 54 | <view class="close"> |
49 | <view @click="closeDrawer('showRight')"> | 55 | <view @click="closeDrawer('showRight')"> |
50 | <text class="word-btn-white">关闭</text> | 56 | <text class="word-btn-white">关闭</text> |
51 | </view> | 57 | </view> |
52 | </view> | 58 | </view> |
53 | </Uni-drawer> | 59 | </Uni-drawer> |
54 | 60 | ||
55 | <!-- 筛选菜单--> | 61 | <!-- 筛选菜单--> |
56 | <view class="content-wrap"> | 62 | <view class="content-wrap"> |
57 | <view> | 63 | <view> |
58 | <HMfilterDropdown | 64 | <HMfilterDropdown |
59 | :filterData="filterData" | 65 | :filterData="categoryList" |
60 | :defaultSelected="filterDropdownValue" | 66 | :defaultSelected="filterDropdownValue" |
61 | :updateMenuName="true" | 67 | :updateMenuName="true" |
62 | @confirm="confirm" | 68 | @search="search" |
69 | @getList="getList" | ||
63 | data-format="Object" | 70 | data-format="Object" |
64 | ></HMfilterDropdown> | 71 | ></HMfilterDropdown> |
65 | <!-- 商品列表 --> | 72 | <!-- 商品列表 --> |
66 | <view class="goods-list"> | 73 | <view class="goods-list"> |
67 | <view class="product-list"> | 74 | <view class="product-list"> |
68 | <view class="product" v-for="(goods) in goodsList" :key="goods.id"> | 75 | <view class="product" v-for="(goods) in goodsList" :key="goods.id"> |
69 | <Card :goods="goods"></Card> | 76 | <Card :goods="goods"></Card> |
70 | </view> | 77 | </view> |
71 | </view> | 78 | </view> |
72 | <view class="loading-text">{{loadingText}}</view> | 79 | <view class="loading-text">{{loadingText}}</view> |
73 | </view> | 80 | </view> |
74 | </view> | 81 | </view> |
75 | </view> | 82 | </view> |
76 | </view> | 83 | </view> |
77 | </template> | 84 | </template> |
78 | 85 | ||
79 | <script> | 86 | <script> |
80 | import UniDrawer from "@/components/UniDrawer/UniDrawer.vue"; | 87 | import UniDrawer from "@/components/UniDrawer/UniDrawer.vue"; |
81 | import Card from "@/components/CommodityCard/CommodityCard.vue"; | 88 | import Card from "@/components/CommodityCard/CommodityCard.vue"; |
82 | import HMfilterDropdown from "@/components/HMFilterDropdown/HMFilterDropdown.vue"; | 89 | import HMfilterDropdown from "@/components/HMFilterDropdown/HMFilterDropdown.vue"; |
83 | import data from "@/common/data.js"; //筛选菜单数据 | 90 | import data from "@/common/data.js"; //筛选菜单数据 |
84 | import store from '@/store'; | 91 | import store from '@/store'; |
85 | 92 | ||
86 | export default { | 93 | export default { |
87 | components: { | 94 | components: { |
88 | UniDrawer: UniDrawer, | 95 | UniDrawer: UniDrawer, |
89 | HMfilterDropdown: HMfilterDropdown, | 96 | HMfilterDropdown: HMfilterDropdown, |
90 | Card: Card | 97 | Card: Card |
91 | }, | 98 | }, |
92 | data() { | 99 | data() { |
93 | return { | 100 | return { |
94 | screenItems: [ | 101 | // screenItems: [ |
95 | { current: 0, text: "全部", hasIcon: false }, | 102 | // { current: 0, text: "全部", hasIcon: false }, |
96 | { current: 1, text: "销量", hasIcon: false }, | 103 | // { current: 1, text: "销量", hasIcon: false }, |
97 | { current: 2, text: "价格", hasIcon: true }, | 104 | // { current: 2, text: "价格", hasIcon: true }, |
98 | { current: 3, text: "折扣", hasIcon: false }, | 105 | // { current: 3, text: "折扣", hasIcon: false }, |
99 | { current: 4, text: "筛选", hasIcon: true } | 106 | // { current: 4, text: "筛选", hasIcon: true } |
100 | ], | 107 | // ], |
101 | current: 0, | 108 | // current: 0, |
102 | showRight: false, | 109 | // showRight: false, |
103 | indexArr: "", | 110 | indexArr: "", |
104 | valueArr: "", | 111 | valueArr: "", |
105 | loadingText: "~~到底了~~", | 112 | loadingText: "~~到底了~~", |
106 | filterDropdownValue: [], | 113 | filterDropdownValue: [], |
107 | filterData: [], | 114 | filterData: [], |
115 | searchText: '', | ||
108 | // goodsList:[ | 116 | // goodsList:[ |
109 | // { goods_id: 0, img: "/static/img/goods/p1.jpg", name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | 117 | // { goods_id: 0, img: "/static/img/goods/p1.jpg", name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, |
110 | // { goods_id: 1, img: '/static/img/goods/p2.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, | 118 | // { goods_id: 1, img: '/static/img/goods/p2.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, |
111 | // { goods_id: 2, img: '/static/img/goods/p3.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, | 119 | // { goods_id: 2, img: '/static/img/goods/p3.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, |
112 | // { goods_id: 3, img: '/static/img/goods/p4.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, | 120 | // { goods_id: 3, img: '/static/img/goods/p4.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, |
113 | // { goods_id: 4, img: '/static/img/goods/p5.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | 121 | // { goods_id: 4, img: '/static/img/goods/p5.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, |
114 | // { goods_id: 5, img: '/static/img/goods/p6.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, | 122 | // { goods_id: 5, img: '/static/img/goods/p6.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 }, |
115 | // { goods_id: 6, img: '/static/img/goods/p7.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, | 123 | // { goods_id: 6, img: '/static/img/goods/p7.jpg', name: '美瞳',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:3 }, |
116 | // { goods_id: 7, img: '/static/img/goods/p8.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, | 124 | // { goods_id: 7, img: '/static/img/goods/p8.jpg', name: '太阳镜',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:4 }, |
117 | // { goods_id: 8, img: '/static/img/goods/p9.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, | 125 | // { goods_id: 8, img: '/static/img/goods/p9.jpg', name: '镜片',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:1 }, |
118 | // { goods_id: 9, img: '/static/img/goods/p10.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 } | 126 | // { goods_id: 9, img: '/static/img/goods/p10.jpg', name: '镜框',originCost:'¥198',price: '¥168', slogan:'1235人浏览',goodType:2 } |
119 | // ], | 127 | // ], |
120 | }; | 128 | }; |
121 | }, | 129 | }, |
122 | computed: { | 130 | computed: { |
123 | goodsList() { | 131 | goodsList() { |
124 | // 也可以从 getters 获取 | 132 | // 也可以从 getters 获取 |
125 | return this.$store.state.test.list; | 133 | return this.$store.state.index.list; |
126 | }, | 134 | }, |
127 | categoryList(){ | 135 | categoryList(){ |
128 | // console.log(this.$store.state.categoryOrder.categoryList); | 136 | return this.$store.state.index.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 | ] | ||
179 | // newData[0].submenu[0].submenu = categoryList[0].submenu | 137 | // newData[0].submenu[0].submenu = categoryList[0].submenu |
180 | // newData[1].submenu[0].submenu = categoryList[3].submenu[5].submenu | 138 | // newData[1].submenu[0].submenu = categoryList[3].submenu[5].submenu |
181 | // newData[2].submenu[0].submenu = categoryList[3].submenu[2].submenu | 139 | // newData[2].submenu[0].submenu = categoryList[3].submenu[2].submenu |
182 | // newData[3].submenu[0].submenu = categoryList[3].submenu[4].submenu | 140 | // newData[3].submenu[0].submenu = categoryList[3].submenu[4].submenu |
183 | // newData[4].submenu[0] = categoryList[3] | 141 | // newData[4].submenu[0] = categoryList[3] |
184 | this.filterData = newData; | 142 | this.filterData = newData; |
185 | // this.filterData = categoryList; | 143 | // this.filterData = categoryList; |
186 | } | 144 | }, |
187 | |||
188 | }, | 145 | }, |
189 | filters: { | 146 | filters: { |
190 | outData(value) { | 147 | outData(value) { |
191 | return JSON.stringify(value); | 148 | return JSON.stringify(value); |
192 | } | 149 | } |
193 | }, | 150 | }, |
194 | onLoad: function() { | 151 | onLoad() { |
195 | store.dispatch('test/fetch'); | 152 | console.log('onload') |
196 | store.dispatch('categoryOrder/fetch') | 153 | store.dispatch('index/category'); |
197 | 154 | // this.getList(); | |
198 | // 登陆 | 155 | store.dispatch('index/list'); |
199 | // store.dispatch('user/login') | ||
200 | |||
201 | }, | 156 | }, |
202 | methods: { | 157 | methods: { |
203 | showDrawer(e) { | 158 | showDrawer(e) { |
204 | this.$refs[e].open(); | 159 | this.$refs[e].open(); |
205 | }, | 160 | }, |
161 | getList() { | ||
162 | store.dispatch('index/list'); | ||
163 | }, | ||
164 | // search(params) { | ||
165 | // this.$store.index. | ||
166 | // }, | ||
206 | closeDrawer(e) { | 167 | closeDrawer(e) { |
207 | this.$refs[e].close(); | 168 | this.$refs[e].close(); |
208 | }, | 169 | }, |
209 | change(e, type) { | 170 | change(e, type) { |
210 | this[type] = e; | 171 | this[type] = e; |
211 | }, | 172 | }, |
212 | onClickItem(e) { | 173 | onClickItem(e) { |
213 | if (this.current !== e) { | 174 | if (this.current !== e) { |
214 | this.current = e; | 175 | this.current = e; |
215 | } | 176 | } |
216 | }, | 177 | }, |
217 | dropDown() { | 178 | dropDown() { |
218 | console.log("下拉"); | 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) { | 191 | search(e) { |
222 | this.indexArr = e.index; | 192 | console.log("修改菜单-----", e, this.categoryList); |
223 | this.valueArr = e.value; | 193 | const { on, value, index } = e; |
224 | return; | 194 | let params = {} |
225 | console.log("修改菜单"); | 195 | if(on[0] === 1) { |
226 | this.filterData[4].submenu[1] = { | 196 | this.searchText = ''; |
227 | name: "项目2", | 197 | store.dispatch('index/list'); |
228 | submenu: [] | 198 | } else { |
229 | }; | 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 | ||
233 | }; | 213 | }; |
234 | </script> | 214 | </script> |
235 | 215 | ||
236 | <style lang="scss"> | 216 | <style lang="scss"> |
237 | .content { | 217 | .content { |
238 | display: flex; | 218 | display: flex; |
239 | flex-direction: column; | 219 | flex-direction: column; |
240 | align-items: center; | 220 | align-items: center; |
241 | justify-content: center; | 221 | justify-content: center; |
242 | background-color: #f7f6f6; | 222 | background-color: #f7f6f6; |
243 | } | 223 | } |
244 | .header { | 224 | .header { |
245 | display: flex; | 225 | display: flex; |
246 | flex-direction: column; | 226 | flex-direction: column; |
247 | align-items: center; | 227 | align-items: center; |
248 | justify-content: center; | 228 | justify-content: center; |
249 | background-color: #f7f6f6; | 229 | background-color: #f7f6f6; |
250 | height: 178rpx; | 230 | height: 178rpx; |
251 | width: 100%; | 231 | width: 100%; |
252 | z-index: 999; | 232 | z-index: 999; |
253 | position: fixed; | 233 | position: fixed; |
254 | top: 0; | 234 | top: 0; |
255 | left: 0; | 235 | left: 0; |
256 | } | 236 | } |
257 | .searchBar { | 237 | .searchBar { |
258 | width: 670rpx; | 238 | width: 670rpx; |
259 | display: flex; | 239 | display: flex; |
260 | justify-content: center; | 240 | justify-content: center; |
261 | align-items: center; | 241 | align-items: center; |
262 | box-sizing: border-box; | 242 | box-sizing: border-box; |
263 | padding: 0rpx 16rpx; | 243 | padding: 0rpx 16rpx; |
264 | border: 1px solid #ff6b4a; | 244 | border: 1px solid #ff6b4a; |
265 | border-radius: 8rpx; | 245 | border-radius: 8rpx; |
266 | background-color: #ffffff; | 246 | background-color: #ffffff; |
267 | } | 247 | } |
268 | 248 | ||
269 | .searchIpt { | 249 | .searchIpt { |
270 | height: 68rpx; | 250 | height: 68rpx; |
271 | width: 670rpx; | 251 | width: 670rpx; |
272 | padding: 16rpx; | 252 | padding: 16rpx; |
273 | font-size: 28rpx; | 253 | font-size: 28rpx; |
274 | box-sizing: border-box; | 254 | box-sizing: border-box; |
275 | } | 255 | } |
276 | .screenBar { | 256 | .screenBar { |
277 | width: 670rpx; | 257 | width: 670rpx; |
278 | height: 110rpx; | 258 | height: 110rpx; |
279 | display: flex; | 259 | display: flex; |
280 | flex-direction: row; | 260 | flex-direction: row; |
281 | justify-content: space-between; | 261 | justify-content: space-between; |
282 | align-items: center; | 262 | align-items: center; |
283 | color: #333333; | 263 | color: #333333; |
284 | font-size: 32rpx; | 264 | font-size: 32rpx; |
285 | } | 265 | } |
286 | .active { | 266 | .active { |
287 | color: #ff6b4a; | 267 | color: #ff6b4a; |
288 | } | 268 | } |
289 | .screenItem { | 269 | .screenItem { |
290 | display: flex; | 270 | display: flex; |
291 | justify-content: center; | 271 | justify-content: center; |
292 | align-items: center; | 272 | align-items: center; |
293 | } | 273 | } |
294 | .content-wrap { | 274 | .content-wrap { |
295 | width: 100%; | 275 | width: 100%; |
296 | background-color: #ffffff; | 276 | background-color: #ffffff; |
src/store/modules/categoryOrder.js
1 | import urlAlias from '../url'; | File was deleted | |
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 | }; | ||
41 | 1 | import urlAlias from '../url'; |
src/store/modules/index.js
File was created | 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 | }; | ||
96 |
src/store/modules/user.js
1 | import urlAlias from '../url'; | 1 | import urlAlias from '../url'; |
2 | import request from '../request'; | 2 | import request from '../request'; |
3 | 3 | ||
4 | const { | 4 | const { |
5 | login, | 5 | login, |
6 | getUserInfo, | 6 | getUserInfo, |
7 | } = urlAlias; | 7 | } = urlAlias; |
8 | 8 | ||
9 | const state = { | 9 | const state = { |
10 | fromInfo: { | 10 | fromInfo: { |
11 | loginQueryInfo: {}, | 11 | loginQueryInfo: {}, |
12 | fromuid: 0, | 12 | fromuid: 0, |
13 | fromsid: 0, | 13 | fromsid: 0, |
14 | frompid: 0, | 14 | frompid: 0, |
15 | scene: 1001, | 15 | scene: 1001, |
16 | }, | 16 | }, |
17 | userInfo: { | 17 | userInfo: { |
18 | uid: 1, | 18 | uid: 1, |
19 | openid: '', | 19 | openid: '', |
20 | nickName: '', | 20 | nickName: '', |
21 | headerphoto: '', | 21 | headerphoto: '', |
22 | } | 22 | } |
23 | }; | 23 | }; |
24 | 24 | ||
25 | const mutations = { | 25 | const mutations = { |
26 | FROM: (state, data) => { | 26 | FROM: (state, data) => { |
27 | state.formInfo = data; | 27 | state.formInfo = data; |
28 | }, | 28 | }, |
29 | UPDATE: (state, data) => { | 29 | UPDATE: (state, data) => { |
30 | state.userInfo = data; | 30 | state.userInfo = data; |
31 | } | 31 | } |
32 | }; | 32 | }; |
33 | 33 | ||
34 | const actions = { | 34 | const actions = { |
35 | // 登陆 | 35 | // 登陆 |
36 | login({ commit }, param) { | 36 | login({ commit }, param) { |
37 | const { | 37 | const { |
38 | frompid = undefined, | 38 | frompid = undefined, |
39 | fromsid = undefined, | 39 | fromsid = undefined, |
40 | fromuid = undefined, | 40 | fromuid = undefined, |
41 | scene = 1001 , | 41 | scene = 1001 , |
42 | } = param || {}; | 42 | } = param || {}; |
43 | uni.login({ | 43 | uni.login({ |
44 | provider: 'weixin', | 44 | provider: 'weixin', |
45 | success: function (loginRes) { | 45 | success: function (loginRes) { |
46 | console.log('login',loginRes); | 46 | console.log('login',loginRes); |
47 | request({ | 47 | request({ |
48 | url: login, | 48 | url: login, |
49 | data: { | 49 | data: { |
50 | app_uid: 2020, | 50 | app_uid: 2020, |
51 | code: loginRes.code, | 51 | code: loginRes.code, |
52 | frompid, | 52 | frompid, |
53 | fromsid, | 53 | fromsid, |
54 | fromuid, | 54 | fromuid, |
55 | 55 | ||
56 | }, | 56 | }, |
57 | success: (res) => { | 57 | success: (res) => { |
58 | const { data: { session_key, openid} } = res; | 58 | const { data: { session_key, openid} } = res; |
59 | console.log('res', res) | 59 | console.log('res', res) |
60 | // 写入缓存 | 60 | // 写入缓存 |
61 | uni.setStorageSync('session_key', session_key); | 61 | uni.setStorageSync('session_key', session_key); |
62 | uni.setStorageSync('openid', openid); | 62 | uni.setStorageSync('openid', openid); |
63 | request({ | 63 | request({ |
64 | url: getUserInfo, | 64 | url: getUserInfo, |
65 | data: { | 65 | data: { |
66 | app_uid: 2020, | 66 | app_uid: 2020, |
67 | frompid, | 67 | frompid, |
68 | fromsid, | 68 | fromsid, |
69 | fromuid, | 69 | fromuid, |
70 | openid, | 70 | openid, |
71 | scene, | 71 | scene, |
72 | }, | 72 | }, |
73 | success: (res) => { | 73 | success: (res) => { |
74 | console.log('userInfo=====', res); | 74 | console.log('userInfo=====', res); |
75 | const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res; | 75 | const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res; |
76 | uni.setStorageSync('uid', uid); | ||
76 | const userInfo = { | 77 | const userInfo = { |
77 | uid, | 78 | uid, |
78 | openid, | 79 | openid, |
79 | nickName, | 80 | nickName, |
80 | headerphoto, | 81 | headerphoto, |
81 | } | 82 | } |
82 | commit("UPDATE", userInfo) | 83 | commit("UPDATE", userInfo) |
83 | } | 84 | } |
84 | }) | 85 | }) |
85 | } | 86 | } |
86 | }) | 87 | }) |
87 | } | 88 | } |
88 | }); | 89 | }); |
89 | }, | 90 | }, |
90 | setFrom({ commit }, param) { | 91 | setFrom({ commit }, param) { |
91 | commit("FROM", param); | 92 | commit("FROM", param); |
92 | }, | 93 | }, |
93 | getUserInfo( { commit }, param) { | 94 | getUserInfo( { commit }, param) { |
94 | const { | 95 | const { |
95 | frompid = undefined, | 96 | frompid = undefined, |
96 | fromsid = undefined, | 97 | fromsid = undefined, |
97 | fromuid = undefined, | 98 | fromuid = undefined, |
98 | scene = 1001 , | 99 | scene = 1001 , |
99 | } = param || {}; | 100 | } = param || {}; |
100 | // 写入缓存 | 101 | // 写入缓存 |
101 | const openid = uni.getStorageSync('openid', openid); | 102 | const openid = uni.getStorageSync('openid', openid); |
102 | request({ | 103 | request({ |
103 | url: getUserInfo, | 104 | url: getUserInfo, |
104 | data: { | 105 | data: { |
105 | app_uid: 2020, | 106 | app_uid: 2020, |
106 | frompid, | 107 | frompid, |
107 | fromsid, | 108 | fromsid, |
108 | fromuid, | 109 | fromuid, |
109 | openid, | 110 | openid, |
110 | scene, | 111 | scene, |
111 | }, | 112 | }, |
112 | success: (res) => { | 113 | success: (res) => { |
113 | console.log('userInfo=====', res); | 114 | console.log('userInfo=====', res); |
114 | const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res; | 115 | const { data: { data: { uid, username: nickName, openid, headerphoto } } } = res; |
116 | uni.setStorageSync('uid', uid); | ||
115 | const userInfo = { | 117 | const userInfo = { |
116 | uid, | 118 | uid, |
117 | openid, | 119 | openid, |
118 | nickName, | 120 | nickName, |
119 | headerphoto, | 121 | headerphoto, |
120 | } | 122 | } |
121 | commit("UPDATE", userInfo) | 123 | commit("UPDATE", userInfo) |
122 | } | 124 | } |
123 | }) | 125 | }) |
124 | }, | 126 | }, |
125 | } | 127 | } |
126 | 128 | ||
127 | export default { | 129 | export default { |
128 | namespaced: true, | 130 | namespaced: true, |
129 | state, | 131 | state, |
130 | mutations, | 132 | mutations, |
131 | actions, | 133 | actions, |
132 | } | 134 | } |
src/store/request.js
1 | const DOMAIN = 'https://api.glass.xiuyetang.com'; | 1 | const DOMAIN = 'https://api.glass.xiuyetang.com'; |
2 | 2 | ||
3 | export default async function request({ | 3 | export default async function request({ |
4 | url, | 4 | url, |
5 | method = "post", | 5 | method = "post", |
6 | data = {}, | 6 | data = {}, |
7 | header = { | 7 | header = { |
8 | "Content-Type": "application/x-www-form-urlencoded", | 8 | "Content-Type": "application/x-www-form-urlencoded", |
9 | }, | 9 | }, |
10 | timeout = 3000, | 10 | timeout = 3000, |
11 | withCredentials = false, // 跨域请求时是否携带凭证(cookies) | 11 | withCredentials = false, // 跨域请求时是否携带凭证(cookies) |
12 | // sslVerify: true, // 验证 ssl 证书 | 12 | // sslVerify: true, // 验证 ssl 证书 |
13 | success, | 13 | success, |
14 | fail = (res) => { | 14 | fail = (res) => { |
15 | console.log("fail status === > ", res); | 15 | console.log("fail status === > ", res); |
16 | }, | 16 | }, |
17 | complete = (res) => { | 17 | complete = (res) => { |
18 | console.log("complete status === > ", res); | 18 | console.log("complete status === > ", res); |
19 | }, | 19 | }, |
20 | }) { | 20 | }) { |
21 | console.log("DOMAIN", DOMAIN, url); | ||
22 | uni | 21 | uni |
23 | .request({ | 22 | .request({ |
24 | url: DOMAIN + url, | 23 | url: DOMAIN + url, |
25 | method, | 24 | method, |
26 | data, | 25 | data, |
27 | header, | 26 | header, |
28 | timeout, | 27 | timeout, |
29 | withCredentials, | 28 | withCredentials, |
30 | success, | 29 | success, |
31 | fail, | 30 | fail, |
32 | complete, | 31 | complete, |
33 | }) | 32 | }) |
34 | } | 33 | } |
src/store/url.js
1 | const urlAlias = { | 1 | const urlAlias = { |
2 | // 获取首页商品列表 | 2 | // 获取商品信息 |
3 | shopList: '/app/prod/list', | 3 | read: '/app/prod/read', |
4 | |||
5 | // 获取首页商品列表 | ||
6 | category: '/app/prod/category2', | ||
7 | // 获取商品信息 | ||
8 | read: '/app/prod/read', | ||
9 | 4 | ||
10 | // 首页 | 5 | // 首页 |
11 | shopList: '/app/prod/list', // 获取首页商品列表 | 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 | login: '/app/glass/getOpenId', // 登陆 | 11 | login: '/app/glass/getOpenId', // 登陆 |
16 | getUserInfo: '/app/glass/userinfo', // 获取用户信息 | 12 | getUserInfo: '/app/glass/userinfo', // 获取用户信息 |
17 | 13 | ||
18 | // 我的订单 | 14 | // 我的订单 |
19 | orderList: '/app/order/list', // 获取订单列表 | 15 | orderList: '/app/order/list', // 获取订单列表 |
20 | 16 | ||
21 | // 购物车 | 17 | // 购物车 |
22 | cartList: '/app/cart/list', // 获取购物车列表 | 18 | cartList: '/app/cart/list', // 获取购物车列表 |
23 | 19 | ||
24 | // 我的 | 20 | // 我的 |
25 | recommandList:'/app/prod/recommand', // 获取用户个性化推荐商品 | 21 | recommandList:'/app/prod/recommand', // 获取用户个性化推荐商品 |
26 | 22 | ||
27 | // 镜框选购页 | 23 | // 镜框选购页 |
28 | detailStandardList: '/app/prod/read', //获取商品的详细信息 | 24 | detailStandardList: '/app/prod/read', //获取商品的详细信息 |
29 | 25 | ||
30 | } | 26 | } |
31 | 27 | ||
32 | export default urlAlias; | 28 | export default urlAlias; |