Commit 1b4b4938a06f42ff5d1d7fab5cb2aac6d0f26d87

Authored by Adam
1 parent 78c1e13726
Exists in master

auto commit the code by alias command

src/components/BottomSheet/BottomSheet.vue
1 <template> 1 <template>
2 <view class="BottomSheetContent"> 2 <view class="BottomSheetContent">
3 <view class="sheet" :class="{sheetShow:isShowBottom,sheeHide:!isShowBottom}" @touchmove.stop.prevent="moveHandle" @click="closeSheet()"> 3 <view class="sheet" :class="{sheetShow:isShowBottom,sheeHide:!isShowBottom}"
4 <scroll-view scroll-y="true" class="sheetView" :class="{sheetView_active:isShowBottom}" @click.stop="stopEvent()" > 4 @touchmove.stop.prevent="moveHandle" @click="closeSheet()">
5 <scroll-view scroll-y="true" class="sheetView" :class="{sheetView_active:isShowBottom}"
6 @click.stop="stopEvent()">
5 <view class="BottomSheetContent"> 7 <view class="BottomSheetContent">
6 <view class="goodInfo"> 8 <view class="goodInfo">
7 <view class="imageWrap"> 9 <view class="imageWrap">
8 <image 10 <!-- <image :src="skuItem.sku_pic_http" mode="aspectFill" style="width: 188rpx;height: 168rpx;">
9 :src="skuItem.pic" 11 </image> -->
10 mode="aspectFill" 12
11 style="width: 188rpx;height: 168rpx;" 13 </view>
12 14 <view class="infoRight">
13 ></image> 15 <!-- <text class="goodName">{{goodInfo.shop_wood_name}}-{{skuItem.wsp_sku_name}}</text> -->
14 16 <text class="goodName">{{goodInfo.shop_wood_name}}</text>
15 </view> 17 <text class="remarks">支持7天无理由退货 顺丰发货</text>
16 <view class="infoRight"> 18 <view class="priceBox">
17 <text class="goodName">{{goodInfo.p_name}}</text> 19 <!-- <view class="price">¥{{skuItem.wsp_wood_price || '暂无'}}</view> -->
18 <text class="remarks">支持7天无理由退货 顺丰发货</text> 20 <view class="price">¥{{0 || '暂无'}}</view>
19 <view class="priceBox"> 21 <text>(限购{{maxCount}}副)</text>
20 <view class="price">¥{{skuItem.real_price || '暂无'}}</view> 22 <view class="counter">
21 <text>(限购{{maxCount}}副)</text> 23 <view class="btn" disabled="this.addDisabled" type="default"
22 <view class="counter"> 24 @click="counter(false)">-</view>
23 <view 25 <text>{{count}}</text>
24 class="btn" 26 <view class="btn" disabled="this.desDisabled" type="default" @click="counter(true)">
25 disabled="this.addDisabled" 27 +</view>
26 type="default" 28 </view>
27 @click="counter(false)" 29 </view>
28 >-</view> 30 </view>
29 <text>{{count}}</text> 31 </view>
30 <view 32 <view class="peopleChoose">
31 class="btn" 33 <view class="title">选择使用人</view>
32 disabled="this.desDisabled" 34 <view class="loveList">
33 type="default" 35 <view class="peopleName" v-for="(item,index) in loveList" :key='index'
34 @click="counter(true)" 36 :class="{ active2: loveCurrent === index }" @click="onClickLoveItem(index,item.name)">
35 >+</view> 37 {{item.name}}
36 </view> 38 </view>
37 </view> 39 </view>
38 </view> 40 </view>
39 </view> 41 <view class="goods-data" v-if="isCart !== 3">
40 <view class="peopleChoose"> 42 <view class="opCollapse">
41 <view class="title">选择使用人</view> 43 <view class="body">
42 <view class="loveList"> 44 <template v-if="opIsOpen">
43 <view class="peopleName" v-for="(item,index) in loveList" :key='index' :class="{ active2: loveCurrent === index }" 45 <view class="goods-form">
44 @click="onClickLoveItem(index,item.name)"> 46 <view class="p1">
45 {{item.name}} 47 <image class="image2" src="../../static/img/myOpticsData/dataWrite.png"
46 </view> 48 mode="aspectFit"></image>
47 </view> 49 填写验光数据
48 </view> 50 </view>
49 <view class="goods-data" v-if="isCart !== 3"> 51 <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text>
50 <view class="opCollapse"> 52 <view class="picker">
51 <view class="body"> 53 <view class="picker-choice">
52 <template v-if="opIsOpen"> 54 <view class="choice-left">
53 <view class="goods-form"> 55 <text class="pd">验光单取名:</text>
54 <view class="p1"> 56 </view>
55 <image class="image2" src="../../static/img/myOpticsData/dataWrite.png" mode="aspectFit"></image> 57 <input type="text" @blur="handleInput" class="input" placeholder="请输入名称"
56 填写验光数据 58 maxlength="20" :value="name" />
57 </view> 59 </view>
58 <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> 60 </view>
59 <view class="picker"> 61 <view class="picker">
60 <view class="picker-choice"> 62 <view class="picker-choice">
61 <view class="choice-left"> 63 <view class="choice-left">
62 <text class="pd">验光单取名:</text> 64 <text class="p11">{{pickerInfoList[0].nameC}}</text>
63 </view> 65 <text class="p12">{{pickerInfoList[0].nameE}}</text>
64 <input type="text" @blur="handleInput" class="input" 66 </view>
65 placeholder="请输入名称" maxlength="20" :value="name" /> 67 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text>
66 </view> 68 <!-- <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> -->
67 </view> 69 <picker @change="bindPickerChange01"
68 <view class="picker" > 70 :value="pickerInfoList[0].nameIndex1"
69 <view class="picker-choice"> 71 :range="pickerInfoList[0].nameArray1">
70 <view class="choice-left"> 72 <view class="p14">
71 <text class="p11">{{pickerInfoList[0].nameC}}</text> 73 {{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}
72 <text class="p12">{{pickerInfoList[0].nameE}}</text> 74 <image src="../../static/detail-tabicon.png"></image>
73 </view> 75 </view>
74 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text> 76 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
75 <!-- <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> --> 77 </picker>
76 <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1"> 78 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text>
77 <view class="p14"> 79 <!-- <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> -->
78 {{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}} 80 <picker @change="bindPickerChange02"
79 <image src="../../static/detail-tabicon.png" ></image> 81 :value="pickerInfoList[0].nameIndex2"
80 </view> 82 :range="pickerInfoList[0].nameArray2">
81 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 83 <view class="p14">
82 </picker> 84 {{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}
83 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text> 85 <image src="../../static/detail-tabicon.png"></image>
84 <!-- <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> --> 86 </view>
85 <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2"> 87 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
86 <view class="p14"> 88 </picker>
87 {{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}} 89 </view>
88 <image src="../../static/detail-tabicon.png" ></image> 90 </view>
89 </view> 91 <view class="picker">
90 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 92 <view class="picker-choice">
91 </picker> 93 <view class="choice-left">
92 </view> 94 <text class="p11">{{pickerInfoList[1].nameC}}</text>
93 </view> 95 <text class="p12">{{pickerInfoList[1].nameE}}</text>
94 <view class="picker" > 96 </view>
95 <view class="picker-choice"> 97 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text>
96 <view class="choice-left"> 98 <!-- <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> -->
97 <text class="p11">{{pickerInfoList[1].nameC}}</text> 99 <picker @change="bindPickerChange11"
98 <text class="p12">{{pickerInfoList[1].nameE}}</text> 100 :value="pickerInfoList[1].nameIndex1"
99 </view> 101 :range="pickerInfoList[1].nameArray1">
100 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text> 102 <view class="p14">
101 <!-- <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> --> 103 {{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}
102 <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1"> 104 <image src="../../static/detail-tabicon.png"></image>
103 <view class="p14"> 105 </view>
104 {{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}} 106 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
105 <image src="../../static/detail-tabicon.png" ></image> 107 </picker>
106 </view> 108 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text>
107 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 109 <!-- <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> -->
108 </picker> 110 <picker @change="bindPickerChange12"
109 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text> 111 :value="pickerInfoList[1].nameIndex2"
110 <!-- <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> --> 112 :range="pickerInfoList[1].nameArray2">
111 <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2"> 113 <view class="p14">
112 <view class="p14"> 114 {{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}
113 {{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}} 115 <image src="../../static/detail-tabicon.png"></image>
114 <image src="../../static/detail-tabicon.png" ></image> 116 </view>
115 </view> 117 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
116 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 118 </picker>
117 </picker> 119 </view>
118 </view> 120 </view>
119 </view> 121 <view class="picker">
120 <view class="picker" > 122 <view class="picker-choice">
121 <view class="picker-choice"> 123 <view class="choice-left">
122 <view class="choice-left"> 124 <text class="p11">{{pickerInfoList[2].nameC}}</text>
123 <text class="p11">{{pickerInfoList[2].nameC}}</text> 125 <text class="p12">{{pickerInfoList[2].nameE}}</text>
124 <text class="p12">{{pickerInfoList[2].nameE}}</text> 126 </view>
125 </view> 127 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text>
126 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text> 128 <picker @change="bindPickerChange21"
127 <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1"> 129 :value="pickerInfoList[2].nameIndex1"
128 <view class="p14"> 130 :range="pickerInfoList[2].nameArray1">
129 {{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}} 131 <view class="p14">
130 <image src="../../static/detail-tabicon.png" ></image> 132 {{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}}
131 </view> 133 <image src="../../static/detail-tabicon.png"></image>
132 </picker> 134 </view>
133 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text> 135 </picker>
134 <!-- <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> --> 136 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text>
135 <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2"> 137 <!-- <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> -->
136 <view class="p14"> 138 <picker @change="bindPickerChange22"
137 {{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}} 139 :value="pickerInfoList[2].nameIndex2"
138 <image src="../../static/detail-tabicon.png" ></image> 140 :range="pickerInfoList[2].nameArray2">
139 </view> 141 <view class="p14">
140 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 142 {{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}
141 </picker> 143 <image src="../../static/detail-tabicon.png"></image>
142 </view> 144 </view>
143 </view> 145 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
144 <view class="picker"> 146 </picker>
145 <view class="picker-choice"> 147 </view>
146 <view class="choice-left"> 148 </view>
147 <text class="pd">瞳距:</text> 149 <view class="picker">
148 </view> 150 <view class="picker-choice">
149 <input type="digit" @change="handleInputPd" class="input" 151 <view class="choice-left">
150 placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" /> 152 <text class="pd">瞳距:</text>
151 </view> 153 </view>
152 </view> 154 <input type="digit" @change="handleInputPd" class="input"
153 <view class="picker" > 155 placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" />
154 <view class="picker-choice"> 156 </view>
155 <view class="choice-left"> 157 </view>
156 <text class="p11">{{pickerInfoList[3].nameC}}</text> 158 <view class="picker">
157 </view> 159 <view class="picker-choice">
158 <text class="p13-date">年&nbsp;&nbsp;&nbsp;(Y)</text> 160 <view class="choice-left">
159 <picker @change="bindPickerChange41" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> 161 <text class="p11">{{pickerInfoList[3].nameC}}</text>
160 <view class="p14" style="width: 30px;"> 162 </view>
161 {{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}} 163 <text class="p13-date">年&nbsp;&nbsp;&nbsp;(Y)</text>
162 <image src="../../static/detail-tabicon.png" ></image> 164 <picker @change="bindPickerChange41"
163 </view> 165 :value="pickerInfoList[3].nameIndex1"
164 </picker> 166 :range="pickerInfoList[3].nameArray1">
165 <text class="p13-date">月&nbsp;&nbsp;&nbsp;(M)</text> 167 <view class="p14" style="width: 30px;">
166 <picker @change="bindPickerChange42" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> 168 {{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}}
167 <view class="p14" style="width: 30px;"> 169 <image src="../../static/detail-tabicon.png"></image>
168 {{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}} 170 </view>
169 <image src="../../static/detail-tabicon.png" ></image> 171 </picker>
170 </view> 172 <text class="p13-date">月&nbsp;&nbsp;&nbsp;(M)</text>
171 </picker> 173 <picker @change="bindPickerChange42"
172 <text class="p13-date">日&nbsp;&nbsp;&nbsp;(D)</text> 174 :value="pickerInfoList[3].nameIndex2"
173 <picker @change="bindPickerChange43" :value="pickerInfoList[3].nameIndex3" :range="pickerInfoList[3].nameArray3"> 175 :range="pickerInfoList[3].nameArray2">
174 <view class="p14" style="width: 30px;"> 176 <view class="p14" style="width: 30px;">
175 {{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}} 177 {{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}}
176 <image src="../../static/detail-tabicon.png" ></image> 178 <image src="../../static/detail-tabicon.png"></image>
177 </view> 179 </view>
178 </picker> 180 </picker>
179 </view> 181 <text class="p13-date">日&nbsp;&nbsp;&nbsp;(D)</text>
180 </view> 182 <picker @change="bindPickerChange43"
181 <view class="ipts"> 183 :value="pickerInfoList[3].nameIndex3"
182 <view class="inputItem"> 184 :range="pickerInfoList[3].nameArray3">
183 <text class="text">镜片宽度</text> 185 <view class="p14" style="width: 30px;">
184 <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth!=='0'?glassInfo.glassWidth:''" placeholder="请输入镜片宽度"/> 186 {{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}}
185 </view> 187 <image src="../../static/detail-tabicon.png"></image>
186 <view class="inputItem"> 188 </view>
187 <text class="text">鼻梁宽度</text> 189 </picker>
188 <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth!=='0'?glassInfo.norseWidth:''" placeholder="请输入鼻梁宽度"/> 190 </view>
189 </view> 191 </view>
190 <view class="inputItem"> 192 <view class="ipts">
191 <text class="text">镜腿长度</text> 193 <view class="inputItem">
192 <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth!=='0'?glassInfo.legWidth:''" placeholder="请输入镜腿长度"/> 194 <text class="text">镜片宽度</text>
193 </view> 195 <input class="input" @input="glassInfoInput($event,0)" type="text"
194 196 :value="glassInfo.glassWidth!=='0'?glassInfo.glassWidth:''"
195 </view> 197 placeholder="请输入镜片宽度" />
196 <!-- <view class="confirm"> 198 </view>
199 <view class="inputItem">
200 <text class="text">鼻梁宽度</text>
201 <input class="input" @input="glassInfoInput($event,1)" type="text"
202 :value="glassInfo.norseWidth!=='0'?glassInfo.norseWidth:''"
203 placeholder="请输入鼻梁宽度" />
204 </view>
205 <view class="inputItem">
206 <text class="text">镜腿长度</text>
207 <input class="input" @input="glassInfoInput($event,2)" type="text"
208 :value="glassInfo.legWidth!=='0'?glassInfo.legWidth:''"
209 placeholder="请输入镜腿长度" />
210 </view>
211
212 </view>
213 <!-- <view class="confirm">
197 <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> 214 <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image>
198 <text>确认以上输入信息来源于我的验光数据!</text> 215 <text>确认以上输入信息来源于我的验光数据!</text>
199 </view> --> 216 </view> -->
200 </view> 217 </view>
201 </template> 218 </template>
202 <template v-else> 219 <template v-else>
203 <view 220 <view v-for="item in pickerInfoList" :key="item.key" class="bodyBox">
204 v-for="item in pickerInfoList" 221 <template v-if="item.nameC==='验光日期'">
205 :key="item.key" 222 <text class="names">{{item.nameC}}</text>
206 class="bodyBox" 223 <text
207 > 224 style="margin-right: 5px;">{{item.nameArray1[item.nameIndex1]}}年</text>
208 <template v-if="item.nameC==='验光日期'"> 225 <text
209 <text class="names">{{item.nameC}}</text> 226 style="margin-right: 5px;">{{item.nameArray2[item.nameIndex2]}}月</text>
210 <text style="margin-right: 5px;">{{item.nameArray1[item.nameIndex1]}}年</text> 227 <text>{{item.nameArray3[item.nameIndex2]}}日</text>
211 <text style="margin-right: 5px;">{{item.nameArray2[item.nameIndex2]}}月</text> 228 </template>
212 <text>{{item.nameArray3[item.nameIndex2]}}日</text> 229 <template v-else>
213 </template> 230 <template v-if="item.nameC==='度数'">
214 <template v-else> 231 <text style="display: inline;">*</text>
215 <template v-if="item.nameC==='度数'"> 232 </template>
216 <text style="display: inline;">*</text> 233
217 </template> 234 <text class="names">{{item.nameC}}</text>
218 235 <text
219 <text class="names">{{item.nameC}}</text> 236 style="margin-right: 10px;">左&nbsp;{{item.nameArray1[item.nameIndex1]}}</text>
220 <text style="margin-right: 10px;">左&nbsp;{{item.nameArray1[item.nameIndex1]}}</text> 237 <text>右&nbsp;{{item.nameArray2[item.nameIndex2]}}</text>
221 <text>右&nbsp;{{item.nameArray2[item.nameIndex2]}}</text> 238 </template>
222 </template> 239 </view>
223 </view> 240 </template>
224 </template>
225 </view>
226 </view>
227 </view>
228 <view class="choose">
229 <view
230 class="chooseItem_1_content"
231 v-for="(item,index) in attrList"
232 :key="index"
233 >
234 <UniCollapse @change="changeShow(index)">
235 <UniCollapseItem
236 :open="show[index]"
237 :title="item.meta_name"
238 showAnimation=false
239 >
240 <view class="chooseItem_1_content">
241 <view class="itemsWrap" v-if="isCart ==3">
242 <view
243 class="item2"
244 v-for="(one,i) in item.attr"
245 :key="i"
246 :class="{ active2: current[index] === i}"
247 @click="cartOnClickItem(index, i,one.aid)"
248 >{{one.name}}</view>
249 </view>
250 <view class="itemsWrap" v-else>
251 <view
252 class="item2"
253 v-for="(one,i) in item.attr"
254 :key="i"
255 :class="{ active2: current[index] === i }"
256 @click="cartOnClickItem(index, i,one.aid)"
257 >{{one.name}}</view>
258 </view> 241 </view>
259 </view> 242 </view>
260 </UniCollapseItem> 243 </view>
261 </UniCollapse> 244 <view class="choose">
262 <view 245 <view class="chooseItem_1_content" v-for="(item,index) in attrList" :key="index">
263 class="chooseRes" 246 <UniCollapse @change="changeShow(index)">
264 v-show="!show[index]" 247 <UniCollapseItem :open="show[index]" :title="item.meta_name" showAnimation=false>
265 >* {{attrList[index].attr[current[index]].name}}</view> 248 <view class="chooseItem_1_content">
266 </view> 249 <view class="itemsWrap" v-if="isCart ==3">
267 </view> 250 <view class="item2" v-for="(one,i) in item.attr" :key="i"
268 <view 251 :class="{ active2: current[index] === i}"
269 class="button" 252 @click="cartOnClickItem(index, i,one.aid)">{{one.name}}</view>
270 @click.native="addCart" 253 </view>
271 v-if="isCart == 1" 254 <view class="itemsWrap" v-else>
272 > 255 <view class="item2" v-for="(one,i) in item.attr" :key="i"
273 加入购物车 256 :class="{ active2: current[index] === i }"
274 </view> 257 @click="cartOnClickItem(index, i,one.aid)">{{one.name}}</view>
275 <view 258 </view>
276 class="button" 259 </view>
277 @click="toComfirmOrder" 260 </UniCollapseItem>
278 v-if="isCart == 2" 261 </UniCollapse>
279 > 262 <view class="chooseRes" v-show="!show[index]">*
280 立即结算 263 {{attrList[index].attr[current[index]].name}}</view>
281 </view> 264 </view>
282 <view 265 </view>
283 class="button" 266 <view class="button" @click.native="addCart" v-if="isCart == 1">
284 @click="comfirmChoose" 267 加入购物车
285 v-if="isCart == 3" 268 </view>
286 > 269 <view class="button" @click="toComfirmOrder" v-if="isCart == 2">
287 确定 270 立即结算
288 </view> 271 </view>
272 <view class="button" @click="comfirmChoose" v-if="isCart == 3">
273 确定
274 </view>
289 </view> 275 </view>
290 </scroll-view> 276 </scroll-view>
291 </view> 277 </view>
292 </view> 278 </view>
293 </template> 279 </template>
294 <script> 280 <script>
295 import UniCollapse from '@/components/UniCollapse/UniCollapse.vue' 281 import UniCollapse from '@/components/UniCollapse/UniCollapse.vue'
296 import UniCollapseItem from '@/components/UniCollapseItem/UniCollapseItem.vue' 282 import UniCollapseItem from '@/components/UniCollapseItem/UniCollapseItem.vue'
297 import store from '@/store' 283 import store from '@/store'
298 export default { 284 export default {
299 components: { 285 components: {
300 UniCollapse, 286 UniCollapse,
301 UniCollapseItem, 287 UniCollapseItem,
302 }, 288 },
303 props: { 289 props: {
304 isShowBottom : Boolean, 290 isShowBottom: Boolean,
305 pid: Number, 291 shop_wood_id: String,
306 sk_id:String, 292 wsp_id: String,
307 propMpId:String, 293 propMpId: String,
308 goodInfo:Object, 294 goodInfo: Object,
309 isCart:Number, 295 isCart: Number,
310 cart_id:Number, 296 cart_id: String,
311 index:Number 297 index: Number
312 }, 298 },
313 data() { 299 data() {
314 return { 300 return {
315 loveCurrent:Number, 301 loveCurrent: Number,
316 count: 1, 302 count: 1,
317 // pid: 0, 303 // pid: 0,
318 maxCount: 20, 304 maxCount: 20,
319 dataName: '', // 验光数据人员名称 305 dataName: '', // 验光数据人员名称
320 isDataName: false, // 是否是已存在的人员数据 306 isDataName: false, // 是否是已存在的人员数据
321 dataConfirm: false, // 已确认所输入验光数据 307 dataConfirm: false, // 已确认所输入验光数据
322 opIsOpen: true, 308 opIsOpen: true,
323 addDisabled: false, 309 addDisabled: false,
324 desDisabled: false, 310 desDisabled: false,
325 current: [], 311 current: [],
326 show: [true,true], 312 show: [true, true],
327 checkedData: {}, 313 checkedData: {},
328 // 度数相关数据 314 // 度数相关数据
329 pickerInfoList: [ 315 pickerInfoList: [{
330 { nameC: '度数', nameE: '(SPH)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 0 }, 316 nameC: '度数',
331 { nameC: '散光', nameE: '(CYL)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 1 }, 317 nameE: '(SPH)',
332 { nameC: '散光轴位', nameE: '(AXI)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 2 }, 318 nameArray1: [''],
333 { nameC: '验光日期', nameE: '', nameArray1: [''], nameIndex1: 0, nameArray2: ['', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], nameIndex2: 0, nameArray3: [''], nameIndex3: 0 }, 319 nameIndex1: 0,
334 ], 320 nameArray2: [''],
335 // confirm: false, // 用户是否确认 321 nameIndex2: 0,
336 // tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'], 322 key: 0
337 name: '', 323 },
338 oldname: '', // 用于判读用户是否改变名字 324 {
339 pickerInfoChioce: { 325 nameC: '散光',
340 leftSph: '', 326 nameE: '(CYL)',
341 rightSph: '', 327 nameArray1: [''],
342 leftCyl: '', 328 nameIndex1: 0,
343 rightCyl: '', 329 nameArray2: [''],
344 leftAxi: '', 330 nameIndex2: 0,
345 rightAxi: '', 331 key: 1
346 time: { 332 },
347 year: 0, 333 {
348 month: 0, 334 nameC: '散光轴位',
349 day: 0, 335 nameE: '(AXI)',
350 }, 336 nameArray1: [''],
351 }, 337 nameIndex1: 0,
352 glassInfo:{ 338 nameArray2: [''],
353 glassWidth:Number,//镜片宽度 339 nameIndex2: 0,
354 norseWidth:Number,//鼻宽 340 key: 2
355 legWidth:Number//镜腿长度 341 },
356 }, 342 {
357 pd: '', // 瞳距 343 nameC: '验光日期',
358 oldpd: '', // 用于判断用户是否改变瞳距 344 nameE: '',
359 kinds: 1, // kinds=1,提交为新增验光,2为修改 345 nameArray1: [''],
360 mp_id: Number, 346 nameIndex1: 0,
361 skuValueArray:[], 347 nameArray2: ['', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
362 skId:String 348 nameIndex2: 0,
363 } 349 nameArray3: [''],
350 nameIndex3: 0
351 },
352 ],
353 // confirm: false, // 用户是否确认
354 // tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'],
355 name: '',
356 oldname: '', // 用于判读用户是否改变名字
357 pickerInfoChioce: {
358 leftSph: '',
359 rightSph: '',
360 leftCyl: '',
361 rightCyl: '',
362 leftAxi: '',
363 rightAxi: '',
364 time: {
365 year: 0,
366 month: 0,
367 day: 0,
368 },
369 },
370 glassInfo: {
371 glassWidth: Number, //镜片宽度
372 norseWidth: Number, //鼻宽
373 legWidth: Number //镜腿长度
374 },
375 pd: '', // 瞳距
376 oldpd: '', // 用于判断用户是否改变瞳距
377 kinds: 1, // kinds=1,提交为新增验光,2为修改
378 mp_id: Number,
379 skuValueArray: [],
380 skId: String
381 }
364 }, 382 },
365 computed: { 383 computed: {
366 //进购物车选择的人的index 384 //进购物车选择的人的index
367 p_current(){ 385 p_current() {
368 const getLoveItemIndex = (item) => item.mp_id == this.propMpId 386 const getLoveItemIndex = (item) => item.mp_id == this.propMpId
369 const p_current = this.$store.state.myLoveList.loveList.findIndex(getLoveItemIndex ) 387 const p_current = this.$store.state.myLoveList.loveList.findIndex(getLoveItemIndex)
370 if(this.isCart == 3){ 388 if (this.isCart == 3) {
371 this.loveCurrent = p_current 389 this.loveCurrent = p_current
372 } 390 }
373 return p_current 391 return p_current
374 }, 392 },
375 arr_current(){ 393 arr_current() {
376 if(this.isCart == 3){ 394 if (this.isCart == 3) {
377 const skId = this.sk_id 395 const skId = this.wsp_id
378 const skuValue = this.skuItem.sku_value 396 const skuValue = this.skuItem.wsp_sku_name
379 const skuValueArray = skuValue.split('_') 397 const skuValueArray = skuValue.split('_')
380 this.skuValueArray = skuValueArray 398 this.skuValueArray = skuValueArray
381 const attrList = this.$store.state.read.goodInfo.attrList 399 const attrList = this.$store.state.read.goodInfo.attrList
382 for (let i = 0;i<attrList.length;i++) { 400 for (let i = 0; i < attrList.length; i++) {
383 const getArrIndex = (item) => item.aid == skuValueArray[i] 401 const getArrIndex = (item) => item.aid == skuValueArray[i]
384 const arr_current = this.$store.state.read.goodInfo.attrList[i].attr.findIndex(getArrIndex ) 402 const arr_current = this.$store.state.read.goodInfo.attrList[i].attr.findIndex(getArrIndex)
385 // console.log('arr_current',arr_current) 403 // console.log('arr_current',arr_current)
386 this.current.push(arr_current) 404 this.current.push(arr_current)
387 } 405 }
388 }else{ 406 } else {
389 return null 407 return null
390 } 408 }
391 }, 409 },
392 loveList() { 410 loveList() {
393 return this.$store.state.myLoveList.loveList || [] 411 return this.$store.state.myLoveList.loveList || []
394 }, 412 },
395 attrList() { 413 attrList() {
396 // console.log('attrList',this.$store.state.read.goodInfo.attrList) 414 // console.log('attrList',this.$store.state.read.goodInfo.attrList)
397 let attrList = this.$store.state.read.goodInfo.attrList 415 let attrList = this.$store.state.read.goodInfo.attrList
398 if(attrList !== undefined){ 416 if (attrList !== undefined) {
399 return attrList 417 return attrList
400 }else{ 418 } else {
401 return [] 419 return []
402 } 420 }
403 }, 421 },
404 skuList() { 422 skuList() {
405 // console.log('skuList',this.$store.state.read.goodInfo.skuList) 423 // console.log('skuList',this.$store.state.read.goodInfo.skuList)
406 return this.$store.state.read.goodInfo.skuList 424 return this.$store.state.read.goodInfo.sku
407 }, 425 },
408 skuItem(){ 426 skuItem() {
409 // if(this.isCart == 3){ 427 // if(this.isCart == 3){
410 const skuList = this.$store.state.read.goodInfo.skuList 428 const skuList = this.$store.state.read.goodInfo.sku
411 const skuItem = skuList.filter(item => item.sk_id === this.skId)[0] 429 // console.log('skuItemskuItemskuItemskuItemskuItem', this.$store.state.read.goodInfo);
412 return skuItem 430 const skuItem = skuList.filter(item => item.wsp_id === this.skId)[0]
413 // }else{ 431 return skuItem
414 // const skuList = this.$store.state.read.goodInfo.skuList 432 // }else{
415 // const skuItem = skuList[0] 433 // const skuList = this.$store.state.read.goodInfo.skuList
416 // return skuItem 434 // const skuItem = skuList[0]
417 // } 435 // return skuItem
418 }, 436 // }
419 mpList() { 437 },
420 438 mpList() {
421 return this.$store.state.myLoveList.loveList 439
422 }, 440 return this.$store.state.myLoveList.loveList
423 glassInfoRight(){ 441 },
424 const glassInfoArr = Object.values(this.glassInfo) 442 glassInfoRight() {
425 // console.log('glassInfoArr',glassInfoArr.find(item => item == '0')) 443 const glassInfoArr = Object.values(this.glassInfo)
426 return glassInfoArr.find(item => item == '0') ==undefined 444 // console.log('glassInfoArr',glassInfoArr.find(item => item == '0'))
427 } 445 return glassInfoArr.find(item => item == '0') == undefined
446 }
428 }, 447 },
429 created() { 448 created() {
430 this.skuValueArray = this.skuList[0].sku_value.split("_") 449 this.skuValueArray = this.skuList[0].wsp_sku_name.split("_")
431 // console.log(this.sk_id) 450 // console.log(this.wsp_id)
432 this.mp_id = this.propMpId 451 this.mp_id = this.propMpId
433 const pid = this.pid 452 const pid = this.shop_wood_id
434 if(this.isCart!==3){ 453 if (this.isCart !== 3) {
435 this.skId = this.skuList[0].sk_id 454 this.skId = this.skuList[0].wsp_id
436 const current = [] 455 const current = []
437 const show = [] 456 const show = []
438 for (let index = 0; index < this.attrList.length; index++) { 457 for (let index = 0; index < this.attrList.length; index++) {
439 current.push(0) 458 current.push(0)
440 show.push(true) 459 show.push(true)
460 }
461 this.current = current
462 this.show = show
463 } else {
464 this.skId = this.wsp_id
465 }
466 //获取关心的人列表
467 store.dispatch('myLoveList/getLoveList', {
468 uid: this.$store.state.user.userInfo.uid,
469 });
470 // 初始化SPL、CYL、AXI的值
471 for (let j = 0; j < 3; j++) {
472 for (let i = -12; i < 6; i++) {
473 this.pickerInfoList[j].nameArray1.push(i)
474 this.pickerInfoList[j].nameArray1.push(i + 0.5)
475 this.pickerInfoList[j].nameArray2.push(i)
476 this.pickerInfoList[j].nameArray2.push(i + 0.5)
477 if (i >= -6) {
478 this.pickerInfoList[j].nameArray1.push(i + 0.25)
479 this.pickerInfoList[j].nameArray1.push(i + 0.75)
480 this.pickerInfoList[j].nameArray2.push(i + 0.25)
481 this.pickerInfoList[j].nameArray2.push(i + 0.75)
482 }
483 if (i === 5) {
484 this.pickerInfoList[j].nameArray1.push(i + 1)
485 this.pickerInfoList[j].nameArray2.push(i + 1)
486 }
487 }
488 }
489 // 初始化日期值
490 for (let i = 1; i < 32; i++) {
491 this.pickerInfoList[3].nameArray3.push(i)
492 }
493 // 初始化年份前后五年
494 const myDate = new Date()
495 const nowYear = myDate.getFullYear()
496 for (let i = 0; i < 5; i++) {
497 this.pickerInfoList[3].nameArray1.push(nowYear - i)
441 } 498 }
442 this.current = current
443 this.show = show
444 }else{
445 this.skId = this.sk_id
446 }
447 //获取关心的人列表
448 store.dispatch('myLoveList/getLoveList', {
449 uid: this.$store.state.user.userInfo.uid,
450 });
451 // 初始化SPL、CYL、AXI的值
452 for (let j = 0; j < 3; j++) {
453 for (let i = -12; i < 6; i++) {
454 this.pickerInfoList[j].nameArray1.push(i)
455 this.pickerInfoList[j].nameArray1.push(i + 0.5)
456 this.pickerInfoList[j].nameArray2.push(i)
457 this.pickerInfoList[j].nameArray2.push(i + 0.5)
458 if (i >= -6) {
459 this.pickerInfoList[j].nameArray1.push(i + 0.25)
460 this.pickerInfoList[j].nameArray1.push(i + 0.75)
461 this.pickerInfoList[j].nameArray2.push(i + 0.25)
462 this.pickerInfoList[j].nameArray2.push(i + 0.75)
463 }
464 if (i === 5) {
465 this.pickerInfoList[j].nameArray1.push(i + 1)
466 this.pickerInfoList[j].nameArray2.push(i + 1)
467 }
468 }
469 }
470 // 初始化日期值
471 for (let i = 1; i < 32; i++) {
472 this.pickerInfoList[3].nameArray3.push(i)
473 }
474 // 初始化年份前后五年
475 const myDate = new Date()
476 const nowYear = myDate.getFullYear()
477 for (let i = 0; i < 5; i++) {
478 this.pickerInfoList[3].nameArray1.push(nowYear - i)
479 }
480 }, 499 },
481 name : "bottomSheet", 500 name: "bottomSheet",
482 methods: { 501 methods: {
483 //判断眼镜数据是否为0 502 //判断眼镜数据是否为0
484 checkGlassInfo(){ 503 checkGlassInfo() {
485 // const glassInfoArr = Object.values(this.glassInfo) 504 // const glassInfoArr = Object.values(this.glassInfo)
486 // console.log(this.glassInfoRight) 505 // console.log(this.glassInfoRight)
487 if(!this.glassInfoRight){ 506 if (!this.glassInfoRight) {
488 uni.showToast({ 507 uni.showToast({
489 title:'请完善镜框数据~', 508 title: '请完善镜框数据~',
490 icon:'none' 509 icon: 'none'
491 }) 510 })
492 } 511 }
493 }, 512 },
494 updateMylove(){ 513 updateMylove() {
495 const loveItem = this.loveList[this.loveCurrent] 514 const loveItem = this.loveList[this.loveCurrent]
496 const glassWidth = this.glassInfo.glassWidth 515 const glassWidth = this.glassInfo.glassWidth
497 const norseWidth = this.glassInfo.norseWidth 516 const norseWidth = this.glassInfo.norseWidth
498 const legWidth = this.glassInfo.legWidth 517 const legWidth = this.glassInfo.legWidth
499 if(loveItem.glassWidth !== glassWidth){ 518 if (loveItem.glassWidth !== glassWidth) {
500 store.dispatch('myLoveList/updateMylove', { 519 store.dispatch('myLoveList/updateMylove', {
501 uid: this.$store.state.user.userInfo.uid, 520 uid: this.$store.state.user.userInfo.uid,
502 openid: this.$store.state.user.userInfo.openid, 521 openid: this.$store.state.user.userInfo.openid,
503 mp_id: this.mp_id, 522 mp_id: this.mp_id,
504 keyname: 'glassWidth', 523 keyname: 'glassWidth',
505 keyvalue: glassWidth 524 keyvalue: glassWidth
506 }); 525 });
507 } 526 }
508 if(loveItem.norseWidth !== norseWidth){ 527 if (loveItem.norseWidth !== norseWidth) {
509 store.dispatch('myLoveList/updateMylove', { 528 store.dispatch('myLoveList/updateMylove', {
510 uid: this.$store.state.user.userInfo.uid, 529 uid: this.$store.state.user.userInfo.uid,
511 openid: this.$store.state.user.userInfo.openid, 530 openid: this.$store.state.user.userInfo.openid,
512 mp_id: this.mp_id, 531 mp_id: this.mp_id,
513 keyname: 'norseWidth', 532 keyname: 'norseWidth',
514 keyvalue: norseWidth 533 keyvalue: norseWidth
515 }); 534 });
516 } 535 }
517 if(loveItem.legWidth !== legWidth){ 536 if (loveItem.legWidth !== legWidth) {
518 store.dispatch('myLoveList/updateMylove', { 537 store.dispatch('myLoveList/updateMylove', {
519 uid: this.$store.state.user.userInfo.uid, 538 uid: this.$store.state.user.userInfo.uid,
520 openid: this.$store.state.user.userInfo.openid, 539 openid: this.$store.state.user.userInfo.openid,
521 mp_id: this.mp_id, 540 mp_id: this.mp_id,
522 keyname: 'legWidth', 541 keyname: 'legWidth',
523 keyvalue: legWidth 542 keyvalue: legWidth
524 }); 543 });
525 } 544 }
526 }, 545 },
527 glassInfoInput(e,type){ 546 glassInfoInput(e, type) {
528 switch(type){ 547 console.log('glassInfoInput', e);
548 switch (type) {
529 case 0: 549 case 0:
530 this.glassInfo.glassWidth = e.detail.value 550 this.glassInfo.glassWidth = e.detail.value
531 break; 551 break;
532 case 1: 552 case 1:
533 this.glassInfo.norseWidth = e.detail.value 553 this.glassInfo.norseWidth = e.detail.value
534 break; 554 break;
535 case 2: 555 case 2:
536 this.glassInfo.legWidth = e.detail.value 556 this.glassInfo.legWidth = e.detail.value
537 break; 557 break;
538 default: 558 default:
539 break; 559 break;
540 } 560 }
541 }, 561 },
542 //参数点击事件==》改变对应图片 562 //参数点击事件==》改变对应图片
543 cartOnClickItem(index, i,aid) { 563 cartOnClickItem(index, i, aid) {
544 //根据aid拼接skuValue 564 //根据aid拼接skuValue
545 this.skuValueArray[index] = aid 565 this.skuValueArray[index] = aid
546 const sku_value = this.skuValueArray.join('_') 566 const wsp_sku_name = this.skuValueArray.join('_')
547 //根据sku_value获取对应的sk_id 567 //根据wsp_sku_name获取对应的wsp_id
548 const itemSk_id = this.skuList.filter(item=>item.sku_value == sku_value)[0].sk_id 568 const itemSk_id = this.skuList.filter(item => item.wsp_sku_name == wsp_sku_name)[0].wsp_id
549 //修改sk_id 569 //修改wsp_id
550 this.skId = itemSk_id 570 this.skId = itemSk_id
551 if (this.current[index] !== i) { 571 if (this.current[index] !== i) {
552 this.current[index] = i 572 this.current[index] = i
553 } 573 }
554 this.$forceUpdate() 574 this.$forceUpdate()
555 }, 575 },
556 comfirmChoose(){ 576 comfirmChoose() {
557 this.checkGlassInfo() 577 this.checkGlassInfo()
558 if(this.glassInfoRight){ 578 if (this.glassInfoRight) {
559 this.updateMylove() 579 this.updateMylove()
560 const price = this.skuList.filter(item=>item.sk_id == this.skId)[0].real_price 580 const price = this.skuList.filter(item => item.wsp_id == this.skId)[0].real_price
561 this.$emit("chooseCartModi",this.mp_id,this.skId,price,this.pid,this.count,this.cart_id,this.index)//添加购物车 581 this.$emit("chooseCartModi", this.mp_id, this.skId, price, this.shop_wood_id, this.count, this.cart_id,
582 this.index) //添加购物车
562 this.$emit("closeBottom") 583 this.$emit("closeBottom")
563 } 584 }
564 }, 585 },
565 addCart(){ 586 addCart() {
566 this.checkGlassInfo() 587 this.checkGlassInfo()
567 if(this.glassInfoRight){ 588 if (this.glassInfoRight) {
568 this.updateMylove() 589 this.updateMylove()
569 const that = this 590 const that = this
570 const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name] 591 console.log('that.goodInfo.attrList------------>', that.goodInfo);
592 const checkedSKUName = '1111'
571 const checkedSKU = [] 593 const checkedSKU = []
572 let j; 594 // let j;
573 for (let i = 0;i<that.current.length;i++) { 595 // for (let i = 0; i < that.current.length; i++) {
574 checkedSKU.push(that.goodInfo.attrList[i].attr[that.current[i]]) 596 // // checkedSKU.push(that.goodInfo.attrList[i].attr[that.current[i]])
575 // console.log('i', i, j, i !== this.current.length - 1) 597 // // // console.log('i', i, j, i !== this.current.length - 1)
576 if (i !== this.current.length - 1) { 598 // // if (i !== this.current.length - 1) {
577 // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应 599 // // // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应
578 j = this.current[i] * this.attrList[1].attr.length 600 // // j = this.current[i] * this.attrList[1].attr.length
579 } else { 601 // // } else {
580 j += this.current[i] 602 // // j += this.current[i]
581 } 603 // // }
582 } 604 // }
583 const price = this.skuList.filter(item=>item.sk_id == this.skuList[j].sk_id)[0].real_price 605 const price = 11
584 let sk_id = this.skuList[j].sk_id 606 // let wsp_id = this.sku[j].wsp_id
585 // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU) 607 // console.log('选择的商品wsp_id',wsp_id,'选择的商品参数',checkedSKU)
586 // console.log('mp_id',this.mp_id,'数量',this.count) 608 // console.log('mp_id',this.mp_id,'数量',this.count)
587 this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车 609 this.$emit("addCart", this.mp_id, this.count, checkedSKU, this.wsp_id, price) //添加购物车
588 this.$emit("closeBottom")//关闭弹窗 610 this.$emit("closeBottom") //关闭弹窗
589 } 611 }
590 }, 612 },
591 onClickLoveItem(index,name){ 613 onClickLoveItem(index, name) {
592 const loveList = this.loveList 614 const loveList = this.loveList
593 this.glassInfo.glassWidth = loveList[index].glassWidth 615 this.glassInfo.glassWidth = loveList[index].glassWidth
594 this.glassInfo.norseWidth = loveList[index].norseWidth 616 this.glassInfo.norseWidth = loveList[index].norseWidth
595 this.glassInfo.legWidth = loveList[index].legWidth 617 this.glassInfo.legWidth = loveList[index].legWidth
596 for (let index = 0; index < loveList.length; index++) { 618 for (let index = 0; index < loveList.length; index++) {
597 if (name === loveList[index].name && name!==this.name) { 619 if (name === loveList[index].name && name !== this.name) {
598 this.isDataName = true 620 this.isDataName = true
599 this.kinds = 2 621 this.kinds = 2
600 this.name = loveList[index].name 622 this.name = loveList[index].name
601 this.pd = loveList[index].pd 623 this.pd = loveList[index].pd
602 this.mp_id = loveList[index].mp_id 624 this.mp_id = loveList[index].mp_id
603 this.oldname = loveList[index].name 625 this.oldname = loveList[index].name
604 this.oldpd = loveList[index].pd 626 this.oldpd = loveList[index].pd
605 this.pickerInfoList[0].nameArray1.unshift(loveList[index].leftSph) 627 this.pickerInfoList[0].nameArray1.unshift(loveList[index].leftSph)
606 this.pickerInfoList[0].nameArray2.unshift(loveList[index].rightSph) 628 this.pickerInfoList[0].nameArray2.unshift(loveList[index].rightSph)
607 this.pickerInfoList[1].nameArray1.unshift(loveList[index].leftCyl) 629 this.pickerInfoList[1].nameArray1.unshift(loveList[index].leftCyl)
608 this.pickerInfoList[1].nameArray2.unshift(loveList[index].rightCyl) 630 this.pickerInfoList[1].nameArray2.unshift(loveList[index].rightCyl)
609 this.pickerInfoList[2].nameArray1.unshift(loveList[index].leftAxi) 631 this.pickerInfoList[2].nameArray1.unshift(loveList[index].leftAxi)
610 this.pickerInfoList[2].nameArray2.unshift(loveList[index].rightAxi) 632 this.pickerInfoList[2].nameArray2.unshift(loveList[index].rightAxi)
611 this.pickerInfoList[3].nameArray1.unshift(loveList[index].in_time.toString().slice(0, 4)) 633 this.pickerInfoList[3].nameArray1.unshift(loveList[index].in_time.toString().slice(0, 4))
612 if (loveList[index].in_time.toString().slice(5, 6) === 0) { 634 if (loveList[index].in_time.toString().slice(5, 6) === 0) {
613 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(6, 7)) 635 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(6, 7))
614 } else { 636 } else {
615 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(5, 7)) 637 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(5, 7))
616 } 638 }
617 if (loveList[index].in_time.toString().slice(8, 9) === 0) { 639 if (loveList[index].in_time.toString().slice(8, 9) === 0) {
618 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(9, 10)) 640 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(9, 10))
619 } else { 641 } else {
620 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(8, 10)) 642 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(8, 10))
621 } 643 }
622 } 644 }
623 } 645 }
624 this.name = name; 646 this.name = name;
625 this.loveCurrent = index; 647 this.loveCurrent = index;
626 }, 648 },
627 closeSheet(){ 649 closeSheet() {
628 this.$emit('closeBottom'); 650 this.$emit('closeBottom');
629 }, 651 },
630 stopEvent(){ //@click.stop防止事件冒泡 652 stopEvent() { //@click.stop防止事件冒泡
631 653
632 }, 654 },
633 moveHandle(){ //不让页面滚动 655 moveHandle() { //不让页面滚动
634 656
635 }, 657 },
636 // picker相关功能 658 // picker相关功能
637 handleInput(e) { 659 handleInput(e) {
638 this.name = e.target.value 660 console.log('handleInputhandleInputhandleInput', e);
639 this.isDataName = false 661 this.name = e.target.value
640 const mpList = this.mpList 662 this.isDataName = false
641 // console.log('mpList===>', mpList) 663 const mpList = this.mpList
642 for (let index = 0; index < mpList.length; index++) { 664 // console.log('mpList===>', mpList)
643 if (e.detail.value === mpList[index].name) { 665 for (let index = 0; index < mpList.length; index++) {
644 this.isDataName = true 666 if (e.detail.value === mpList[index].name) {
645 uni.showModal({ 667 this.isDataName = true
646 title: '提示', 668 uni.showModal({
647 content: `是否填充已有的"${e.detail.value}"的数据`, 669 title: '提示',
648 success: (res) => { 670 content: `是否填充已有的"${e.detail.value}"的数据`,
649 if (res.confirm) { 671 success: (res) => {
650 this.kinds = 2 672 if (res.confirm) {
651 // console.log('args===>', index) 673 this.kinds = 2
652 // const mpList=Object.assign({},this.$store.state.mympList.mpList) 674 // console.log('args===>', index)
653 this.name = mpList[index].name 675 // const mpList=Object.assign({},this.$store.state.mympList.mpList)
654 this.pd = mpList[index].pd 676 this.name = mpList[index].name
655 this.mp_id = mpList[index].mp_id 677 this.pd = mpList[index].pd
656 this.oldname = mpList[index].name 678 this.mp_id = mpList[index].mp_id
657 this.oldpd = mpList[index].pd 679 this.oldname = mpList[index].name
658 // 将kinds =2时的值传到该页面 680 this.oldpd = mpList[index].pd
659 this.pickerInfoList[0].nameArray1.unshift(mpList[index].leftSph) 681 // 将kinds =2时的值传到该页面
660 this.pickerInfoList[0].nameArray2.unshift(mpList[index].rightSph) 682 this.pickerInfoList[0].nameArray1.unshift(mpList[index].leftSph)
661 this.pickerInfoList[1].nameArray1.unshift(mpList[index].leftCyl) 683 this.pickerInfoList[0].nameArray2.unshift(mpList[index].rightSph)
662 this.pickerInfoList[1].nameArray2.unshift(mpList[index].rightCyl) 684 this.pickerInfoList[1].nameArray1.unshift(mpList[index].leftCyl)
663 this.pickerInfoList[2].nameArray1.unshift(mpList[index].leftAxi) 685 this.pickerInfoList[1].nameArray2.unshift(mpList[index].rightCyl)
664 this.pickerInfoList[2].nameArray2.unshift(mpList[index].rightAxi) 686 this.pickerInfoList[2].nameArray1.unshift(mpList[index].leftAxi)
665 this.pickerInfoList[3].nameArray1.unshift(mpList[index].in_time.toString().slice(0, 4)) 687 this.pickerInfoList[2].nameArray2.unshift(mpList[index].rightAxi)
666 if (mpList[index].in_time.toString().slice(5, 6) === 0) { 688 this.pickerInfoList[3].nameArray1.unshift(mpList[index].in_time.toString()
667 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(6, 7)) 689 .slice(0, 4))
668 } else { 690 if (mpList[index].in_time.toString().slice(5, 6) === 0) {
669 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(5, 7)) 691 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time
670 } 692 .toString().slice(6, 7))
671 if (mpList[index].in_time.toString().slice(8, 9) === 0) { 693 } else {
672 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(9, 10)) 694 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time
673 } else { 695 .toString().slice(5, 7))
674 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(8, 10)) 696 }
675 } 697 if (mpList[index].in_time.toString().slice(8, 9) === 0) {
676 // this.checkedData = mpList[index] 698 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time
677 // console.log('checkedData', this.checkedData) 699 .toString().slice(9, 10))
678 } else if (res.cancel) { 700 } else {
679 this.kinds = 2 701 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time
680 } 702 .toString().slice(8, 10))
681 }, 703 }
682 }) 704 // this.checkedData = mpList[index]
683 } 705 // console.log('checkedData', this.checkedData)
684 } 706 } else if (res.cancel) {
707 this.kinds = 2
708 }
709 },
710 })
711 }
712 }
685 }, 713 },
686 handleInputPd(e) { 714 handleInputPd(e) {
687 // 只能输入正浮点数或正数 715 // 只能输入正浮点数或正数
688 if (/^\d+(\.\d+)?$/.test(e.target.value)) { 716 console.log('handleInputPdhandleInputPd', e);
689 this.pd = e.target.value 717 if (/^\d+(\.\d+)?$/.test(e.target.value)) {
690 } else { 718 this.pd = e.target.value
691 uni.showToast({ 719 } else {
692 title: '请输入有效数据;示例:89', 720 uni.showToast({
693 icon: 'none', 721 title: '请输入有效数据;示例:89',
694 duration: 2000, 722 icon: 'none',
695 }) 723 duration: 2000,
696 this.pd = '' 724 })
697 } 725 this.pd = ''
726 }
698 }, 727 },
699 // changeConfirm() { 728 // changeConfirm() {
700 // this.confirm = !this.confirm 729 // this.confirm = !this.confirm
701 // }, 730 // },
702 bindPickerChange01: function(e) { 731 bindPickerChange01: function(e) {
703 this.pickerInfoList[0].nameIndex1 = e.target.value 732 this.pickerInfoList[0].nameIndex1 = e.target.value
704 this.pickerInfoChioce.leftSph = this.pickerInfoList[0].nameArray1[e.target.value] 733 this.pickerInfoChioce.leftSph = this.pickerInfoList[0].nameArray1[e.target.value]
705 }, 734 },
706 bindPickerChange02: function(e) { 735 bindPickerChange02: function(e) {
707 this.pickerInfoList[0].nameIndex2 = e.target.value 736 this.pickerInfoList[0].nameIndex2 = e.target.value
708 this.pickerInfoChioce.rightSph = this.pickerInfoList[0].nameArray2[e.target.value] 737 this.pickerInfoChioce.rightSph = this.pickerInfoList[0].nameArray2[e.target.value]
709 }, 738 },
710 739
711 bindPickerChange11: function(e) { 740 bindPickerChange11: function(e) {
712 this.pickerInfoList[1].nameIndex1 = e.target.value 741 this.pickerInfoList[1].nameIndex1 = e.target.value
713 this.pickerInfoChioce.leftCyl = this.pickerInfoList[1].nameArray1[e.target.value] 742 this.pickerInfoChioce.leftCyl = this.pickerInfoList[1].nameArray1[e.target.value]
714 }, 743 },
715 bindPickerChange12: function(e) { 744 bindPickerChange12: function(e) {
716 this.pickerInfoList[1].nameIndex2 = e.target.value 745 this.pickerInfoList[1].nameIndex2 = e.target.value
717 this.pickerInfoChioce.rightCyl = this.pickerInfoList[1].nameArray2[e.target.value] 746 this.pickerInfoChioce.rightCyl = this.pickerInfoList[1].nameArray2[e.target.value]
718 }, 747 },
719 748
720 bindPickerChange21: function(e) { 749 bindPickerChange21: function(e) {
721 this.pickerInfoList[2].nameIndex1 = e.target.value 750 this.pickerInfoList[2].nameIndex1 = e.target.value
722 this.pickerInfoChioce.leftAxi = this.pickerInfoList[2].nameArray1[e.target.value] 751 this.pickerInfoChioce.leftAxi = this.pickerInfoList[2].nameArray1[e.target.value]
723 }, 752 },
724 bindPickerChange22: function(e) { 753 bindPickerChange22: function(e) {
725 this.pickerInfoList[2].nameIndex2 = e.target.value 754 this.pickerInfoList[2].nameIndex2 = e.target.value
726 this.pickerInfoChioce.rightAxi = this.pickerInfoList[2].nameArray2[e.target.value] 755 this.pickerInfoChioce.rightAxi = this.pickerInfoList[2].nameArray2[e.target.value]
727 }, 756 },
728 757
729 bindPickerChange41: function(e) { 758 bindPickerChange41: function(e) {
730 this.pickerInfoList[3].nameIndex1 = e.target.value 759 this.pickerInfoList[3].nameIndex1 = e.target.value
731 this.pickerInfoChioce.time.year = this.pickerInfoList[3].nameArray1[e.target.value] 760 this.pickerInfoChioce.time.year = this.pickerInfoList[3].nameArray1[e.target.value]
732 }, 761 },
733 bindPickerChange42: function(e) { 762 bindPickerChange42: function(e) {
734 this.pickerInfoList[3].nameIndex2 = e.target.value 763 this.pickerInfoList[3].nameIndex2 = e.target.value
735 this.pickerInfoChioce.time.month = this.pickerInfoList[3].nameArray2[e.target.value] 764 this.pickerInfoChioce.time.month = this.pickerInfoList[3].nameArray2[e.target.value]
736 }, 765 },
737 bindPickerChange43: function(e) { 766 bindPickerChange43: function(e) {
738 this.pickerInfoList[3].nameIndex3 = e.target.value 767 this.pickerInfoList[3].nameIndex3 = e.target.value
739 this.pickerInfoChioce.time.day = this.pickerInfoList[3].nameArray3[e.target.value] 768 this.pickerInfoChioce.time.day = this.pickerInfoList[3].nameArray3[e.target.value]
740 }, 769 },
741 changeShow(num) { 770 changeShow(num) {
742 this.show[num] = !this.show[num] 771 this.show[num] = !this.show[num]
743 this.$forceUpdate() 772 this.$forceUpdate()
744 }, 773 },
745 counter(isadd) { 774 counter(isadd) {
746 if (isadd) { 775 if (isadd) {
747 this.count >= this.maxCount ? this.addDisabled = true : this.count++ 776 this.count >= this.maxCount ? this.addDisabled = true : this.count++
748 } else { 777 } else {
749 this.count <= 1 ? this.desDisabled = true : this.count-- 778 this.count <= 1 ? this.desDisabled = true : this.count--
750 } 779 }
751 }, 780 },
752 toComfirmOrder() { 781 toComfirmOrder() {
753 this.checkGlassInfo() 782 this.checkGlassInfo()
754 this.updateMylove() 783 this.updateMylove()
755 // 先处理验光部分的逻辑,如果ok在跳转 784 // 先处理验光部分的逻辑,如果ok在跳转
756 let flag = 0 785 let flag = 0
757 if (this.name === '') { 786 if (this.name === '') {
758 uni.showToast({ 787 uni.showToast({
759 title: '请输入验光单取名', 788 title: '请输入验光单取名',
760 icon: 'none', 789 icon: 'none',
761 duration: 2000, 790 duration: 2000,
762 }) 791 })
763 } else { 792 } else {
764 if (this.pd === '') { 793 if (this.pd === '') {
765 uni.showToast({ 794 uni.showToast({
766 title: '请输入瞳距', 795 title: '请输入瞳距',
767 icon: 'none', 796 icon: 'none',
768 duration: 2000, 797 duration: 2000,
769 }) 798 })
770 } else { 799 } else {
771 if (this.kinds === 1) { 800 if (this.kinds === 1) {
772 // 添加用户验光单 801 // 添加用户验光单
773 if (this.pickerInfoChioce.rightSph === '' || this.pickerInfoChioce.leftSph === '' || 802 if (this.pickerInfoChioce.rightSph === '' || this.pickerInfoChioce.leftSph === '' ||
774 this.pickerInfoChioce.leftCyl === '' || this.pickerInfoChioce.rightCyl === '' || 803 this.pickerInfoChioce.leftCyl === '' || this.pickerInfoChioce.rightCyl === '' ||
775 this.pickerInfoChioce.leftAxi === '' || this.pickerInfoChioce.rightAxi === '' 804 this.pickerInfoChioce.leftAxi === '' || this.pickerInfoChioce.rightAxi === ''
776 ) { 805 ) {
777 uni.showToast({ 806 uni.showToast({
778 title: '请输入您的验光数据', 807 title: '请输入您的验光数据',
779 icon: 'none', 808 icon: 'none',
780 duration: 2000, 809 duration: 2000,
781 }) 810 })
782 } else { 811 } else {
783 // if (this.confirm) { 812 // if (this.confirm) {
784 store.dispatch('myLoveList/addMylove', { 813 store.dispatch('myLoveList/addMylove', {
785 uid: this.$store.state.user.userInfo.uid, 814 uid: this.$store.state.user.userInfo.uid,
786 openid: this.$store.state.user.userInfo.openid, 815 openid: this.$store.state.user.userInfo.openid,
787 // mp_name: this.$store.state.user.userInfo.mp_name, 816 // mp_name: this.$store.state.user.userInfo.mp_name,
788 leftSph: this.pickerInfoChioce.leftSph, 817 leftSph: this.pickerInfoChioce.leftSph,
789 rightSph: this.pickerInfoChioce.rightSph, 818 rightSph: this.pickerInfoChioce.rightSph,
790 leftCyl: this.pickerInfoChioce.leftCyl, 819 leftCyl: this.pickerInfoChioce.leftCyl,
791 rightCyl: this.pickerInfoChioce.rightCyl, 820 rightCyl: this.pickerInfoChioce.rightCyl,
792 leftAxi: this.pickerInfoChioce.leftAxi, 821 leftAxi: this.pickerInfoChioce.leftAxi,
793 rightAxi: this.pickerInfoChioce.rightAxi, 822 rightAxi: this.pickerInfoChioce.rightAxi,
794 pd: this.pd, // 瞳距 823 pd: this.pd, // 瞳距
795 mp_name: this.name, 824 mp_name: this.name,
796 // time: this.pickerInfoChioce.time, 825 // time: this.pickerInfoChioce.time,
797 // img_url2: "http://localhost:8087/images/shop_1/1/", 826 // img_url2: "http://localhost:8087/images/shop_1/1/",
798 }).then(({ mp_id: mpId }) => { 827 }).then(({
799 this.mp_id = mpId 828 mp_id: mpId
800 }) 829 }) => {
801 flag = 1 830 this.mp_id = mpId
802 } 831 })
803 } 832 flag = 1
804 if (this.kinds === 2) { 833 }
805 // if (this.confirm) { 834 }
806 const leftList = ['leftSph', 'leftCyl', 'leftAxi'] 835 if (this.kinds === 2) {
807 const rightList = ['rightSph', 'rightCyl', 'rightAxi'] 836 // if (this.confirm) {
808 // let flag=0; 837 const leftList = ['leftSph', 'leftCyl', 'leftAxi']
809 if (this.name !== this.oldname) { 838 const rightList = ['rightSph', 'rightCyl', 'rightAxi']
810 store.dispatch('myLoveList/updateMylove', { 839 // let flag=0;
811 uid: this.$store.state.user.userInfo.uid, 840 if (this.name !== this.oldname) {
812 openid: this.$store.state.user.userInfo.openid, 841 store.dispatch('myLoveList/updateMylove', {
813 mp_id: this.mp_id, 842 uid: this.$store.state.user.userInfo.uid,
814 keyname: 'name', 843 openid: this.$store.state.user.userInfo.openid,
815 keyvalue: this.name, 844 mp_id: this.mp_id,
816 }) 845 keyname: 'name',
817 flag = 1 846 keyvalue: this.name,
818 } 847 })
819 if (this.pd !== this.oldpd) { 848 flag = 1
820 store.dispatch('myLoveList/updateMylove', { 849 }
821 uid: this.$store.state.user.userInfo.uid, 850 if (this.pd !== this.oldpd) {
822 openid: this.$store.state.user.userInfo.openid, 851 store.dispatch('myLoveList/updateMylove', {
823 mp_id: this.mp_id, 852 uid: this.$store.state.user.userInfo.uid,
824 keyname: 'pd', 853 openid: this.$store.state.user.userInfo.openid,
825 keyvalue: this.pd, 854 mp_id: this.mp_id,
826 }) 855 keyname: 'pd',
827 flag = 1 856 keyvalue: this.pd,
828 } 857 })
829 // 先验证是否输入有无空 858 flag = 1
830 let q = true 859 }
831 for (let k = 0; k < 3; k++) { 860 // 先验证是否输入有无空
832 q = q && (this.pickerInfoList[k].nameArray1[this.pickerInfoList[k].nameIndex1] !== '' && 861 let q = true
833 this.pickerInfoList[k].nameArray2[this.pickerInfoList[k].nameIndex2] !== '') 862 for (let k = 0; k < 3; k++) {
834 } 863 q = q && (this.pickerInfoList[k].nameArray1[this.pickerInfoList[k].nameIndex1] !== '' &&
835 if (q) { 864 this.pickerInfoList[k].nameArray2[this.pickerInfoList[k].nameIndex2] !== '')
836 for (let j = 0; j < 3; j++) { 865 }
837 if (this.pickerInfoList[j].nameIndex1 !== 0) { 866 if (q) {
838 store.dispatch('myLoveList/updateMylove', { 867 for (let j = 0; j < 3; j++) {
839 uid: this.$store.state.user.userInfo.uid, 868 if (this.pickerInfoList[j].nameIndex1 !== 0) {
840 openid: this.$store.state.user.userInfo.openid, 869 store.dispatch('myLoveList/updateMylove', {
841 mp_id: this.mp_id, 870 uid: this.$store.state.user.userInfo.uid,
842 keyname: leftList[j], 871 openid: this.$store.state.user.userInfo.openid,
843 keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j].nameIndex1], 872 mp_id: this.mp_id,
844 }) 873 keyname: leftList[j],
845 } 874 keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j]
846 if (this.pickerInfoList[j].nameIndex2 !== 0) { 875 .nameIndex1],
847 store.dispatch('myLoveList/updateMylove', { 876 })
848 uid: this.$store.state.user.userInfo.uid, 877 }
849 openid: this.$store.state.user.userInfo.openid, 878 if (this.pickerInfoList[j].nameIndex2 !== 0) {
850 mp_id: this.mp_id, 879 store.dispatch('myLoveList/updateMylove', {
851 keyname: rightList[j], 880 uid: this.$store.state.user.userInfo.uid,
852 keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j].nameIndex2], 881 openid: this.$store.state.user.userInfo.openid,
853 }) 882 mp_id: this.mp_id,
854 } 883 keyname: rightList[j],
855 flag = 1 884 keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j]
856 } 885 .nameIndex2],
857 } else { 886 })
858 flag = 0 887 }
859 uni.showToast({ 888 flag = 1
860 title: '请输入您的验光数据', 889 }
861 icon: 'none', 890 } else {
862 duration: 2000, 891 flag = 0
863 }) 892 uni.showToast({
864 } 893 title: '请输入您的验光数据',
865 894 icon: 'none',
866 // } else { 895 duration: 2000,
867 // uni.showToast({ 896 })
868 // title: '请确认您的验光数据', 897 }
869 // icon: 'none', 898
870 // duration: 3000, 899 // } else {
871 // }) 900 // uni.showToast({
872 // } 901 // title: '请确认您的验光数据',
873 } 902 // icon: 'none',
874 } 903 // duration: 3000,
875 } 904 // })
876 if (flag !== 0) { 905 // }
877 // 如果数据验证无误,那么更新验光单的数据 906 }
878 store.dispatch('myLoveList/getLoveList', { 907 }
879 uid: this.$store.state.user.userInfo.uid, 908 }
880 }) 909 if (flag !== 0) {
881 let i = 0 910 // 如果数据验证无误,那么更新验光单的数据
882 // 判断出是哪一个sku被选中 911 store.dispatch('myLoveList/getLoveList', {
883 for (let index = 0; index < this.current.length; index++) { 912 uid: this.$store.state.user.userInfo.uid,
884 // console.log('index', index, i, index !== this.current.length - 1) 913 })
885 if (index !== this.current.length - 1) { 914 let i = 0
886 // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应 915 // 判断出是哪一个sku被选中
887 i = this.current[index] * this.attrList[1].attr.length 916 for (let index = 0; index < this.current.length; index++) {
888 } else { 917 // console.log('index', index, i, index !== this.current.length - 1)
889 i += this.current[index] 918 if (index !== this.current.length - 1) {
890 } 919 // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应
891 } 920 i = this.current[index] * this.attrList[1].attr.length
892 // 判断是否其输入的人员数据是否已存在 921 } else {
893 store.dispatch('order/saveParams', { 922 i += this.current[index]
894 sk_id_arr: this.skuList[i], 923 }
895 current: this.current, 924 }
896 mp_id: this.mp_id, 925 // 判断是否其输入的人员数据是否已存在
897 attrList: this.attrList, 926 store.dispatch('order/saveParams', {
898 }) 927 wsp_id_arr: this.skuList[i],
899 this.$store.state.cart.buyItem = this.skuItem 928 current: this.current,
900 // 跳转到确认订单页面 929 mp_id: this.mp_id,
901 uni.navigateTo({ 930 attrList: this.attrList,
902 url: `../confirmOrder/confirmOrder?pid=${this.pid}&count=${this.count}&name=${this.name}&isCart=false`, 931 })
903 }) 932 this.$store.state.cart.buyItem = this.skuItem
904 } 933 // 跳转到确认订单页面
934 uni.navigateTo({
935 url: `../confirmOrder/confirmOrder?shop_wood_id=${this.shop_wood_id}&count=${this.count}&name=${this.name}&isCart=false`,
936 })
937 }
905 }, 938 },
906 } 939 }
907 } 940 }
908 </script> 941 </script>
909 942
910 <style lang="scss"> 943 <style lang="scss">
911 .BottomSheetContent { 944 .BottomSheetContent {
912 min-height: 100vh; 945 min-height: 100vh;
913 background-color: #f2f2f2; 946 background-color: #f2f2f2;
914 // padding-top: 20rpx; 947
915 .goodInfo { 948 // padding-top: 20rpx;
916 width: 100%; 949 .goodInfo {
917 height: 272rpx; 950 width: 100%;
918 border-radius: 16rpx; 951 height: 272rpx;
919 background-color: #ffffff; 952 border-radius: 16rpx;
920 box-sizing: border-box; 953 background-color: #ffffff;
921 padding: 36rpx; 954 box-sizing: border-box;
922 display: flex; 955 padding: 36rpx;
923 flex-direction: row; 956 display: flex;
924 justify-content: flex-start; 957 flex-direction: row;
925 position: sticky; 958 justify-content: flex-start;
926 top: 0rpx; 959 position: sticky;
927 left: 0rpx; 960 top: 0rpx;
928 z-index: 99999; 961 left: 0rpx;
929 .imageWrap { 962 z-index: 99999;
930 height: 188rpx; 963
931 width: 188rpx; 964 .imageWrap {
932 margin-right: 28rpx; 965 height: 188rpx;
933 image { 966 width: 188rpx;
934 height: 188rpx; 967 margin-right: 28rpx;
935 width: 188rpx; 968
936 } 969 image {
937 } 970 height: 188rpx;
938 .infoRight { 971 width: 188rpx;
939 display: flex; 972 }
940 flex-direction: column; 973 }
941 align-items: flex-start; 974
942 justify-content: space-between; 975 .infoRight {
943 width: 100%; 976 display: flex;
944 .goodName { 977 flex-direction: column;
945 font-size: 28rpx; 978 align-items: flex-start;
946 color: #333333; 979 justify-content: space-between;
947 } 980 width: 100%;
948 .remarks { 981
949 font-size: 20rpx; 982 .goodName {
950 color: #999999; 983 font-size: 28rpx;
951 } 984 color: #333333;
952 .priceBox { 985 }
953 display: flex; 986
954 justify-content: space-between; 987 .remarks {
955 align-items: center; 988 font-size: 20rpx;
956 width: 100%; 989 color: #999999;
957 font-size: 14px; 990 }
958 color: #999999; 991
959 .price { 992 .priceBox {
960 color: #ff6b4a; 993 display: flex;
961 font-size: 28rpx; 994 justify-content: space-between;
962 } 995 align-items: center;
963 .counter { 996 width: 100%;
964 display: flex; 997 font-size: 14px;
965 flex-direction: row; 998 color: #999999;
966 justify-content: space-between; 999
967 align-items: center; 1000 .price {
968 font-size: 28rpx; 1001 color: #ff6b4a;
969 color: #333333; 1002 font-size: 28rpx;
970 width: 122rpx; 1003 }
971 .btn { 1004
972 display: flex; 1005 .counter {
973 justify-content: center; 1006 display: flex;
974 line-height: 32rpx; 1007 flex-direction: row;
975 height: 32rpx; 1008 justify-content: space-between;
976 width: 32rpx; 1009 align-items: center;
977 background-color: #f2f2f2; 1010 font-size: 28rpx;
978 color: #cfcfcf; 1011 color: #333333;
979 } 1012 width: 122rpx;
980 } 1013
981 } 1014 .btn {
982 } 1015 display: flex;
983 } 1016 justify-content: center;
984 .peopleChoose{ 1017 line-height: 32rpx;
985 width: 100%; 1018 height: 32rpx;
986 min-height: 200rpx; 1019 width: 32rpx;
987 border-radius: 16rpx; 1020 background-color: #f2f2f2;
988 background-color: #ffffff; 1021 color: #cfcfcf;
989 box-sizing: border-box; 1022 }
990 padding: 36rpx; 1023 }
1024 }
1025 }
1026 }
1027
1028 .peopleChoose {
1029 width: 100%;
1030 min-height: 200rpx;
1031 border-radius: 16rpx;
1032 background-color: #ffffff;
1033 box-sizing: border-box;
1034 padding: 36rpx;
991 margin: 10px 0; 1035 margin: 10px 0;
992 display: flex; 1036 display: flex;
993 flex-direction: column; 1037 flex-direction: column;
994 justify-content: flex-start; 1038 justify-content: flex-start;
995 align-items: center; 1039 align-items: center;
996 .title{ 1040
1041 .title {
997 font-size: 16px; 1042 font-size: 16px;
998 color: #333333; 1043 color: #333333;
999 letter-spacing: -0.3px; 1044 letter-spacing: -0.3px;
1000 text-align: justify; 1045 text-align: justify;
1001 line-height: 24px; 1046 line-height: 24px;
1002 margin: 4px 0; 1047 margin: 4px 0;
1003 } 1048 }
1004 .loveList{ 1049
1050 .loveList {
1005 display: flex; 1051 display: flex;
1006 flex-direction: row; 1052 flex-direction: row;
1007 flex-wrap: wrap; 1053 flex-wrap: wrap;
1008 justify-content: flex-start; 1054 justify-content: flex-start;
1009 align-items: center; 1055 align-items: center;
1010 padding-top: 24rpx; 1056 padding-top: 24rpx;
1011 width: 100%; 1057 width: 100%;
1058
1012 .peopleName { 1059 .peopleName {
1013 padding: 0 30rpx; 1060 padding: 0 30rpx;
1014 height: 60rpx; 1061 height: 60rpx;
1015 margin: 0 20rpx 20rpx 0; 1062 margin: 0 20rpx 20rpx 0;
1016 transition: all 0.3s; 1063 transition: all 0.3s;
1017 background: #f2f2f2; 1064 background: #f2f2f2;
1018 border-radius: 2px; 1065 border-radius: 2px;
1019 border-radius: 2px; 1066 border-radius: 2px;
1020 line-height: 60rpx; 1067 line-height: 60rpx;
1021 text-align: center; 1068 text-align: center;
1022 color: #666666; 1069 color: #666666;
1023 font-size: 12px; 1070 font-size: 12px;
1024 } 1071 }
1072
1025 .active2 { 1073 .active2 {
1026 background: rgba(255, 107, 74, 0.15); 1074 background: rgba(255, 107, 74, 0.15);
1027 color: #ff6b4a; 1075 color: #ff6b4a;
1028 } 1076 }
1029 } 1077 }
1030 } 1078 }
1031 .goods-data { 1079
1032 width: 100%; 1080 .goods-data {
1033 box-sizing: border-box;
1034 padding: 37rpx 40rpx 0 40rpx;
1035 background: #ffffff;
1036 border-radius: 12rpx;
1037 .opCollapse {
1038 width: 100%;
1039 padding-bottom: 28rpx;
1040 margin-top: 7px;
1041 border-bottom: 1px solid #e9e9e9;
1042 .head {
1043 display: flex;
1044 justify-content: space-between;
1045 height: 24px;
1046 // font-family: PingFangSC-Medium;
1047 font-size: 16px;
1048 color: #333333;
1049 letter-spacing: -0.3px;
1050 text-align: justify;
1051 line-height: 24px;
1052 margin-bottom: 18rpx;
1053 .headRighted {
1054 width: 0;
1055 height: 0;
1056 border-left: 4px solid transparent;
1057 border-right: 4px solid transparent;
1058 border-bottom: 4px solid #cfcfcf;
1059 transform: scaleY(-1);
1060 margin-top: 10px;
1061 }
1062 .headMid {
1063 font-size: 10px;
1064 color: #999999;
1065 letter-spacing: -0.19px;
1066 margin-left: -120rpx;
1067 }
1068 .headRight {
1069 width: 0;
1070 height: 0;
1071 border-left: 4px solid transparent;
1072 border-right: 4px solid transparent;
1073 border-bottom: 4px solid #cfcfcf;
1074 margin-top: 10px;
1075 }
1076 }
1077 .body {
1078 font-size: 12px;
1079 color: #666666;
1080 letter-spacing: 0;
1081 .bodyBox {
1082 margin-top: 15px;
1083 .names {
1084 font-size: 12px;
1085 color: #151515;
1086 letter-spacing: 0;
1087 text-align: justify;
1088 line-height: 17px;
1089 margin-left: 5px;
1090 margin-right: 10px;
1091 }
1092 text {
1093 font-size: 12px;
1094 color: #666666;
1095 letter-spacing: 0;
1096 text-align: justify;
1097 }
1098 }
1099 }
1100 .goods-form {
1101 display: flex;
1102 flex-direction: column;
1103 align-items: center;
1104 justify-content: center;
1105 background-color: #fff;
1106 width: 100%;
1107 padding: 40rpx 0;
1108 .p1 {
1109 font-size: 16px;
1110 color: #333333;
1111 letter-spacing: -0.3px;
1112 text-align: justify;
1113 line-height: 24px;
1114 margin: 4px 0;
1115
1116 }
1117 .p2 {
1118 font-size: 12px;
1119 color: #999999;
1120 letter-spacing: -0.23px;
1121 margin-bottom: 32rpx;
1122 }
1123 .image2{
1124 width: 42rpx;
1125 height: 34rpx;
1126 margin-right: 12rpx;
1127 }
1128 .confirm {
1129 display: flex;
1130 align-items: center;
1131 font-size: 12px;
1132 color: #666666;
1133 letter-spacing: -0.23px;
1134 width: 684rpx;
1135 .image1{
1136 margin-right:25rpx;
1137 width: 42rpx;
1138 height: 38rpx;
1139 }
1140 }
1141 .picker{
1142 display: flex;
1143 flex-direction: column;
1144 justify-content: center;
1145 align-items: center;
1146 width: 100%;
1147
1148 .picker-choice{
1149 display: flex;
1150 width: 684rpx;
1151 align-items: center;
1152 margin-bottom: 40rpx;
1153 .input{
1154 border-bottom: 1px solid #CFCFCF;
1155 height: 40rpx;
1156 }
1157 .choice-left{
1158 width: 210rpx;
1159 .pd{
1160 font-size: 14px;
1161 color: #333333;
1162 letter-spacing: -0.26px;
1163 text-align: justify;
1164 line-height: 24px;
1165 margin-right: 44rpx;
1166 }
1167 .p11 {
1168 font-size: 14px;
1169 color: #333333;
1170 letter-spacing: -0.26px;
1171 text-align: justify;
1172 line-height: 24px;
1173 // margin-right: 10px;
1174 }
1175 .p12 {
1176 font-size: 10px;
1177 color: #3F3F3F;
1178 letter-spacing: -0.19px;
1179 text-align: justify;
1180 line-height: 24px;
1181 }
1182
1183 }
1184 .p13 {
1185 font-size: 10px;
1186 color: #999999;
1187 letter-spacing: -0.19px;
1188 margin-right: 10px;
1189 }
1190 .p13-date {
1191 font-size: 10px;
1192 color: #999999;
1193 letter-spacing: -0.19px;
1194 margin-right: 5px;
1195 }
1196 picker{
1197 width: 144rpx;
1198 height: 40rpx;
1199 display: flex;
1200 position: relative;
1201 .p14 {
1202 font-size: 14px;
1203 color: #666666;
1204 letter-spacing: -0.26px;
1205 text-align: center;
1206 width: 124rpx;
1207 border-bottom: 1px solid #CFCFCF;
1208 height: 38rpx;
1209 }
1210 image{
1211 width: 20rpx;
1212 height: 20rpx;
1213 position: absolute;
1214 right: 20rpx;
1215 top: 8rpx;
1216 }
1217 }
1218
1219 }
1220 }
1221
1222 .ipts{
1223 width: 100%; 1081 width: 100%;
1224 display: flex;
1225 flex-direction: column;
1226 justify-content: center;
1227 align-items: flex-start;
1228 // padding: 20rpx 36rpx;
1229 box-sizing: border-box; 1082 box-sizing: border-box;
1230 .inputItem{ 1083 padding: 37rpx 40rpx 0 40rpx;
1084 background: #ffffff;
1085 border-radius: 12rpx;
1086
1087 .opCollapse {
1088 width: 100%;
1089 padding-bottom: 28rpx;
1090 margin-top: 7px;
1091 border-bottom: 1px solid #e9e9e9;
1092
1093 .head {
1094 display: flex;
1095 justify-content: space-between;
1096 height: 24px;
1097 // font-family: PingFangSC-Medium;
1098 font-size: 16px;
1099 color: #333333;
1100 letter-spacing: -0.3px;
1101 text-align: justify;
1102 line-height: 24px;
1103 margin-bottom: 18rpx;
1104
1105 .headRighted {
1106 width: 0;
1107 height: 0;
1108 border-left: 4px solid transparent;
1109 border-right: 4px solid transparent;
1110 border-bottom: 4px solid #cfcfcf;
1111 transform: scaleY(-1);
1112 margin-top: 10px;
1113 }
1114
1115 .headMid {
1116 font-size: 10px;
1117 color: #999999;
1118 letter-spacing: -0.19px;
1119 margin-left: -120rpx;
1120 }
1121
1122 .headRight {
1123 width: 0;
1124 height: 0;
1125 border-left: 4px solid transparent;
1126 border-right: 4px solid transparent;
1127 border-bottom: 4px solid #cfcfcf;
1128 margin-top: 10px;
1129 }
1130 }
1131
1132 .body {
1133 font-size: 12px;
1134 color: #666666;
1135 letter-spacing: 0;
1136
1137 .bodyBox {
1138 margin-top: 15px;
1139
1140 .names {
1141 font-size: 12px;
1142 color: #151515;
1143 letter-spacing: 0;
1144 text-align: justify;
1145 line-height: 17px;
1146 margin-left: 5px;
1147 margin-right: 10px;
1148 }
1149
1150 text {
1151 font-size: 12px;
1152 color: #666666;
1153 letter-spacing: 0;
1154 text-align: justify;
1155 }
1156 }
1157 }
1158
1159 .goods-form {
1160 display: flex;
1161 flex-direction: column;
1162 align-items: center;
1163 justify-content: center;
1164 background-color: #fff;
1165 width: 100%;
1166 padding: 40rpx 0;
1167
1168 .p1 {
1169 font-size: 16px;
1170 color: #333333;
1171 letter-spacing: -0.3px;
1172 text-align: justify;
1173 line-height: 24px;
1174 margin: 4px 0;
1175
1176 }
1177
1178 .p2 {
src/pages/address/addAddress.vue
1 <template> 1 <template>
2 <form 2 <form class="wrap" @submit="formSubmit" @reset="formReset">
3 class="wrap" 3 <view class="content">
4 @submit="formSubmit" 4 <view class="item,name">
5 @reset="formReset" 5 <text class="itemText">姓名</text>
6 > 6 <input placeholder="收货人姓名(真实姓名)" placeholder-style="color:#B8B8B8" name="name" :value="name" />
7 <view class="content"> 7 </view>
8 <view class="item,name"> 8 <view class="item,phone">
9 <text class="itemText">姓名</text> 9 <text class="itemText">电话</text>
10 <input 10 <input placeholder="手机号" type="digit" placeholder-style="color:#B8B8B8" name="mobile"
11 placeholder="收货人姓名(真实姓名)" 11 v-model="mobile" />
12 placeholder-style="color:#B8B8B8" 12 </view>
13 name="name" 13 <view class="item,phone">
14 :value="name" 14 <text class="itemText">性别</text>
15 /> 15 <picker @change="bindPickerChange" :value="sexIndex" :range="sexArray" name="sex">
16 </view> 16 <view class="uni-input">{{sexArray[sexIndex]}}</view>
17 <view class="item,phone"> 17 </picker>
18 <text class="itemText">电话</text> 18 </view>
19 <input 19 <view class="item,area">
20 placeholder="手机号" 20 <text class="itemText">地区</text>
21 type="digit" 21 <view class="btn" v-if="pickerText===''" @tap="openAddres">选择省/市/区</view>
22 placeholder-style="color:#B8B8B8" 22 <view class="btn" v-else @tap="openAddres">{{pickerText}}</view>
23 name="mobile" 23 <simple-address ref="SimpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"
24 v-model="mobile" 24 themeColor="#007AFF" name="address"></simple-address>
25 /> 25 </view>
26 </view> 26 <view class="item,address">
27 <view class="item,phone"> 27 <text class="itemText">详细地址</text>
28 <text class="itemText">性别</text> 28 <input placeholder="街道、小区门牌等详细地址" name="addDetail" :value="add_detail" />
29 <picker 29 </view>
30 @change="bindPickerChange" 30 <view class="item,check">
31 :value="index" 31 <text class="itemText">设为默认地址</text>
32 :range="sexArray" 32 <switch :checked="isDefalutAddress" color="#FF6B4A" style="transform:scale(0.6)"
33 name="sex" 33 @change="changeDefalutAddress" name="is_default" />
34 > 34 </view>
35 <view class="uni-input">{{sexArray[sexIndex]}}</view> 35 <input />
36 </picker> 36 </view>
37 </view> 37 <button form-type="submit" class="button" v-if="addId">编辑</button>
38 <view class="item,area"> 38 <button form-type="submit" class="button" v-else>保存并使用</button>
39 <text class="itemText">地区</text> 39 </form>
40 <view
41 class="btn"
42 v-if="pickerText===''"
43 @tap="openAddres"
44 >选择省/市/区</view>
45 <view
46 class="btn"
47 v-else
48 @tap="openAddres"
49 >{{pickerText}}</view>
50 <simple-address
51 ref="SimpleAddress"
52 :pickerValueDefault="cityPickerValueDefault"
53 @onConfirm="onConfirm"
54 themeColor="#007AFF"
55 name="address"
56 ></simple-address>
57 </view>
58 <view class="item,address">
59 <text class="itemText">详细地址</text>
60 <input
61 placeholder="街道、小区门牌等详细地址"
62 name="addDetail"
63 :value="addDetial"
64 />
65 </view>
66 <view class="item,check">
67 <text class="itemText">设为默认地址</text>
68 <switch
69 :checked="isDefalutAddress"
70 color="#FF6B4A"
71 style="transform:scale(0.6)"
72 @change="changeDefalutAddress"
73 name="isDefault"
74 />
75 </view>
76 <input />
77 </view>
78 <button
79 form-type="submit"
80 class="button" v-if="addId">编辑</button>
81 <button
82 form-type="submit"
83 class="button"
84 v-else
85 >保存并使用</button>
86 </form>
87 </template> 40 </template>
88 41
89 <script> 42 <script>
90 import SimpleAddress from '@/components/SimpleAddress/SimpleAddress.vue' 43 import SimpleAddress from '@/components/SimpleAddress/SimpleAddress.vue'
91 import store from '@/store' 44 import store from '@/store'
92 45
93 export default { 46 export default {
94 data () { 47 data() {
95 return { 48 return {
96 cityPickerValueDefault: [0, 0, 1], 49 cityPickerValueDefault: [0, 0, 1],
97 pickerText: '', 50 pickerText: '',
98 isDefalutAddress: true, 51 isDefalutAddress: true,
99 sexArray: ['男', '女'], 52 sexArray: ['男', '女'],
100 sexIndex: 0, 53 sexIndex: 0,
101 flag: 0, 54 flag: 0,
102 addId: undefined, 55 addId: undefined,
103 name: '', 56 name: '',
104 mobile: '', 57 mobile: '',
105 addDetial: '', 58 add_detail: '',
106 isDefault: 0 59 is_default: 0,
107 } 60 // sex:0
108 }, 61 }
109 onLoad (option) { 62 },
110 const { addId } = option 63 onLoad(option) {
111 if (addId) { 64 const {
112 this.addId = addId 65 addId
113 store.dispatch('address/details', { 66 } = option
114 add_id: addId 67 if (addId) {
115 }).then(() => { 68 this.addId = addId
116 uni.setNavigationBarTitle({ 69 store.dispatch('address/details', {
117 title: '编辑地址' 70 add_id: addId,
118 }) 71 uid:1
119 const { name, mobile, sex, add_detail: addDetial, default: isDefault,address } = this.$store.state.address.details 72 }).then(() => {
120 console.log('---', this.$store.state.address.details) 73 uni.setNavigationBarTitle({
121 const index = this.$refs.SimpleAddress.queryIndex(this.$store.state.address.details.address.split('-'), 'label') 74 title: '编辑地址'
122 console.log(index) 75 })
123 this.cityPickerValueDefault = index.index 76 const {
124 this.name = name 77 name,
125 this.mobile = Number(mobile) 78 mobile,
126 this.sexIndex = sex 79 sex,
127 this.addDetial = addDetial 80 add_id,
128 this.isDefalutAddress = !!Number(isDefault) 81 add_detail,
129 this.pickerText = address 82 province,
130 }) 83 city,
131 } 84 is_default,
132 }, 85 address
133 components: { 86 } = this.$store.state.address.details
134 SimpleAddress 87 console.log('this.$store.state.address.details', this.$store.state.address.details)
135 }, 88 let a = this.$store.state.address.details.province+"-"+this.$store.state.address.details.city+"-"+this.$store.state.address.details.address;
136 methods: { 89 console.log('a', a);
137 openAddres () { 90 const index = this.$refs.SimpleAddress.queryIndex(
138 this.cityPickerValueDefault = [0, 0, 1] 91 a.split('-'), 'label')
139 this.$refs.SimpleAddress.open() 92 console.log(index)
140 }, 93 this.cityPickerValueDefault = index.index
141 onConfirm (e) { 94 this.name = name
142 this.pickerText = e.label 95 this.mobile = Number(mobile)
143 console.log('lll', e, this.pickerText) 96 this.sexIndex = sex
144 }, 97 this.add_detail = add_detail
145 changeDefalutAddress (e) { 98 this.isDefalutAddress = !!Number(is_default)
146 this.isDefalutAddress = e.target.value 99 this.pickerText = a
147 }, 100 })
148 bindPickerChange (e) { 101 }
149 console.log('picker发送选择改变,携带值为', e.target.value) 102 },
150 this.sexIndex = e.target.value 103 components: {
151 }, 104 SimpleAddress
152 formValidation (formdata) { 105 },
153 const { name, mobile, addDetail } = formdata 106 methods: {
154 this.flag = false 107 openAddres() {
155 if (name === '') { 108 this.cityPickerValueDefault = [0, 0, 1]
156 uni.showModal({ 109 this.$refs.SimpleAddress.open()
157 content: '请输入姓名', 110 },
158 showCancel: false 111 onConfirm(e) {
159 }) 112 this.pickerText = e.label
160 return 0 113 console.log('lll', e, this.pickerText)
161 } 114 },
162 if (!(/^1[3456789]\d{9}$/.test(mobile))) { 115 changeDefalutAddress(e) {
163 uni.showModal({ 116 this.isDefalutAddress = e.target.value
164 content: '请输入正确的手机号', 117 },
165 showCancel: false 118 bindPickerChange(e) {
166 }) 119 console.log('picker发送选择改变,携带值为', e.target.value)
167 return 0 120 this.sexIndex = e.target.value
168 } 121 },
169 if (this.pickerText === '') { 122 formValidation(formdata) {
170 uni.showModal({ 123 const {
171 content: '请选择收货地区', 124 name,
172 showCancel: false 125 mobile,
173 }) 126 addDetail
174 return 0 127 } = formdata
175 } 128 this.flag = false
176 if (addDetail === '') { 129 if (name === '') {
177 uni.showModal({ 130 uni.showModal({
178 content: '请输入收货详细地址', 131 content: '请输入姓名',
179 showCancel: false 132 showCancel: false
180 }) 133 })
181 return 0 134 return 0
182 } 135 }
183 this.flag = true 136 if (!(/^1[3456789]\d{9}$/.test(mobile))) {
184 }, 137 uni.showModal({
185 formSubmit (e) { 138 content: '请输入正确的手机号',
186 const formdata = e.detail.value 139 showCancel: false
187 this.formValidation(formdata) 140 })
141 return 0
142 }
143 if (this.pickerText === '') {
144 uni.showModal({
145 content: '请选择收货地区',
146 showCancel: false
147 })
148 return 0
149 }
150 if (addDetail === '') {
151 uni.showModal({
152 content: '请输入收货详细地址',
153 showCancel: false
154 })
155 return 0
156 }
157 this.flag = true
158 },
159 formSubmit(e) {
160 const formdata = e.detail.value
161 this.formValidation(formdata)
188 162
189 const { name, mobile, addDetail, isDefault } = formdata 163 const {
190 if (this.flag === true) { 164 name,
191 const params = { 165 mobile,
192 sex: this.sexIndex, 166 addDetail,
193 name, 167 is_default
194 address: this.pickerText, 168 } = formdata
195 mobile, 169 if (this.flag === true) {
196 default: isDefault ? 1 : 0, 170 console.log('this.pickerText', this.pickerText);
197 add_detail: addDetail, 171 const addressOffice = this.pickerText.split("-");
198 longitude: 1, 172 const params = {
199 latitude: 1 173 sex: this.sexIndex,
200 } 174 name,
201 if (this.addId) { 175 province: addressOffice[0],
202 params.add_id = this.addId 176 city:addressOffice[1],
203 } 177 address: addressOffice[2],
204 store.dispatch('address/edit', params).then(() => { 178 uid:1,
205 console.log('fanhui') 179 mobile:'13910779120',
206 uni.navigateBack({ 180 default: is_default ? 1 : 0,
207 delta: 1 181 add_detail: addDetail,
208 }) 182 longitude: 1,
209 }) 183 latitude: 1
210 } 184 }
211 } 185 if (this.addId) {
212 } 186 params.add_id = this.addId
213 } 187 }
188 store.dispatch('address/edit', params).then(() => {
189 console.log('fanhui')
190 uni.navigateBack({
191 delta: 1
192 })
193 })
194 }
195 }
196 }
197 }
214 </script> 198 </script>
215 199
216 <style lang="scss"> 200 <style lang="scss">
217 .wrap { 201 .wrap {
218 height: 100vh; 202 height: 100vh;
219 background-color: #f2f2f2; 203 background-color: #f2f2f2;
220 font-family: PingFangSC-Regular; 204 font-family: PingFangSC-Regular;
221 letter-spacing: -0.23px; 205 letter-spacing: -0.23px;
222 padding-top: 19rpx; 206 padding-top: 19rpx;
223 } 207 }
224 .content { 208
225 background-color: #ffffff; 209 .content {
226 border-radius: 8px; 210 background-color: #ffffff;
227 border-radius: 8px; 211 border:1px #000 solid;
228 padding: 40rpx 56rpx; 212 border-radius: 8px;
229 margin-left: 40rpx; 213 border-radius: 8px;
230 width: 670rpx; 214 padding: 40rpx 56rpx;
231 box-sizing: border-box; 215 margin-left: 40rpx;
232 .item { 216 width: 670rpx;
233 display: flex; 217 box-sizing: border-box;
234 justify-content: flex-start; 218
235 font-size: 14px; 219 .item {
236 align-items: center; 220 display: flex;
src/pages/address/addressList.vue
1 <template> 1 <template>
2 <view class="content"> 2 <view class="content">
3 <view 3 <view
4 v-if="addressList.length !== 0" 4 v-if="addressList.length !== 0"
5 class="list" 5 class="list"
6 > 6 >
7 <view 7 <view
8 v-for="(item, index) in addressList" 8 v-for="(item, index) in addressList"
9 :key="index" 9 :key="index"
10 class="order-user" 10 class="order-user"
11 @tap="toOrder(item.add_id)" 11 @tap="toOrder(item.add_id)"
12 > 12 >
13 <view class="order-user-head"> 13 <view class="order-user-head">
14 <view class="name"> 14 <view class="name">
15 <view 15 <view
16 v-if="item.default === '1'" 16 v-if="item.default === '1'"
17 class="default" 17 class="default"
18 ><text>默认</text></view>{{item.name}} 18 ><text>默认</text></view>{{item.name}}
19 </view> 19 </view>
20 <text class="mobile">{{item.mobile}}</text> 20 <text class="mobile">{{item.mobile}}</text>
21 </view> 21 </view>
22 <view class="order-user-body"> 22 <view class="order-user-body">
23 <image src="../../static/myorder-paying-location.png"></image> 23 <image src="../../static/myorder-paying-location.png"></image>
24 <text class="address">{{item.address.replace(/[-]/g,' ')}}\n{{item.add_detail}}</text> 24 <!-- <text class="address">{{item.address.replace(/[-]/g,' ')}}\n{{item.add_detail}}</text> -->
25 <text class="address">{{item.province}}{{item.city}}{{item.address}}\n{{item.add_detail}}</text>
25 </view> 26 </view>
26 <image 27 <image
27 @click.stop="toEditAddress(item.add_id)" 28 @click.stop="toEditAddress(item.add_id)"
28 v-if="item.default === '1'" 29 v-if="item.default === '1'"
29 class="arrow" 30 class="arrow"
30 src="../../static/right.png" 31 src="../../static/right.png"
31 ></image> 32 ></image>
32 <image 33 <image
33 @click.stop="toEditAddress(item.add_id)" 34 @click.stop="toEditAddress(item.add_id)"
34 v-else 35 v-else
35 class="arrow pen" 36 class="arrow pen"
36 src="../../static/icon-pen.png" 37 src="../../static/icon-pen.png"
37 ></image> 38 ></image>
38 </view> 39 </view>
39 </view> 40 </view>
40 <view 41 <view
41 v-else 42 v-else
42 class="empty" 43 class="empty"
43 > 44 >
44 暂无收货地址 45 暂无收货地址
45 </view> 46 </view>
46 <button @tap="toAddAddress" class="add">新建收货地址</button> 47 <button @tap="toAddAddress" class="add">新建收货地址</button>
47 </view> 48 </view>
48 </template> 49 </template>
49 50
50 <script> 51 <script>
51 import store from '@/store' 52 import store from '@/store'
52 export default { 53 export default {
53 data () { 54 data () {
54 return {} 55 return {}
55 }, 56 },
56 computed: { 57 computed: {
57 addressList () { 58 addressList () {
58 return this.$store.state.address.list 59 return this.$store.state.address.list
59 } 60 }
60 }, 61 },
61 onLoad ({ edit }) { 62 onLoad ({ edit }) {
62 if (edit) { 63 if (edit) {
63 this.edit = true 64 this.edit = true
64 } 65 }
65 store.dispatch('address/list') 66 store.dispatch('address/list',{
67 uid:1
68 })
66 }, 69 },
67 onShow() { 70 onShow() {
68 store.dispatch('address/list') 71 store.dispatch('address/list',{
72 uid:1
73 })
69 }, 74 },
70 methods: { 75 methods: {
71 toAddAddress() { 76 toAddAddress() {
72 console.log('aaaaa-a') 77 console.log('aaaaa-a')
73 uni.navigateTo({ 78 uni.navigateTo({
74 url: 'addAddress', 79 url: 'addAddress',
75 fail: (error) => { 80 fail: (error) => {
76 console.error('跳转出现错误', error) 81 console.error('跳转出现错误', error)
77 } 82 }
78 }) 83 })
79 }, 84 },
80 toEditAddress (addId) { 85 toEditAddress (addId) {
81 console.log('addId', addId) 86 console.log('addId', addId)
82 uni.navigateTo({ 87 uni.navigateTo({
83 url: `addAddress?addId=${addId}`, 88 url: `addAddress?addId=${addId}`,
84 fail: (error) => { 89 fail: (error) => {
85 console.error('跳转出现错误', error) 90 console.error('跳转出现错误', error)
86 } 91 }
87 }) 92 })
88 }, 93 },
89 toOrder (addId) { 94 toOrder (addId) {
90 if (this.edit) { 95 if (this.edit) {
91 let pages = getCurrentPages(); 96 let pages = getCurrentPages();
92 let prevPage = pages[pages.length - 2]; //上一个页面 97 let prevPage = pages[pages.length - 2]; //上一个页面
93 const addressId=addId 98 const addressId=addId
94 // console.log(addressId) 99 // console.log(addressId)
95 prevPage.onShow(addressId); 100 prevPage.onShow(addressId);
96 uni.navigateBack(); 101 uni.navigateBack();
97 // uni.navigateTo({ 102 // uni.navigateTo({
98 // url: `../confirmOrder/confirmOrder?addressId=${addId}`, 103 // url: `../confirmOrder/confirmOrder?addressId=${addId}`,
99 // fail: (error) => { 104 // fail: (error) => {
100 // console.error('跳转出现错误', error) 105 // console.error('跳转出现错误', error)
101 // } 106 // }
102 // }) 107 // })
103 } 108 }
104 } 109 }
105 } 110 }
106 } 111 }
107 </script> 112 </script>
108 113
109 <style lang="scss"> 114 <style lang="scss">
110 .content { 115 .content {
111 min-height: 100vh; 116 min-height: 100vh;
112 background-color: #f2f2f2; 117 background-color: #f2f2f2;
113 padding-top: 20rpx; 118 padding-top: 20rpx;
114 padding-bottom: 112rpx; 119 padding-bottom: 112rpx;
115 .order-user { 120 .order-user {
116 width: 670rpx; 121 width: 670rpx;
117 height: 228rpx; 122 height: 228rpx;
118 background: #ffffff; 123 background: #ffffff;
119 border-radius: 14rpx; 124 border-radius: 14rpx;
120 margin: 0 auto; 125 margin: 0 auto;
121 margin-bottom: 20rpx; 126 margin-bottom: 20rpx;
122 position: relative; 127 position: relative;
123 .order-user-head { 128 .order-user-head {
124 display: flex; 129 display: flex;
125 height: 108rpx; 130 height: 108rpx;
126 width: 100%; 131 width: 100%;
127 align-items: center; 132 align-items: center;
128 padding-left: 126rpx; 133 padding-left: 126rpx;
129 box-sizing: border-box; 134 box-sizing: border-box;
130 .name { 135 .name {
131 display: flex; 136 display: flex;
132 justify-content: space-between; 137 justify-content: space-between;
133 font-size: 14px; 138 font-size: 14px;
134 color: #333333; 139 color: #333333;
135 letter-spacing: -0.26px; 140 letter-spacing: -0.26px;
136 margin-right: 20rpx; 141 margin-right: 20rpx;
137 .default { 142 .default {
138 height: 40rpx; 143 height: 40rpx;
139 width: 80rpx; 144 width: 80rpx;
140 background-color: #4a90e2; 145 background-color: #4a90e2;
141 border-radius: 13px; 146 border-radius: 13px;
142 border-radius: 13px; 147 border-radius: 13px;
143 text-align: center; 148 text-align: center;
144 margin-right: 20rpx; 149 margin-right: 20rpx;
145 text { 150 text {
146 display: flex; 151 display: flex;
147 justify-content: center; 152 justify-content: center;
148 align-items: center; 153 align-items: center;
149 font-size: 12px; 154 font-size: 12px;
150 color: #ffffff; 155 color: #ffffff;
151 letter-spacing: -0.23px; 156 letter-spacing: -0.23px;
152 } 157 }
153 } 158 }
154 } 159 }
155 .mobile { 160 .mobile {
156 font-size: 14px; 161 font-size: 14px;
157 color: #999999; 162 color: #999999;
158 letter-spacing: -0.26px; 163 letter-spacing: -0.26px;
159 } 164 }
160 } 165 }
161 .order-user-body { 166 .order-user-body {
162 display: flex; 167 display: flex;
163 width: 100%; 168 width: 100%;
164 image { 169 image {
165 width: 24px; 170 width: 24px;
166 height: 26px; 171 height: 26px;
167 margin: 12rpx 32rpx 0 40rpx; 172 margin: 12rpx 32rpx 0 40rpx;
168 } 173 }
169 .address { 174 .address {
170 font-weight: bold; 175 font-weight: bold;
171 font-size: 14px; 176 font-size: 14px;
172 color: #333333; 177 color: #333333;
173 letter-spacing: -0.26px; 178 letter-spacing: -0.26px;
174 } 179 }
175 } 180 }
176 .arrow { 181 .arrow {
177 width: 12px; 182 width: 12px;
178 height: 12px; 183 height: 12px;
179 position: absolute; 184 position: absolute;
180 right: 40rpx; 185 right: 40rpx;
181 bottom: 104rpx; 186 bottom: 104rpx;
182 } 187 }
183 } 188 }
184 .empty { 189 .empty {
185 color: #666; 190 color: #666;
186 font-size: 16px; 191 font-size: 16px;
187 text-align: center; 192 text-align: center;
188 padding-top: 30vh; 193 padding-top: 30vh;
189 } 194 }
190 .add { 195 .add {
191 position: fixed; 196 position: fixed;
192 bottom: 0; 197 bottom: 0;
193 left: 0; 198 left: 0;
194 height: 112rpx; 199 height: 112rpx;
195 width: 100%; 200 width: 100%;
196 background-color: #ff6b4a; 201 background-color: #ff6b4a;
197 display: flex; 202 display: flex;
198 justify-content: center; 203 justify-content: center;
199 align-items: center; 204 align-items: center;
200 font-size: 16px; 205 font-size: 16px;
201 color: #ffffff; 206 color: #ffffff;
202 letter-spacing: -0.3px; 207 letter-spacing: -0.3px;
203 } 208 }
204 } 209 }
205 </style> 210 </style>
206 211
src/pages/cart/cart.vue
1 <template> 1 <template>
2 <view class="content"> 2 <view class="content">
3 <block v-if="cartList.length==0"> 3 <block v-if="cartList.length==0">
4 4
5 </block> 5 </block>
6 <block v-else> 6 <block v-else>
7 <view class="card"> 7 <view class="card">
8 <view class="cardHeader"> 8 <view class="cardHeader">
9 <view 9 <view v-bind:class="pIsoPen? 'partentChecked' : 'partentCheck'" @click="pClick">
10 v-bind:class="pIsoPen? 'partentChecked' : 'partentCheck'" 10 <span class="correct"></span>
11 @click="pClick" 11 </view>
12 > 12 <image src="../../static/store.png" mode="aspectFill"></image>
13 <span class="correct"></span> 13 <text>非常戴镜</text>
14 </view> 14 </view>
15 <image 15 <view class="cardBody" v-for="(item,index) in cartList" :key="index"
16 src="../../static/store.png" 16 @longpress="delCart(item.cart_id,index)">
17 mode="aspectFill" 17 <view v-bind:class="cartList[index].isChecked? 'partentChecked':'partentCheck'"
18 ></image> 18 @click="childClick(cartList[index],index)">
19 <text>非常戴镜</text> 19 <span class="correct"></span>
20 </view> 20 </view>
21 <view 21 <view class="imageWrap">
22 class="cardBody" 22 <image :src="item.img" mode="aspectFit" style="width: 188rpx;height: 168rpx;"></image>
23 v-for="(item,index) in cartList" 23 </view>
24 :key="index" 24 <view class="goodInfo">
25 @longpress="delCart(item.cart_id,index)" 25 <!-- <view class="imageWrap">
26 > 26 <image :src="item.img_index_url" mode="aspectFit" style="width: 188rpx;height: 168rpx;"></image>
27 <view 27 </view> -->
28 v-bind:class="cartList[index].isChecked? 'partentChecked':'partentCheck'" 28 <view class="infoRight">
29 @click="childClick(cartList[index],index)" 29 <view class="goodName" @tap="toGoods(item.shop_wood_id, item.wsp_id)">{{item.wsp_sku_name}}</view>
30 > 30 <view class="describ"
31 <span class="correct"></span> 31 @click="showBottom(3, item.shop_wood_id, item.wsp_id, item.mp_id, item.cart_id, index)">
32 </view> 32 <view class="desL">
33 <view class="imageWrap"> 33 <view class="people">
34 <image 34 使用人:{{item.peopleName}}
35 :src="item.img_index_url" 35 </view>
36 mode="aspectFit" 36 <view class="skuInfo">
37 style="width: 188rpx;height: 168rpx;" 37 {{item.wsp_sku_name}}
38 ></image> 38 </view>
39 </view> 39 </view>
40 <view class="goodInfo"> 40 <view class="desR">
41 <!-- <view class="imageWrap"> 41 <image src="../../static/right.png" mode="aspectFit"
42 <image :src="item.img_index_url" mode="aspectFit" style="width: 188rpx;height: 168rpx;"></image> 42 style="width: 18rpx;height: 18rpx;"></image>
43 </view> --> 43 </view>
44 <view class="infoRight"> 44 </view>
45 <view 45 <view class="priceBox">
46 class="goodName" 46 <view class="price">¥{{item.price*item.num}}</view>
47 @tap="toGoods(item.pid,item.sk_id)" 47 <text class="maxCount">(限购{{maxCount}}副)</text>
48 >{{item.p_name}}</view> 48 <view class="counter">
49 <view 49 <view class="btn" disabled="this.addDisabled" type="default"
50 class="describ" 50 @tap="counter(index,false,item)">-</view>
51 @click="showBottom(3,item.pid,item.sk_id,item.mp_id,item.cart_id,index)" 51 <text>{{item.num}}</text>
52 > 52 <view class="btn" disabled="this.desDisabled" type="default"
53 <view class="desL"> 53 @tap="counter(index,true,item)">+</view>
54 <view class="people"> 54 </view>
55 使用人:{{item.peopleName}} 55 </view>
56 </view> 56 </view>
57 <view class="skuInfo"> 57 </view>
58 {{item.sku_name}} 58 </view>
59 </view> 59 </view>
60 </view> 60 </block>
61 <view class="desR"> 61 <view class="footer">
62 <image 62 <view class="footerLeft">实付金额:<text>¥{{totalPrice}}</text></view>
63 src="../../static/right.png" 63 <view class="footerRight">
64 mode="aspectFit" 64 <view class="paybtn" @click="toComfirmOrder">立即结算</view>
65 style="width: 18rpx;height: 18rpx;" 65 </view>
66 ></image> 66 </view>
67 </view> 67 <BottomSheet v-if="isShowBottom" :isCart="isCart" @addCart="addCart" :wsp_id="wsp_id" :propMpId="mp_id"
68 </view> 68 @chooseCartModi="chooseCartModi" :cart_id="cart_id" :index="cartIndex" :pid="pid" :goodInfo="goodInfo"
69 <view class="priceBox"> 69 :isShowBottom="isShowBottom" @closeBottom="closeBottom"></BottomSheet>
70 <view class="price">¥{{item.nowPrice*item.num}}</view> 70 </view>
71 <text class="maxCount">(限购{{maxCount}}副)</text> 71 </template>
72 <view class="counter"> 72
73 <view 73 <script>
74 class="btn" 74 import store from '@/store'
75 disabled="this.addDisabled" 75 import BottomSheet from '../../components/BottomSheet/BottomSheet.vue'
76 type="default" 76 export default {
77 @tap="counter(index,false,item)" 77 components: {
78 >-</view> 78 BottomSheet,
79 <text>{{item.num}}</text> 79 },
80 <view 80 data() {
81 class="btn" 81 return {
82 disabled="this.desDisabled" 82 pid: Number,
83 type="default" 83 isCart: Number,
84 @tap="counter(index,true,item)" 84 wsp_id: String,
85 >+</view> 85 mp_id: String,
86 </view> 86 isShowBottom: false, // 底部弹窗开关
87 </view> 87 cart_id: Number,
88 </view> 88 maxCount: 20,
89 </view> 89 cartIndex: Number,
90 </view> 90 cartList: [],
91 </view> 91 }
92 </block> 92 },
93 <view class="footer"> 93 computed: {
94 <view class="footerLeft">实付金额:<text>¥{{totalPrice}}</text></view> 94 pIsoPen() {
95 <view class="footerRight"> 95 if (this.cartList.length > 0) {
96 <view 96 const temp = !this.cartList.find(item => !item.isChecked)
97 class="paybtn" 97 // console.log('temptemp', temp)
98 @click="toComfirmOrder" 98 return temp
99 >立即结算</view> 99 }
100 </view> 100 return false
101 </view> 101 },
102 <BottomSheet 102 goodInfo() {
103 v-if="isShowBottom" 103 return this.$store.state.read.goodInfo
104 :isCart="isCart" 104 },
105 @addCart="addCart" 105 totalPrice() {
106 :sk_id="sk_id" 106 let totalPrice = 0
107 :propMpId="mp_id" 107 this.cartList.forEach((item) => {
108 @chooseCartModi="chooseCartModi" 108 if (item.isChecked) {
109 :cart_id="cart_id" 109 totalPrice += item.price * item.num
110 :index="cartIndex" 110 }
111 :pid="pid" 111 })
112 :goodInfo="goodInfo" 112 return totalPrice
113 :isShowBottom="isShowBottom" 113 },
114 @closeBottom="closeBottom" 114 },
115 ></BottomSheet> 115 onShow: async function() {
116 </view> 116 await this.$store.dispatch('cart/getCartList', {
117 </template> 117 uid: this.$store.state.user.userInfo.uid, // 用户id
118 118 })
119 <script> 119
120 120 this.cartList = this.$store.state.cart.cartList
121 import store from '@/store' 121 this.cartList.forEach((item) => {
122 import BottomSheet from '../../components/BottomSheet/BottomSheet.vue' 122 item.isChecked = false
123 export default { 123 })
124 components: { 124 },
125 BottomSheet, 125 // onLoad: async function() {
126 }, 126 // },
127 data() { 127 methods: {
128 return { 128 // 全选按钮
129 pid: Number, 129 pClick() {
130 isCart: Number, 130 const pStatus = !this.cartList.find(item => !item.isChecked)
131 sk_id: String, 131 const oldList = this.cartList
132 mp_id: String, 132 oldList.forEach((item, index) => {
133 isShowBottom: false, // 底部弹窗开关 133 item.isChecked = !pStatus
134 cart_id: Number, 134 this.cartList.splice(index, 1, item)
135 maxCount: 20, 135 })
136 cartIndex: Number, 136 },
137 cartList: [], 137 // 单选按钮
138 } 138 childClick(type, index) {
139 }, 139 this.cartList[index].isChecked = !this.cartList[index].isChecked
140 computed: { 140 // vue没有办法监听数组内部值的变化,所以需要通过这个方法去触发
141 pIsoPen () { 141 this.cartList.splice(index, 1, this.cartList[index])
142 if (this.cartList.length > 0) { 142 },
143 return !this.cartList.find(item => !item.isChecked) 143 // 修改购物车
144 } 144 chooseCartModi(mp_id, wsp_id, price, pid, num, cart_id, index) {
145 return false 145 // console.log('modi',mp_id,wsp_id,price,pid,num,cart_id)
146 }, 146 store.dispatch('cart/modiCart', {
147 goodInfo () { 147 uid: this.$store.state.user.userInfo.uid,
148 return this.$store.state.read.goodInfo 148 openid: this.$store.state.user.userInfo.openid,
149 }, 149 mp_id: mp_id,
150 totalPrice() { 150 wsp_id: wsp_id,
151 let totalPrice = 0 151 price: price,
152 this.cartList.forEach((item) => { 152 pid: pid,
153 if (item.isChecked) { 153 num: num,
154 totalPrice += item.nowPrice * item.num 154 cart_id: cart_id,
155 } 155 args: {
156 }) 156 index: index,
157 return totalPrice 157 },
158 }, 158 })
159 }, 159 this.$nextTick(function() {
160 onShow: async function() { 160 store.dispatch('cart/getCartList', {
161 await this.$store.dispatch('cart/getCartList', { 161 uid: this.$store.state.user.userInfo.uid, // 用户id
162 uid: this.$store.state.user.userInfo.uid, // 用户id 162 }).then(() => {
163 }) 163 this.cartList = this.$store.state.cart.cartList
164 164 })
165 this.cartList = this.$store.state.cart.cartList 165 })
166 this.cartList.forEach((item) => { 166 },
167 item.isChecked = false 167 // 底部弹窗开关
168 }) 168 showBottom(isCart, pid, skId, mp_id, cart_id, index) {
169 }, 169 store.dispatch('read/fetch', {
170 // onLoad: async function() { 170 // shop_wood_id:pid,
171 // }, 171 shop_wood_id:681,
172 methods: { 172 wsp_id: skId,
173 // 全选按钮 173 }).then(() => {
174 pClick() { 174 this.cartIndex = index
175 const pStatus = !this.cartList.find(item => !item.isChecked) 175 this.wsp_id = skId
176 const oldList = this.cartList 176 this.shop_wood_id = pid
177 oldList.forEach((item, index) => { 177 this.mp_id = mp_id
178 item.isChecked = !pStatus 178 this.isCart = isCart
179 this.cartList.splice(index, 1, item) 179 this.cart_id = cart_id
180 }) 180 this.isShowBottom = true
181 }, 181 })
182 // 单选按钮 182 },
183 childClick(type, index) { 183 closeBottom() {
184 this.cartList[index].isChecked = !this.cartList[index].isChecked 184 this.isShowBottom = false
185 // vue没有办法监听数组内部值的变化,所以需要通过这个方法去触发 185 },
186 this.cartList.splice(index, 1, this.cartList[index]) 186 toGoods(id, skId) {
187 }, 187 uni.navigateTo({
188 // 修改购物车 188 url: '../details/details?pid=' + id + '&wsp_id=' + skId,
189 chooseCartModi(mp_id, sk_id, price, pid, num, cart_id, index) { 189 success: res => {},
190 // console.log('modi',mp_id,sk_id,price,pid,num,cart_id) 190 fail: () => {},
191 store.dispatch('cart/modiCart', { 191 complete: () => {},
192 uid: this.$store.state.user.userInfo.uid, 192 })
193 openid: this.$store.state.user.userInfo.openid, 193 },
194 mp_id: mp_id, 194
195 sk_id: sk_id, 195 toComfirmOrder() {
196 price: price, 196 this.$store.state.cart.checkedCartLst = this.cartList.filter(item => item.isChecked)
197 pid: pid, 197 if (this.$store.state.cart.checkedCartLst.length > 0) {
198 num: num, 198 uni.navigateTo({
199 cart_id: cart_id, 199 url: '../confirmOrder/confirmOrder?isCart=true',
200 args: { 200 })
201 index: index, 201 } else {
202 }, 202 uni.showToast({
203 }) 203 title: '您还没有选择宝贝哦~',
204 this.$nextTick(function() { 204 icon: 'none',
205 store.dispatch('cart/getCartList', { 205 })
206 uid: this.$store.state.user.userInfo.uid, // 用户id 206 }
207 }).then(() => { 207 },
208 this.cartList = this.$store.state.cart.cartList 208 counter(index, isadd, item) {
209 }) 209 // console.log('item=====>', item)
210 }) 210 // console.log('num=====>', item.num)
211 }, 211 const nums = parseInt(item.num)
212 // 底部弹窗开关 212 if (isadd) {
213 showBottom(isCart, pid, skId, mp_id, cart_id, index) { 213 if (nums >= this.maxCount) {
214 store.dispatch('read/fetch', { 214 this.addDisabled = true
215 pid, 215 } else {
216 sk_id: skId, 216 this.addDisabled = true
217 }).then(() => { 217 store.dispatch('cart/modiCart', {
218 this.cartIndex = index 218 uid: this.$store.state.user.userInfo.uid,
219 this.sk_id = skId 219 openid: this.$store.state.user.userInfo.openid,
220 this.pid = pid 220 mp_id: item.mp_id,
221 this.mp_id = mp_id 221 wsp_id: item.wsp_id,
222 this.isCart = isCart 222 price: item.price,
223 this.cart_id = cart_id 223 pid: item.shop_wood_id,
224 this.isShowBottom = true 224 num: nums + 1,
225 }) 225 cart_id: item.cart_id,
226 }, 226 args: {
227 closeBottom() { 227 index: index,
228 this.isShowBottom = false 228 isadd: isadd,
229 }, 229 },
230 toGoods(id, skId) { 230 })
231 uni.navigateTo({ 231 this.addDisabled = false
232 url: '../details/details?pid=' + id + '&sk_id=' + skId, 232 }
233 success: res => {}, 233 } else {
234 fail: () => {}, 234 if (nums <= 1) {
235 complete: () => {}, 235 this.desDisabled = true
236 }) 236 } else {
237 }, 237 this.desDisabled = false
238 238
239 toComfirmOrder() { 239 store.dispatch('cart/modiCart', {
240 this.$store.state.cart.checkedCartLst = this.cartList.filter(item => item.isChecked) 240 uid: this.$store.state.user.userInfo.uid,
241 if (this.$store.state.cart.checkedCartLst.length > 0) { 241 openid: this.$store.state.user.userInfo.openid,
242 uni.navigateTo({ 242 mp_id: item.mp_id,
243 url: '../confirmOrder/confirmOrder?isCart=true', 243 wsp_id: item.wsp_id,
244 }) 244 price: item.price,
245 } else { 245 pid: item.shop_wood_id,
246 uni.showToast({ 246 num: nums - 1,
247 title: '您还没有选择宝贝哦~', 247 cart_id: item.cart_id,
248 icon: 'none', 248 args: {
249 }) 249 index: index,
250 } 250 isadd: isadd,
251 }, 251 },
252 counter(index, isadd, item) { 252 })
253 // console.log('item=====>', item) 253 this.desDisabled = true
254 // console.log('num=====>', item.num) 254 }
255 const nums = parseInt(item.num) 255 }
256 if (isadd) { 256 },
257 if (nums >= this.maxCount) { 257 delCart(cart_id, index) {
258 this.addDisabled = true 258 cart_id = parseInt(cart_id)
259 } else { 259 uni.showModal({
260 this.addDisabled = true 260 title: '是否删除该商品',
261 store.dispatch('cart/modiCart', { 261 success: function(res) {
262 uid: this.$store.state.user.userInfo.uid, 262 if (res.confirm) {
263 openid: this.$store.state.user.userInfo.openid, 263 store.dispatch('cart/delCart', {
264 mp_id: item.mp_id, 264 uid: this.$store.state.user.userInfo.uid,
265 sk_id: item.sk_id, 265 openid: this.$store.state.user.userInfo.openid,
266 price: item.nowPrice, 266 cart_id: cart_id, // 要修改的购物车id
267 pid: item.pid, 267 arg: index, // 由于action 传参是能接收两参数,因此将index放入对象
268 num: nums + 1, 268 })
269 cart_id: item.cart_id, 269 }
270 args: { 270 }.bind(this),
271 index: index, 271 })
272 isadd: isadd, 272 // this.cartList.splice(index,1)
273 }, 273 },
274 }) 274 },
275 this.addDisabled = false 275 }
276 } 276 </script>
277 } else { 277
278 if (nums <= 1) { 278 <style lang="scss">
279 this.desDisabled = true 279 .content {
280 } else { 280 min-height: 100vh;
281 this.desDisabled = false 281 background-color: #f2f2f2;
282 282 display: flex;
283 store.dispatch('cart/modiCart', { 283 flex-direction: column;
284 uid: this.$store.state.user.userInfo.uid, 284 align-items: center;
285 openid: this.$store.state.user.userInfo.openid, 285 justify-content: space-between;
286 mp_id: item.mp_id, 286 padding: 20rpx 40rpx;
287 sk_id: item.sk_id, 287 box-sizing: border-box;
288 price: item.nowPrice, 288
289 pid: item.pid, 289 .partentCheck {
290 num: nums - 1, 290 width: 16px;
291 cart_id: item.cart_id, 291 height: 16px;
292 args: { 292 border-radius: 22px;
293 index: index, 293 border: 1px solid #cfcfcf;
294 isadd: isadd, 294 background-color: #ffffff;
295 }, 295 margin: 24rpx 12rpx 24rpx 24rpx;
296 }) 296 }
297 this.desDisabled = true 297
298 } 298 .partentChecked {
299 } 299 width: 18px;
300 }, 300 height: 18px;
301 delCart(cart_id, index) { 301 border-radius: 22px;
302 cart_id = parseInt(cart_id) 302 background-color: #ff6b4a;
303 uni.showModal({ 303 margin: 24rpx 12rpx 24rpx 24rpx;
304 title: '是否删除该商品', 304
305 success: function (res) { 305 .correct {
306 if (res.confirm) { 306 display: inline-block;
307 store.dispatch('cart/delCart', { 307 position: relative;
308 uid: this.$store.state.user.userInfo.uid, 308 width: 10rpx;
309 openid: this.$store.state.user.userInfo.openid, 309 height: 2rpx;
310 cart_id: cart_id, // 要修改的购物车id 310 background: #ffffff;
311 arg: index, // 由于action 传参是能接收两参数,因此将index放入对象 311 line-height: 0;
312 }) 312 font-size: 0;
313 } 313 position: relative;
314 }.bind(this), 314 top: -7px;
315 }) 315 left: 4px;
316 // this.cartList.splice(index,1) 316 -webkit-transform: rotate(45deg);
317 }, 317 }
318 }, 318
319 } 319 .correct:after {
320 </script> 320 content: "/";
321 321 display: block;
322 <style lang="scss"> 322 width: 16rpx;
323 .content { 323 height: 2rpx;
324 min-height: 100vh; 324 background: #ffffff;
325 background-color: #f2f2f2; 325 -webkit-transform: rotate(-90deg) translateY(50%) translateX(50%);
326 display: flex; 326 }
327 flex-direction: column; 327 }
328 align-items: center; 328
329 justify-content: space-between; 329 .card {
330 padding: 20rpx 40rpx; 330 background-color: #ffffff;
331 box-sizing: border-box; 331 border-radius: 16rpx;
332 332 // border:1px #000 solid;
333 .partentCheck { 333 box-sizing: border-box;
334 width: 16px; 334 padding: 36rpx 36rpx 36rpx 18rpx;
335 height: 16px; 335 display: flex;
336 border-radius: 22px; 336 flex-direction: column;
337 border: 1px solid #cfcfcf; 337 align-items: center;
338 background-color: #ffffff; 338 justify-content: space-between;
339 margin: 24rpx 12rpx 24rpx 24rpx; 339 margin-bottom: 180rpx;
340 } 340
341 .partentChecked { 341 .cardHeader {
342 width: 18px; 342 width: 100%;
343 height: 18px; 343 height: 36rpx;
344 border-radius: 22px; 344 display: flex;
345 background-color: #ff6b4a; 345 align-items: center;
346 margin: 24rpx 12rpx 24rpx 24rpx; 346 justify-content: flex-start;
347 .correct { 347 margin-bottom: 20rpx;
348 display: inline-block; 348
349 position: relative; 349 image {
350 width: 10rpx; 350 height: 32rpx;
351 height: 2rpx; 351 width: 32rpx;
352 background: #ffffff; 352 padding-left: 6px;
353 line-height: 0; 353 padding-right: 10px;
354 font-size: 0; 354 }
355 position: relative; 355
356 top: -7px; 356 text {
357 left: 4px; 357 // font-family: PingFangSC-Regular;
358 -webkit-transform: rotate(45deg); 358 font-size: 14px;
359 } 359 color: #333333;
360 .correct:after { 360 letter-spacing: -0.26px;
361 content: "/"; 361 }
362 display: block; 362 }
363 width: 16rpx; 363
364 height: 2rpx; 364 .cardBody {
365 background: #ffffff; 365 width: 100%;
366 -webkit-transform: rotate(-90deg) translateY(50%) translateX(50%); 366 // border:1px #000 solid;
367 } 367 min-height: 300rpx;
368 } 368 display: flex;
369 369 align-items: center;
370 .card { 370 justify-content: space-between;
371 background-color: #ffffff; 371
372 border-radius: 16rpx; 372 .goodInfo {
373 box-sizing: border-box; 373 width: 390rpx;
374 padding: 36rpx 36rpx 36rpx 18rpx; 374 display: flex;
375 display: flex; 375 flex-direction: row;
376 flex-direction: column; 376 justify-content: flex-start;
377 align-items: center; 377 padding-left: 6px;
378 justify-content: space-between; 378
379 margin-bottom: 180rpx; 379 .imageWrap {
380 .cardHeader { 380 height: 188rpx;
381 width: 100%; 381 width: 188rpx;
382 height: 36rpx; 382 margin-right: 28rpx;
383 display: flex; 383
384 align-items: center; 384 image {
385 justify-content: flex-start; 385 border-radius: 4px;
386 margin-bottom: 20rpx; 386 height: 188rpx;
387 image { 387 width: 188rpx;
388 height: 32rpx; 388 }
389 width: 32rpx; 389 }
390 padding-left: 6px; 390
391 padding-right: 10px; 391 .infoRight {
392 } 392 display: flex;
393 text { 393 flex-direction: column;
394 // font-family: PingFangSC-Regular; 394 align-items: flex-start;
395 font-size: 14px; 395 justify-content: space-between;
396 color: #333333; 396 min-height: 240rpx;
397 letter-spacing: -0.26px; 397 width: 100%;
398 } 398
399 } 399 .goodName {
400 .cardBody { 400 display: -webkit-box;
401 width: 100%; 401 -webkit-box-orient: vertical;
402 min-height: 300rpx; 402 -webkit-line-clamp: 2;
403 display: flex; 403 text-align: justify;
404 align-items: center; 404 overflow: hidden;
405 justify-content: space-between; 405 font-size: 28rpx;
406 .goodInfo { 406 color: #333333;
407 width: 390rpx; 407 }
408 display: flex; 408
409 flex-direction: row; 409 .describ {
410 justify-content: flex-start; 410 width: 100%;
411 padding-left: 6px; 411 min-height: 80rpx;
412 412 background: #f9f9f9;
413 .imageWrap { 413 border-radius: 2px;
414 height: 188rpx; 414 box-sizing: border-box;
415 width: 188rpx; 415 padding: 10rpx;
416 margin-right: 28rpx; 416 font-size: 20rpx;
417 417 letter-spacing: -0.23px;
418 image { 418 color: #999999;
419 border-radius: 4px; 419 display: flex;
420 height: 188rpx; 420 justify-content: space-between;
421 width: 188rpx; 421 align-items: center;
422 } 422
423 } 423 .desL {
424 .infoRight { 424 view {
425 display: flex; 425 margin: 10rpx 0 10rpx 0;
426 flex-direction: column; 426 }
427 align-items: flex-start; 427 }
428 justify-content: space-between; 428 }
429 min-height: 240rpx; 429
430 width: 100%; 430 .priceBox {
431 .goodName { 431 display: flex;
432 display: -webkit-box; 432 justify-content: space-between;
433 -webkit-box-orient: vertical; 433 align-items: center;
434 -webkit-line-clamp: 2; 434 // margin-top: 26px;
435 text-align: justify; 435 width: 100%;
436 overflow: hidden; 436 font-size: 14px;
437 font-size: 28rpx; 437 color: #999999;
438 color: #333333; 438
439 } 439 .maxCount {
440 .describ { 440 color: #999999;
441 width: 100%; 441 font-size: 20rpx;
442 min-height: 80rpx; 442 }
443 background: #f9f9f9; 443
444 border-radius: 2px; 444 .price {
445 box-sizing: border-box; 445 color: #ff6b4a;
446 padding: 10rpx; 446 font-size: 28rpx;
447 font-size: 20rpx; 447 }
448 letter-spacing: -0.23px; 448
449 color: #999999; 449 .counter {
450 display: flex; 450 display: flex;
451 justify-content: space-between; 451 flex-direction: row;
452 align-items: center; 452 justify-content: space-between;
453 .desL { 453 align-items: center;
454 view { 454 font-size: 28rpx;
455 margin: 10rpx 0 10rpx 0; 455 color: #333333;
456 } 456 width: 122rpx;
457 } 457
458 } 458 .btn {
459 .priceBox { 459 display: flex;
460 display: flex; 460 justify-content: center;
461 justify-content: space-between; 461 line-height: 32rpx;
462 align-items: center; 462 height: 32rpx;
463 // margin-top: 26px; 463 width: 32rpx;
464 width: 100%; 464 background-color: #f2f2f2;
465 font-size: 14px; 465 color: #cfcfcf;
466 color: #999999; 466 }
467 .maxCount { 467 }
468 color: #999999; 468 }
469 font-size: 20rpx; 469 }
470 } 470 }
471 .price { 471 }
472 color: #ff6b4a; 472 }
473 font-size: 28rpx; 473
474 } 474 .footer {
475 .counter { 475 position: fixed;
476 display: flex; 476 left: 0;
477 flex-direction: row; 477 bottom: 90rpx;
478 justify-content: space-between; 478 height: 112rpx;
479 align-items: center; 479 width: 100%;
480 font-size: 28rpx; 480 // border:1px #000 solid;
481 color: #333333; 481 background-color: #FFF;
482 width: 122rpx; 482 font-size: 16px;
483 .btn { 483 display: flex;
484 display: flex; 484 justify-content: space-between;
485 justify-content: center; 485 align-items: center;
486 line-height: 32rpx; 486
487 height: 32rpx; 487 .footerLeft {
488 width: 32rpx; 488 display: flex;
489 background-color: #f2f2f2; 489 justify-content: center;
490 color: #cfcfcf; 490 align-items: center;
491 } 491 width: 50%;
492 } 492 color: #333333;
493 } 493
494 } 494 text {
495 } 495 color: #ff6b4a;
496 } 496 }
497 } 497 }
498 .footer { 498
499 position: fixed; 499 .footerRight {
500 left: 0; 500 display: flex;
501 bottom: 0px; 501 justify-content: flex-end;
502 height: 112rpx; 502 align-items: center;
503 width: 100%; 503 width: 50%;
504 background-color: #ffffff; 504 margin-right: 26rpx;
505 font-size: 16px; 505
506 display: flex; 506 .paybtn {
507 justify-content: space-between; 507 display: flex;
508 align-items: center; 508 justify-content: center;
509 .footerLeft { 509 align-items: center;
510 display: flex; 510 background: #ff6b4a;
511 justify-content: center; 511 border-radius: 20px;
512 align-items: center; 512 border-radius: 20px;
513 width: 50%; 513 color: #ffffff;
514 color: #333333; 514 width: 204rpx;
515 text { 515 height: 80rpx;
516 color: #ff6b4a; 516 }
517 } 517 }
518 } 518 }
519 .footerRight { 519 }
520 display: flex; 520
521 justify-content: flex-end; 521 /* 隐藏滚动条 */
522 align-items: center; 522 ::-webkit-scrollbar {
523 width: 50%; 523 width: 0;
524 margin-right: 26rpx; 524 height: 0;
525 .paybtn { 525 color: transparent;
526 display: flex; 526 }
527 justify-content: center;
528 align-items: center;
529 background: #ff6b4a;
530 border-radius: 20px;
531 border-radius: 20px;
532 color: #ffffff;
533 width: 204rpx;
534 height: 80rpx;
535 }
536 }
537 }
538 }
539 /* 隐藏滚动条 */
540 ::-webkit-scrollbar {
541 width: 0;
542 height: 0;
543 color: transparent;
544 }
545 </style> 527 </style>
546 528
src/pages/confirmOrder/confirmOrder.vue
1 <template> 1 <template>
2 <view class="wrap"> 2 <view class="wrap">
3 <view></view> 3 <view></view>
4 <view 4 <view class="addAddress" @tap="toaddAddress" v-if="this.showAddress">
5 class="addAddress" 5 <view class="addIcon">
6 @tap="toaddAddress" 6 <image src="../../static/add.png" mode="aspectFill"></image>
7 v-if="this.showAddress" 7 </view>
8 > 8 <view class="addressText">{{addAddress}}</view>
9 <view class="addIcon"> 9 <image src="../../static/right.png" mode="aspectFill"></image>
10 <image 10 </view>
11 src="../../static/add.png" 11 <view v-else @tap="toaddAddress" class="list order-user">
12 mode="aspectFill" 12 <view class="order-user-head">
13 ></image> 13 <view class="name">
14 </view> 14 <view v-if="addressInfo.is_default ===1" class="default"><text>默认</text></view>{{addressInfo.name}}
15 <view class="addressText">{{addAddress}}</view> 15 </view>
16 <image 16 <text class="mobile">{{addressInfo.mobile}}</text>
17 src="../../static/right.png" 17 </view>
18 mode="aspectFill" 18 <view class="order-user-body">
19 ></image> 19 <image src="../../static/myorder-paying-location.png"></image>
20 </view> 20 <text class="address">{{addressInfo.address}}\n{{addressInfo.add_detail}}</text>
21 <view 21 </view>
22 v-else 22 <image class="arrow" src="../../static/right.png" mode="aspectFill"></image>
23 @tap="toaddAddress" 23 </view>
24 class="list order-user" 24 <view class="content">
25 > 25 <view class="orderInfo">
26 <view class="order-user-head"> 26 <view class="title">
27 <view class="name"> 27 <image src="../../static/store.png" mode="aspectFill" style="width: 40rpx;height: 40rpx;"></image>
28 <view 28 <text>非常戴镜</text>
29 v-if="addressInfo.default === '1'" 29 </view>
30 class="default"
31 ><text>默认</text></view>{{addressInfo.name}}
32 </view>
33 <text class="mobile">{{addressInfo.mobile}}</text>
34 </view>
35 <view class="order-user-body">
36 <image src="../../static/myorder-paying-location.png"></image>
37 <text class="address">{{addressInfo.address}}\n{{addressInfo.add_detail}}</text>
38 </view>
39 <image
40 class="arrow"
41 src="../../static/right.png"
42 mode="aspectFill"
43 ></image>
44 </view>
45 <view class="content">
46 <view class="orderInfo">
47 <view class="title">
48 <image
49 src="../../static/store.png"
50 mode="aspectFill"
51 style="width: 40rpx;height: 40rpx;"
52 ></image>
53 <text>非常戴镜</text>
54 </view>
55
56 <view
57 class="infoBox"
58 v-if="isCart == 'true'"
59 v-for="(item, index) in checkedCartLst"
60 :key="index"
61 >
62 <view class="infoTop">
63 <image
64 :src="item.img_index_url"
65 mode="aspectFill"
66 ></image>
67 <view class="infoRight">
68 <text class="goodName">{{item.p_name}}</text>
69 <text class="remarks">支持7天无理由退货 顺丰发货</text>
70 <view class="priceBox">
71 <view class="price">¥{{Number(item.nowPrice) * item.num}}<text class="originCost">
72 ¥{{item.oldPrice*item.num}}
73 </text></view>
74 <view class="counter">
75 <view
76 class="btn"
77 disabled="this.disabled"
78 type="default"
79 @click="counter(false,index)"
80 >-</view>
81 <text>{{checkedCartLst[index].num}}</text>
82 <view
83 class="btn"
84 type="default"
85 @click="counter(true,index)"
86 >+</view>
87 </view>
88 </view>
89 </view>
90 </view>
91 <view class="infoBottom">
92 <view class="norm">规格 <text>
93 <!-- 长度超出变省略号未做 -->
94 <block>{{item.sku_name}}<block v-if="index !== current.length -1">/</block>
95 </block>
96 </text></view>
97 <view class="shippingMethod">使用人 <text>
98 {{item.peopleName}}
99 </text></view>
100 <view class="shippingMethod">配送方式 <text>快递</text></view>
101 <view class="message">买家留言
102 <input
103 type="text"
104 :value="note"
105 placeholder="建议提前协商(50字以内)"
106 />
107 </view>
108 </view>
109 </view>
110 30
111 <view 31 <view class="infoBox" v-if="isCart == 'true'" v-for="(item, index) in checkedCartLst" :key="index">
112 class="infoBox" 32 <view class="infoTop">
113 v-if="isCart !== 'true'" 33 <image :src="item.img_index_url" mode="aspectFill"></image>
114 > 34 <view class="infoRight">
115 <view class="infoTop"> 35 <text class="goodName">{{item.wsp_sku_name}}</text>
116 <image 36 <text class="remarks">支持7天无理由退货 顺丰发货</text>
117 :src="buyItem.pic" 37 <view class="priceBox">
118 mode="aspectFill" 38 <view class="price">¥{{Number(item.price) * item.num}}<text class="originCost">
119 ></image> 39 ¥{{item.price*item.num}}
120 <view class="infoRight"> 40 </text></view>
121 <text class="goodName">{{goodInfo.p_name}}</text> 41 <view class="counter">
122 <text class="remarks">支持7天无理由退货 顺丰发货</text> 42 <view class="btn" disabled="this.disabled" type="default"
123 <view class="priceBox"> 43 @click="counter(false,index)">-</view>
124 <view class="price">¥{{buyItem.real_price * count}}<text class="originCost"> 44 <text>{{checkedCartLst[index].num}}</text>
125 ¥{{buyItem.out_price * count}} 45 <view class="btn" type="default" @click="counter(true,index)">+</view>
126 </text></view> 46 </view>
127 <view class="counter"> 47 </view>
128 <view 48 </view>
129 class="btn" 49 </view>
130 disabled="this.disabled" 50 <view class="infoBottom">
131 type="default" 51 <view class="norm">规格 <text>
132 @click="counter(false)" 52 <!-- 长度超出变省略号未做 -->
133 >-</view> 53 <!-- <block>{{item.wsp_sku_name}}
134 <text>{{count}}</text> 54 <block v-if="index !== current.length -1">/</block>
135 <view 55 </block> -->
136 class="btn" 56 </text></view>
137 type="default" 57 <view class="shippingMethod">使用人 <text>
138 @click="counter(true)" 58 {{item.peopleName}}
139 >+</view> 59 </text></view>
140 </view> 60 <view class="shippingMethod">配送方式 <text>快递</text></view>
141 </view> 61 <view class="message">买家留言
142 </view> 62 <input type="text" :value="note" placeholder="建议提前协商(50字以内)" />
143 </view> 63 </view>
144 <view class="infoBottom"> 64 </view>
145 <view class="norm">规格 <text> 65 </view>
146 <!-- 长度超出变省略号未做 --> 66
147 <block 67 <view class="infoBox" v-if="isCart !== 'true'">
148 v-for="(item, index) in current" 68 <view class="infoTop">
149 :key="index" 69 <image :src="buyItem.pic" mode="aspectFill"></image>
150 >{{attrList[index].attr[item].name}}<block v-if="index !== current.length -1">/</block> 70 <view class="infoRight">
151 </block> 71 <text class="goodName">{{goodInfo.p_name}}</text>
152 </text></view> 72 <text class="remarks">支持7天无理由退货 顺丰发货</text>
153 <view class="shippingMethod">使用人 <text> 73 <view class="priceBox">
154 {{name}} 74 <view class="price">¥{{buyItem.real_price * count}}<text class="originCost">
155 </text></view> 75 ¥{{buyItem.out_price * count}}
156 <view class="shippingMethod">配送方式 <text>快递</text></view> 76 </text></view>
157 <view class="message">买家留言 77 <view class="counter">
158 <input 78 <view class="btn" disabled="this.disabled" type="default" @click="counter(false)">-
159 type="text" 79 </view>
160 :value="note" 80 <text>{{count}}</text>
161 placeholder="建议提前协商(50字以内)" 81 <view class="btn" type="default" @click="counter(true)">+</view>
162 /> 82 </view>
163 </view> 83 </view>
164 </view> 84 </view>
165 </view> 85 </view>
166 </view> 86 <view class="infoBottom">
167 <view class="payWay"> 87 <view class="norm">规格 <text>
168 <view class="item"> 88 <!-- 长度超出变省略号未做 -->
169 <text>支付方式</text> 89 <!-- <block v-for="(item, index) in current" :key="index">{{attrList[index].attr[item].name}}
170 <view class="itemRight"> 90 <block v-if="index !== current.length -1">/</block>
171 <view class="rightText"> 91 </block> -->
172 <view class="choosePayWay"> 92 </text></view>
173 <image 93 <view class="shippingMethod">使用人 <text>
174 src="../../static/chat_logo.png" 94 {{name}}
175 mode="aspectFill" 95 </text></view>
176 ></image> 96 <view class="shippingMethod">配送方式 <text>快递</text></view>
177 <text>微信支付</text> 97 <view class="message">买家留言
178 </view> 98 <input type="text" :value="note" placeholder="建议提前协商(50字以内)" />
179 <!-- <view class="randomSubstraction">最高随机立减¥99</view> --> 99 </view>
180 </view> 100 </view>
181 <!-- <image 101 </view>
102 </view>
103 <view class="payWay">
104 <view class="item">
105 <text>支付方式</text>
106 <view class="itemRight">
107 <view class="rightText">
108 <view class="choosePayWay">
109 <image src="../../static/chat_logo.png" mode="aspectFill"></image>
110 <text>微信支付</text>
111 </view>
112 <view class="randomSubstraction">最高随机立减¥99</view>
113 </view>
114 <!-- <image
182 src="../../static/right.png" 115 src="../../static/right.png"
183 mode="aspectFill" 116 mode="aspectFill"
184 ></image> --> 117 ></image> -->
185 </view> 118 </view>
186 </view> 119 </view>
187 <!-- <view class="item"> 120 <!-- <view class="item">
188 <text>优惠券</text> 121 <text>优惠券</text>
189 <view class="itemRight"> 122 <view class="itemRight">
190 <view class="rightText"> 123 <view class="rightText">
191 <view class="chooseOffers"> 124 <view class="chooseOffers">
192 <text>-¥70.00</text> 125 <text>-¥70.00</text>
193 </view> 126 </view>
194 <view class="preferentialWay">最大优惠</view> 127 <view class="preferentialWay">最大优惠</view>
195 </view> 128 </view>
196 <image 129 <image
197 src="../../static/right.png" 130 src="../../static/right.png"
198 mode="aspectFill" 131 mode="aspectFill"
199 ></image> 132 ></image>
200 </view> 133 </view>
201 </view> --> 134 </view> -->
202 <view class="item"> 135 <view class="item">
203 <text>运费</text> 136 <text>运费</text>
204 <view class="itemRight"> 137 <view class="itemRight">
205 <view class="freight">免运费</view> 138 <view class="freight">免运费</view>
206 </view> 139 </view>
207 </view> 140 </view>
208 <view class="item"> 141 <view class="item">
209 <text>合计</text> 142 <text>合计</text>
210 <view class="itemRight"> 143 <view class="itemRight">
211 <view class="total">¥{{totalPrice}}</view> 144 <view class="total">¥{{totalPrice}}</view>
212 <!-- <view class="total" v-else>¥{{Number(skuInfo.real_price) * count}}</view> --> 145 <!-- <view class="total" v-else>¥{{Number(skuInfo.real_price) * count}}</view> -->
213 </view> 146 </view>
214 </view> 147 </view>
215 </view> 148 </view>
216 <!-- 149 <!--
217 <view class="checkBox"> 150 <view class="checkBox">
218 <checkbox-group> 151 <checkbox-group>
219 <label> 152 <label>
220 <checkbox color="#FF6B4A" value="isAnonymous" checked="true" />匿名购买 153 <checkbox color="#FF6B4A" value="isAnonymous" checked="true" />匿名购买
221 </label> 154 </label>
222 </checkbox-group> 155 </checkbox-group>
223 </view> --> 156 </view> -->
224 </view> 157 </view>
225 <view class="last_zhanwei"></view> 158 <view class="last_zhanwei"></view>
226 <view class="footer"> 159 <view class="footer">
227 <view class="footerLeft">实付金额: 160 <view class="footerLeft">实付金额:
228 <text>¥{{totalPrice}}</text> 161 <text>¥{{totalPrice}}</text>
229 <!-- <text v-else>¥{{Number(skuInfo.real_price) * count}}</text> --> 162 <!-- <text v-else>¥{{Number(skuInfo.real_price) * count}}</text> -->
230 </view> 163 </view>
231 <view class="footerRight"> 164 <view class="footerRight">
232 <view 165 <view class="paybtn" @tap="orderBuild">立即支付</view>
233 class="paybtn" 166 </view>
234 @tap="orderBuild" 167 </view>
235 >立即支付</view> 168 </view>
236 </view>
237 </view>
238 </view>
239 </template> 169 </template>
240 170
241 <script> 171 <script>
242 import store from '@/store' 172 import store from '@/store'
243 import MD5Util from '../../utils/md5' 173 import MD5Util from '../../utils/md5'
244 174
245 export default { 175 export default {
246 data() { 176 data() {
247 return { 177 return {
248 name: String, 178 name: String,
249 addAddress: '添加收货地址', 179 addAddress: '添加收货地址',
250 count: 1, 180 count: 1,
251 pid: 0, 181 pid: 0,
252 disabled: false, 182 disabled: false,
253 freight: 0.0, 183 freight: 0.0,
254 showAddress: false, 184 showAddress: false,
255 note: '', 185 note: '',
256 addressInfo: { 186 addressInfo: {
257 address: '', 187 address: '',
258 }, 188 },
259 isCart: Boolean, 189 isCart: Boolean,
260 // isAnonymous: 190 // isAnonymous:
261 checkedCartLst: [], 191 checkedCartLst: [],
262 } 192 }
263 }, 193 },
264 onShow(addressId) { 194 onShow(addressId) {
265 // console.log('+-+-*-*-+-+',addressId) 195 console.log('>>>>>>>>>>>>>>>>>addressId>>>>>>>>>>>>>>>', addressId)
266 if (addressId) { 196 if (addressId) {
267 store 197 store
268 .dispatch('address/details', { 198 .dispatch('address/details', {
269 add_id: addressId, 199 add_id: addressId,
270 }) 200 })
271 .then(({ code, data }) => { 201 .then(({
272 if (code === 1) { 202 code,
273 // console.log('code', code, data) 203 data
274 this.showAddress = true 204 }) => {
275 this.addressInfo = data 205 if (code === 1) {
276 } 206 // console.log('code', code, data)
277 }) 207 this.showAddress = true
278 } 208 this.addressInfo = data
279 }, 209 }
280 onLoad({ pid, addressId, isCart, count, name }) { 210 })
281 if (isCart == 'false') { 211 }
282 this.pid = pid 212 },
283 // store.dispatch('read/fetch', { 213 onLoad({
284 // pid, 214 pid,
285 // }) 215 addressId,
286 } 216 isCart,
287 this.count = count 217 count,
288 this.name = name 218 name
289 this.isCart = isCart 219 }) {
290 220 console.log('>>>>>>confrm order ------>pid', pid);
291 console.log('++++++++++++' + pid, addressId, isCart) 221 console.log('>>>>>>confrm order ------>addressId', addressId);
292 this.checkedCartLst = this.$store.state.cart.checkedCartLst 222 console.log('>>>>>>confrm order ------>name', name);
293 // console.log('++++++++++6666666666++',this.$store.state.cart.checkedCartLst) 223 if (isCart == 'false') {
294 // 若已经选择地址 224 this.pid = pid
295 if (addressId) { 225 // store.dispatch('read/fetch', {
296 store 226 // pid,
297 .dispatch('address/details', { 227 // })
298 add_id: addressId, 228 }
299 }) 229 this.count = count
300 .then(({ code, data }) => { 230 this.name = name
301 if (code === 1) { 231 this.isCart = isCart
302 // console.log('code', code, data) 232
303 this.showAddress = true 233 console.log('++++++++++++' + pid, addressId, isCart)
304 this.addressInfo = data 234 this.checkedCartLst = this.$store.state.cart.checkedCartLst
305 } 235 console.log('++++++++++6666666666++', this.$store.state.cart.checkedCartLst)
306 }) 236 // 若已经选择地址
307 } else { 237 if (addressId) {
308 store.dispatch('address/default').then(({ code, data }) => { 238 store
309 if (code === 1) { 239 .dispatch('address/details', {
310 // console.log('code', code, data) 240 add_id: addressId,
311 this.showAddress = true 241 })
312 this.addressInfo = data 242 .then(({
313 } 243 code,
314 }) 244 data
315 } 245 }) => {
316 }, 246 if (code === 1) {
317 computed: { 247 // console.log('code', code, data)
318 totalPrice() { 248 this.showAddress = true
319 if (this.isCart == 'true') { 249 this.addressInfo = data
320 let total = 0 250 }
321 this.$store.state.cart.checkedCartLst.map(item => { 251 })
322 total += item.nowPrice * item.num 252 } else {
323 }) 253 store.dispatch('address/default', {
324 return total 254 uid: 1,
325 } else { 255 add_id: ""
326 return this.buyItem.real_price * this.count 256 }).then(({
327 } 257 code,
328 }, 258 data
329 buyItem() { 259 }) => {
330 return this.$store.state.cart.buyItem 260 if (code === 1) {
331 }, 261 console.log('address/defaultaddress/defaultaddress/defaultcode', code, data)
332 // checkedCartLst(){ 262 this.showAddress = true
333 // console.log('checkedCartLst',this.$store.state.cart.checkedCartLst) 263 this.addressInfo = data
334 // return this.$store.state.cart.checkedCartLst 264 }
335 // }, 265 })
336 goodInfo() { 266 }
337 // console.log('state', this.$store.state.read.goodInfo) 267 },
338 return this.$store.state.read.goodInfo 268 computed: {
339 }, 269 totalPrice() {
340 skuInfo() { 270 if (this.isCart == 'true') {
341 return this.$store.state.order.param.sk_id_arr 271 let total = 0
342 }, 272 this.$store.state.cart.checkedCartLst.map(item => {
343 attrList() { 273 total += item.price * item.num
344 return this.$store.state.order.param.attrList 274 })
345 }, 275 return total
346 current() { 276 } else {
347 return this.$store.state.order.param.current 277 return this.buyItem.real_price * this.count
348 }, 278 }
349 }, 279 },
350 methods: { 280 buyItem() {
351 counter(isadd, index) { 281 return this.$store.state.cart.buyItem
352 if (isadd) { 282 },
353 if (this.isCart == 'true') { 283 // checkedCartLst(){
354 this.checkedCartLst[index].num++ 284 // console.log('checkedCartLst',this.$store.state.cart.checkedCartLst)
355 } else { 285 // return this.$store.state.cart.checkedCartLst
356 this.count++ 286 // },
357 } 287 goodInfo() {
358 } else { 288 // console.log('state', this.$store.state.read.goodInfo)
359 if (this.isCart == 'true') { 289 return this.$store.state.read.goodInfo
360 this.checkedCartLst[index].num <= 1 ? (this.disabled = true) : this.checkedCartLst[index].num-- 290 },
361 } else { 291 skuInfo() {
362 this.count <= 1 ? (this.disabled = true) : this.count-- 292 return this.$store.state.order.param.sk_id_arr
363 } 293 },
364 } 294 attrList() {
365 }, 295 return this.$store.state.order.param.attrList
366 // 跳转添加地址页面 296 },
367 toaddAddress() { 297 current() {
368 uni.navigateTo({ 298 return this.$store.state.order.param.current
369 url: `../address/addressList?edit=${1}`, 299 },
370 success: res => {}, 300 },
371 fail: error => { 301 methods: {
372 console.log('跳转到地址列表页面失败====>', error) 302 counter(isadd, index) {
373 }, 303 if (isadd) {
374 complete: () => {}, 304 if (this.isCart == 'true') {
375 }) 305 this.checkedCartLst[index].num++
376 }, 306 } else {
377 // 下单 307 this.count++
378 orderBuild() { 308 }
379 uni.showLoading({ 309 } else {
380 title: '支付中', 310 if (this.isCart == 'true') {
381 }) 311 this.checkedCartLst[index].num <= 1 ? (this.disabled = true) : this.checkedCartLst[index].num--
382 if (this.isCart === 'true') { 312 } else {
383 const checkedGoods = [] 313 this.count <= 1 ? (this.disabled = true) : this.count--
384 const sk_id_arr = [] 314 }
385 this.checkedCartLst.map(item => { 315 }
386 checkedGoods.push(item.cart_id) 316 },
387 sk_id_arr.push(item.sk_id) 317 // 跳转添加地址页面
388 }) 318 toaddAddress() {
389 store.dispatch('order/build', { 319 uni.navigateTo({
390 uid: this.$store.state.user.userInfo.uid, 320 url: `../address/addressList?edit=${1}`,
391 address: JSON.stringify(this.addressInfo), 321 success: res => {},
392 checkedGoods: checkedGoods, 322 fail: error => {
393 sk_id_arr: sk_id_arr, 323 console.log('跳转到地址列表页面失败====>', error)
394 totalPrice: this.totalPrice, 324 },
395 }).then((res) => { 325 complete: () => {},
396 this.pay(res) 326 })
397 }) 327 },
398 } 328 // 下单
399 if (this.isCart === 'false') { 329 orderBuild() {
400 const { sk_id_arr: skId, mp_id: mpId } = this.$store.state.order.param 330 uni.showLoading({
401 store.dispatch('order/buyNow', { 331 title: '支付中',
402 pid: skId.pid, 332 })
403 sk_id: skId.sk_id, 333 if (this.isCart === 'true') {
404 number: this.count, 334 const checkedGoods = []
405 mp_id: mpId, 335 const sk_id_arr = []
406 address: JSON.stringify(this.addressInfo), 336 this.checkedCartLst.map(item => {
407 totalPrice: this.totalPrice, 337 checkedGoods.push(item.cart_id)
408 liuyan: this.note, 338 sk_id_arr.push(item.sk_id)
409 dir: 1, 339 })
410 }).then((res) => { 340 store.dispatch('order/build', {
411 this.pay(res) 341 uid: this.$store.state.user.userInfo.uid,
412 }) 342 address: JSON.stringify(this.addressInfo),
413 } 343 checkedGoods: checkedGoods,
414 }, 344 sk_id_arr: sk_id_arr,
415 // 支付 345 totalPrice: this.totalPrice,
416 pay(res) { 346 }).then((res) => {
417 console.log('pay', res) 347 this.pay(res)
418 const { data, exKeyName: keyName } = res 348 })
419 const uid = uni.getStorageSync('uid') 349 }
420 const timeStamp = new Date().getTime().toString() 350 if (this.isCart === 'false') {
421 const nonceStr = 'asfafasfasfasfasf' 351 const {
422 // 支付参数 352 sk_id_arr: skId,
423 const fieldSet = { 353 mp_id: mpId
424 openid: this.$store.state.user.userInfo.openid, 354 } = this.$store.state.order.param
425 uid: this.$store.state.user.userInfo.uid, 355 store.dispatch('order/buyNow', {
426 shopid: 0, 356 pid: skId.pid,
427 payCate: 2020, 357 sk_id: skId.sk_id,
428 payMoney: this.totalPrice, 358 number: this.count,
429 payWoodId: `fcdj-${uid}-${keyName}`, 359 mp_id: mpId,
430 payWoodDesc: '在【非常戴镜】的微信付款凭证', 360 address: JSON.stringify(this.addressInfo),
431 nonceStr, 361 totalPrice: this.totalPrice,
432 signType: 'MD5', 362 liuyan: this.note,
433 app_uid: 2020, 363 dir: 1,
434 timeStamp, 364 }).then((res) => {
435 keyname: keyName, 365 this.pay(res)
436 billInfo: JSON.stringify(data), 366 })
437 } 367 }
438 // 请求后台支付接口 368 },
439 store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { 369 // 支付
440 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { 370 pay(res) {
441 const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` 371 console.log('pay', res)
442 const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' 372 const {
443 373 data,
444 // 微信支付接口 374 exKeyName: keyName
445 uni.requestPayment({ 375 } = res
446 appId: data.appid, 376 const uid = uni.getStorageSync('uid')
447 timeStamp, 377 const timeStamp = new Date().getTime().toString()
448 nonceStr, 378 const nonceStr = 'asfafasfasfasfasf'
449 total_fee: this.totalPrice, 379 // 支付参数
450 package: `prepay_id=${data.prepay_id}`, 380 const fieldSet = {
451 signType: 'MD5', 381 openid: this.$store.state.user.userInfo.openid,
452 paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), 382 uid: this.$store.state.user.userInfo.uid,
453 success: (res) => { 383 shopid: 0,
454 // 支付成功 384 payCate: 2020,
455 uni.showModal({ 385 payMoney: this.totalPrice,
456 content: '支付成功', 386 payWoodId: `fcdj-${uid}-${keyName}`,
457 showCancel: false, 387 payWoodDesc: '在【非常戴镜】的微信付款凭证',
458 }) 388 nonceStr,
459 // 跳转订单详情页->状态 待收货 389 signType: 'MD5',
460 uni.reLaunch({ 390 app_uid: 2020,
461 url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`, 391 timeStamp,
462 }) 392 keyname: keyName,
463 }, 393 billInfo: JSON.stringify(data),
464 fail: (res) => { 394 }
465 // 支付失败 395 // 请求后台支付接口
466 uni.showModal({ 396 store.dispatch('order/pay', fieldSet).then(({
467 content: '支付失败', 397 data,
468 showCancel: false, 398 data2,
469 }) 399 pay_id: payId
470 // 跳转订单详情页->状态 待付款 400 }) => {
471 uni.reLaunch({ 401 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') {
472 url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`, 402 const stringA =
473 }) 403 `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}`
474 }, 404 const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789'
475 complete: () => { 405
476 uni.hideLoading() 406 // 微信支付接口
477 }, 407 uni.requestPayment({
478 }) 408 appId: data.appid,
479 } else { 409 timeStamp,
480 uni.showModal({ 410 nonceStr,
481 content: '支付失败', 411 total_fee: this.totalPrice,
482 showCancel: false, 412 package: `prepay_id=${data.prepay_id}`,
483 }) 413 signType: 'MD5',
484 console.log('支付失败') 414 paySign: MD5Util.MD5(stringSignTemp).toUpperCase(),
485 uni.hideLoading() 415 success: (res) => {
486 } 416 // 支付成功
487 }) 417 uni.showModal({
488 }, 418 content: '支付成功',
489 }, 419 showCancel: false,
490 } 420 })
421 // 跳转订单详情页->状态 待收货
422 uni.reLaunch({
423 url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`,
424 })
425 },
426 fail: (res) => {
427 // 支付失败
428 uni.showModal({
429 content: '支付失败',
430 showCancel: false,
431 })
432 // 跳转订单详情页->状态 待付款
433 uni.reLaunch({
434 url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`,
435 })
436 },
437 complete: () => {
438 uni.hideLoading()
439 },
440 })
441 } else {
442 uni.showModal({
443 content: '支付失败',
444 showCancel: false,
445 })
446 console.log('支付失败')
447 uni.hideLoading()
448 }
449 })
450 },
451 },
452 }
491 </script> 453 </script>
492 454
493 <style lang="scss"> 455 <style lang="scss">
494 .wrap { 456 .wrap {
495 height: 100vh; 457 height: 100vh;
496 background-color: #f2f2f2; 458 background-color: #f2f2f2;
497 font-family: PingFangSC-Regular; 459 font-family: PingFangSC-Regular;
498 letter-spacing: -0.23px; 460 letter-spacing: -0.23px;
499 position: absolute; 461 position: absolute;
500 } 462 }
501 .addAddress { 463
502 background-color: #ffffff; 464 .addAddress {
503 box-sizing: border-box; 465 background-color: #ffffff;
504 height: 124rpx; 466 box-sizing: border-box;
505 width: 100%; 467 height: 124rpx;
506 display: flex; 468 width: 100%;
507 align-items: center; 469 display: flex;
508 padding: 0 40rpx; 470 align-items: center;
509 .addIcon { 471 padding: 0 40rpx;
510 background-color: #f2f2f2; 472
511 height: 56rpx; 473 .addIcon {
512 width: 60rpx; 474 background-color: #f2f2f2;
513 border-radius: 4rpx; 475 height: 56rpx;
514 display: flex; 476 width: 60rpx;
515 justify-content: center; 477 border-radius: 4rpx;
516 align-items: center; 478 display: flex;
517 margin-right: 40rpx; 479 justify-content: center;
518 } 480 align-items: center;
519 image { 481 margin-right: 40rpx;
520 height: 28rpx; 482 }
521 width: 30rpx; 483
522 } 484 image {
523 .addressText { 485 height: 28rpx;
524 font-size: 28rpx; 486 width: 30rpx;
525 color: #333333; 487 }
526 margin-right: 364rpx; 488
527 } 489 .addressText {
528 } 490 font-size: 28rpx;
529 .content { 491 color: #333333;
530 background-color: #f2f2f2; 492 margin-right: 364rpx;
531 width: 100%; 493 }
532 display: flex; 494 }
533 flex-direction: column; 495
534 justify-content: center; 496 .content {
535 align-items: center; 497 background-color: #f2f2f2;
536 padding: 40rpx; 498 width: 100%;
537 box-sizing: border-box; 499 display: flex;
538 .orderInfo { 500 flex-direction: column;
539 width: 670rpx; 501 justify-content: center;
540 min-height: 488rpx; 502 align-items: center;
541 background-color: #ffffff; 503 padding: 40rpx;
542 border-radius: 20rpx; 504 box-sizing: border-box;
543 box-sizing: border-box; 505
544 padding: 0 40rpx 40rpx 40rpx; 506 .orderInfo {
545 .title { 507 width: 670rpx;
546 display: flex; 508 min-height: 488rpx;
547 align-items: center; 509 background-color: #ffffff;
548 font-size: 28rpx; 510 border-radius: 20rpx;
549 color: #333333; 511 box-sizing: border-box;
550 height: 60rpx; 512 padding: 0 40rpx 40rpx 40rpx;
551 line-height: 40rpx; 513
552 padding: 10rpx 10rpx 10rpx 0rpx; 514 .title {
553 image { 515 display: flex;
554 margin-right: 20rpx; 516 align-items: center;
555 } 517 font-size: 28rpx;
556 } 518 color: #333333;
557 .infoBox { 519 height: 60rpx;
558 margin-top: 42rpx; 520 line-height: 40rpx;
559 .infoTop { 521 padding: 10rpx 10rpx 10rpx 0rpx;
560 display: flex; 522
561 flex-direction: row; 523 image {
562 image { 524 margin-right: 20rpx;
563 height: 188rpx; 525 }
564 width: 188rpx; 526 }
565 margin-right: 24rpx; 527
566 } 528 .infoBox {
567 .infoRight { 529 margin-top: 42rpx;
568 width: 374rpx; 530
569 display: flex; 531 .infoTop {
570 flex-direction: column; 532 display: flex;
571 align-items: flex-start; 533 flex-direction: row;
572 justify-content: space-between; 534
573 .goodName { 535 image {
574 font-size: 28rpx; 536 height: 188rpx;
575 color: #333333; 537 width: 188rpx;
576 } 538 margin-right: 24rpx;
577 .remarks { 539 }
578 font-size: 20rpx; 540
579 color: #999999; 541 .infoRight {
580 } 542 width: 374rpx;
581 .priceBox { 543 display: flex;
582 display: flex; 544 flex-direction: column;
583 justify-content: space-between; 545 align-items: flex-start;
584 align-items: center; 546 justify-content: space-between;
585 width: 100%; 547
586 .price { 548 .goodName {
587 color: #ff6b4a; 549 font-size: 28rpx;
588 font-size: 28rpx; 550 color: #333333;
589 text{ 551 }
590 margin-left: 10rpx; 552
591 } 553 .remarks {
592 } 554 font-size: 20rpx;
593 .originCost { 555 color: #999999;
594 text-decoration: line-through; 556 }
595 color: #999999; 557
596 font-size: 20rpx; 558 .priceBox {
597 } 559 display: flex;
598 .counter { 560 justify-content: space-between;
599 display: flex; 561 align-items: center;
600 flex-direction: row; 562 width: 100%;
601 justify-content: space-between; 563
602 font-size: 28rpx; 564 .price {
603 color: #333333; 565 color: #ff6b4a;
604 width: 122rpx; 566 font-size: 28rpx;
605 .btn { 567
606 display: flex; 568 text {
607 justify-content: center; 569 margin-left: 10rpx;
608 line-height: 32rpx; 570 }
609 height: 32rpx; 571 }
610 width: 32rpx; 572
611 background-color: #f2f2f2; 573 .originCost {
612 color: #cfcfcf; 574 text-decoration: line-through;
613 } 575 color: #999999;
614 } 576 font-size: 20rpx;
615 } 577 }
616 } 578
617 } 579 .counter {
618 .infoBottom { 580 display: flex;
619 display: flex; 581 flex-direction: row;
620 flex-direction: column; 582 justify-content: space-between;
621 justify-content: flex-start; 583 font-size: 28rpx;
622 font-size: 24rpx; 584 color: #333333;
623 color: #333333; 585 width: 122rpx;
624 text { 586
625 color: #999999; 587 .btn {
626 margin-left: 20rpx; 588 display: flex;
627 } 589 justify-content: center;
628 590 line-height: 32rpx;
629 .norm { 591 height: 32rpx;
630 margin-top: 28rpx; 592 width: 32rpx;
631 } 593 background-color: #f2f2f2;
632 .shippingMethod { 594 color: #cfcfcf;
633 margin-top: 12rpx; 595 }
634 } 596 }
635 .message { 597 }
636 display: flex; 598 }
637 flex-direction: row; 599 }
638 align-items: center; 600
639 margin-top: 18rpx; 601 .infoBottom {
640 input { 602 display: flex;
641 margin-left: 20rpx; 603 flex-direction: column;
642 width: 75%; 604 justify-content: flex-start;
643 } 605 font-size: 24rpx;
644 } 606 color: #333333;
645 } 607
646 } 608 text {
647 } 609 color: #999999;
648 .payWay { 610 margin-left: 20rpx;
649 height: 464rpx; 611 }
650 width: 670rpx; 612
651 background-color: #ffffff; 613 .norm {
652 color: #333333; 614 margin-top: 28rpx;
653 font-size: 24rpx; 615 }
654 border-radius: 20rpx; 616
655 box-sizing: border-box; 617 .shippingMethod {
656 padding: 0 52rpx 0rpx 40rpx; 618 margin-top: 12rpx;
657 margin-top: 20rpx; 619 }
658 display: flex; 620
659 flex-direction: column; 621 .message {
660 justify-content: center; 622 display: flex;
661 align-items: flex-start; 623 flex-direction: row;
662 .item { 624 align-items: center;
663 display: flex; 625 margin-top: 18rpx;
664 flex-direction: row; 626
665 justify-content: space-between; 627 input {
666 align-items: center; 628 margin-left: 20rpx;
667 width: 100%; 629 width: 75%;
668 height: 115rpx; 630 }
669 .itemRight { 631 }
670 display: flex; 632 }
671 flex-direction: row; 633 }
672 justify-content: space-between; 634 }
673 align-items: center; 635
674 image { 636 .payWay {
675 height: 24rpx; 637 height: 464rpx;
676 width: 12rpx; 638 width: 670rpx;
677 } 639 background-color: #ffffff;
678 .rightText { 640 color: #333333;
679 margin-right: 20rpx; 641 font-size: 24rpx;
680 text-align: right; 642 border-radius: 20rpx;
681 .choosePayWay { 643 box-sizing: border-box;
682 display: flex; 644 padding: 0 52rpx 0rpx 40rpx;
683 align-items: center; 645 margin-top: 20rpx;
684 text { 646 display: flex;
685 color: #333333; 647 flex-direction: column;
686 } 648 justify-content: center;
687 image { 649 align-items: flex-start;
688 height: 36rpx; 650
689 width: 40rpx; 651 .item {
690 margin-right: 8px; 652 display: flex;
691 } 653 flex-direction: row;
692 } 654 justify-content: space-between;
693 .randomSubstraction { 655 align-items: center;
694 color: #ff6b4a; 656 width: 100%;
695 } 657 height: 115rpx;
696 .preferentialWay { 658
697 color: #999999; 659 .itemRight {
698 } 660 display: flex;
699 } 661 flex-direction: row;
700 .freight, 662 justify-content: space-between;
701 .total { 663 align-items: center;
702 margin-right: 32rpx; 664
703 } 665 image {
704 text { 666 height: 24rpx;
705 color: #ff6b4a; 667 width: 12rpx;
706 } 668 }
707 } 669
708 } 670 .rightText {
709 } 671 margin-right: 20rpx;
710 // .checkBox { 672 text-align: right;
711 // height: 58rpx; 673
712 // line-height: 58rpx; 674 .choosePayWay {
713 // width: 100%; 675 display: flex;
714 // margin-top: 36rpx; 676 align-items: center;
715 // margin-left: 40rpx; 677
716 // font-size: 12px; 678 text {
717 // color: #999999; 679 color: #333333;
718 // } 680 }
719 } 681
720 .footer { 682 image {
721 height: 112rpx; 683 height: 36rpx;
722 width: 100%; 684 width: 40rpx;
723 background-color: #fff; 685 margin-right: 8px;
724 font-size: 16px; 686 }
725 display: flex; 687 }
726 justify-content: space-between; 688
727 align-items: center; 689 .randomSubstraction {
728 position: fixed; 690 color: #ff6b4a;
729 bottom: 0; 691 }
730 z-index: 9999; 692
731 .footerLeft { 693 .preferentialWay {
732 display: flex; 694 color: #999999;
733 justify-content: center; 695 }
734 align-items: center; 696 }
735 width: 50%; 697
736 color: #333333; 698 .freight,
737 text { 699 .total {
738 color: #ff6b4a; 700 margin-right: 32rpx;
739 } 701 }
740 } 702
741 .footerRight { 703 text {
742 display: flex; 704 color: #ff6b4a;
743 justify-content: flex-end; 705 }
744 align-items: center; 706 }
745 width: 50%; 707 }
746 margin-right: 26rpx; 708 }
747 .paybtn { 709
748 display: flex; 710 // .checkBox {
749 justify-content: center; 711 // height: 58rpx;
750 align-items: center; 712 // line-height: 58rpx;
751 background: #ff6b4a; 713 // width: 100%;
752 border-radius: 20px; 714 // margin-top: 36rpx;
753 border-radius: 20px; 715 // margin-left: 40rpx;
754 color: #ffffff; 716 // font-size: 12px;
755 width: 204rpx; 717 // color: #999999;
756 height: 80rpx; 718 // }
757 } 719 }
758 } 720
759 } 721 .footer {
760 // 地址信息样式 722 height: 112rpx;
761 .order-user { 723 width: 100%;
762 width: 670rpx; 724 background-color: #fff;
763 height: 228rpx; 725 font-size: 16px;
764 background: #ffffff; 726 display: flex;
765 border-radius: 14rpx; 727 justify-content: space-between;
766 margin: 0 auto; 728 align-items: center;
767 margin-top: 20rpx; 729 position: fixed;
768 position: relative; 730 bottom: 0;
769 .order-user-head { 731 z-index: 9999;
770 display: flex; 732
771 height: 108rpx; 733 .footerLeft {
772 width: 100%; 734 display: flex;
773 align-items: center; 735 justify-content: center;
774 padding-left: 126rpx; 736 align-items: center;
775 box-sizing: border-box; 737 width: 50%;
776 .name { 738 color: #333333;
777 display: flex; 739
778 justify-content: space-between; 740 text {
779 font-size: 14px; 741 color: #ff6b4a;
780 color: #333333; 742 }
781 letter-spacing: -0.26px; 743 }
782 margin-right: 20rpx; 744
783 .default { 745 .footerRight {
784 height: 40rpx; 746 display: flex;
785 width: 80rpx; 747 justify-content: flex-end;
786 background-color: #4a90e2; 748 align-items: center;
787 border-radius: 13px; 749 width: 50%;
788 border-radius: 13px; 750 margin-right: 26rpx;
789 text-align: center; 751
790 margin-right: 20rpx; 752 .paybtn {
791 text { 753 display: flex;
792 display: flex; 754 justify-content: center;
793 justify-content: center; 755 align-items: center;
794 align-items: center; 756 background: #ff6b4a;
795 font-size: 12px; 757 border-radius: 20px;
796 color: #ffffff; 758 border-radius: 20px;
797 letter-spacing: -0.23px; 759 color: #ffffff;
798 } 760 width: 204rpx;
799 } 761 height: 80rpx;
800 } 762 }
801 .mobile { 763 }
802 font-size: 14px; 764 }
803 color: #999999; 765
804 letter-spacing: -0.26px; 766 // 地址信息样式
805 } 767 .order-user {
806 } 768 width: 670rpx;
src/pages/details/components/Introduce.vue
1 <template> 1 <template>
2 <view class="introduce"> 2 <view class="introduce">
3 <!-- 迭代时建议配合接口修改 为数组 --> 3 <!-- 迭代时建议配合接口修改 为数组 -->
4 <view v-if="tag.prod_tag_age && tag.prod_tag_age.length !== 0"> 4
5 <view v-if="Tag.Age && Tag.Age.length !== 0">
5 <view> 6 <view>
6 年龄:<view 7 年龄:<view
7 v-for="(item,index) in tag.prod_tag_age" 8 v-for="(item,index) in Tag.Age"
8 :key="index" 9 :key="index"
9 > 10 >
10 {{item.label}}<text v-if="index !== tag.prod_tag_age.length - 1">/</text> 11 {{item}}<text v-if="index !== Tag.Age.length - 1">/</text>
11 </view> 12 </view>
12 </view> 13 </view>
13 </view> 14 </view>
14 <view v-if="tag.prod_tag_color && tag.prod_tag_color.length !== 0"> 15 <view v-if="Tag.Colour && Tag.Colour.length !== 0">
15 <view> 16 <view>
16 颜色:<view 17 颜色:<view
17 v-for="(item,index) in tag.prod_tag_color" 18 v-for="(item,index) in Tag.Colour"
18 :key="index" 19 :key="index"
19 > 20 >
20 {{item.label}}<text v-if="index !== tag.prod_tag_color.length - 1">/</text> 21 {{item}}<text v-if="index !== Tag.Colour.length - 1">/</text>
21 </view> 22 </view>
22 </view> 23 </view>
23 </view> 24 </view>
24 <view v-if="tag.prod_tag_face && tag.prod_tag_face.length !== 0"> 25 <view v-if="Tag.Shape && Tag.Shape.length !== 0">
25 <view> 26 <view>
26 脸型:<view 27 脸型:<view
27 v-for="(item,index) in tag.prod_tag_face" 28 v-for="(item,index) in Tag.Shape"
28 :key="index" 29 :key="index"
29 > 30 >
30 {{item.label}}<text v-if="index !== tag.prod_tag_face.length - 1">/</text> 31 {{item}}<text v-if="index !== Tag.Shape.length - 1">/</text>
31 </view> 32 </view>
32 </view> 33 </view>
33 </view> 34 </view>
34 <view v-if="tag.prod_tag_freesend && tag.prod_tag_freesend.length !== 0"> 35 <view v-if="Tag.Rim && Tag.Rim.length !== 0">
35 <view> 36 <view>
36 赠品:<view 37 赠品:<view
37 v-for="(item,index) in tag.prod_tag_freesend" 38 v-for="(item,index) in Tag.Rim"
38 :key="index" 39 :key="index"
39 > 40 >
40 {{item.label}}<text v-if="index !== tag.prod_tag_freesend.length - 1">/</text> 41 {{item}}<text v-if="index !== Tag.Rim.length - 1">/</text>
41 </view> 42 </view>
42 </view> 43 </view>
43 </view> 44 </view>
44 <view v-if="tag.prod_tag_insurance && tag.prod_tag_insurance.length !== 0"> 45 <!-- <view v-if="Tag.prod_Tag_insurance && Tag.prod_Tag_insurance.length !== 0">
45 <view> 46 <view>
46 保险:<view 47 保险:<view
47 v-for="(item,index) in tag.prod_tag_insurance" 48 v-for="(item,index) in Tag.prod_Tag_insurance"
48 :key="index" 49 :key="index"
49 > 50 >
50 {{item.label}}<text v-if="index !== tag.prod_tag_insurance.length - 1">/</text> 51 {{item.label}}<text v-if="index !== Tag.prod_Tag_insurance.length - 1">/</text>
51 </view> 52 </view>
52 </view> 53 </view>
53 </view> 54 </view> -->
54 <view v-if="tag.prod_tag_metal && tag.prod_tag_metal.length !== 0"> 55 <view v-if="Tag.Material && Tag.Material.length !== 0">
55 <view> 56 <view>
56 材质:<view 57 材质:<view
57 v-for="(item,index) in tag.prod_tag_metal" 58 v-for="(item,index) in Tag.Material"
58 :key="index" 59 :key="index"
59 > 60 >
60 {{item.label}}<text v-if="index !== tag.prod_tag_metal.length - 1">/</text> 61 {{item}}<text v-if="index !== Tag.Material.length - 1">/</text>
61 </view> 62 </view>
62 </view> 63 </view>
63 </view> 64 </view>
64 <view v-if="tag.prod_tag_personal && tag.prod_tag_personal.length !== 0"> 65 <!-- <view v-if="Tag.Style && Tag.Style.length !== 0">
65 <view> 66 <view>
66 个性:<view 67 个性:<view
67 v-for="(item,index) in tag.prod_tag_personal" 68 v-for="(item,index) in Tag.Style"
68 :key="index" 69 :key="index"
69 > 70 >
70 {{item.label}}<text v-if="index !== tag.prod_tag_personal.length - 1">/</text> 71 {{item}}<text v-if="index !== Tag.Style.length - 1">/</text>
71 </view> 72 </view>
72 </view> 73 </view>
73 </view> 74 </view> -->
74 <view v-if="tag.prod_tag_sense && tag.prod_tag_sense.length !== 0"> 75 <view v-if="Tag.Eyeglasses && Tag.Eyeglasses.length !== 0">
75 <view> 76 <view>
76 场景:<view 77 场景:<view
77 v-for="(item,index) in tag.prod_tag_sense" 78 v-for="(item,index) in Tag.Eyeglasses"
78 :key="index" 79 :key="index"
79 > 80 >
80 {{item.label}}<text v-if="index !== tag.prod_tag_sense.length - 1">/</text> 81 {{item}}<text v-if="index !== Tag.Eyeglasses.length - 1">/</text>
81 </view> 82 </view>
82 </view> 83 </view>
83 </view> 84 </view>
84 <view v-if="tag.prod_tag_sex && tag.prod_tag_sex.length !== 0"> 85 <view v-if="Tag.Gender && Tag.Gender.length !== 0">
85 <view> 86 <view>
86 性别:<view 87 性别:<view
87 v-for="(item,index) in tag.prod_tag_sex" 88 v-for="(item,index) in Tag.Gender"
88 :key="index" 89 :key="index"
89 > 90 >
90 {{item.label}}<text v-if="index !== tag.prod_tag_sex.length - 1">/</text> 91 {{item}}<text v-if="index !== Tag.Gender.length - 1">/</text>
91 </view> 92 </view>
92 </view> 93 </view>
93 </view> 94 </view>
94 <view v-if="tag.prod_tag_style && tag.prod_tag_style.length !== 0"> 95 <!-- <view v-if="Tag.prod_Tag_style && Tag.prod_Tag_style.length !== 0">
95 <view> 96 <view>
96 风格:<view 97 风格:<view
97 v-for="(item,index) in tag.prod_tag_style" 98 v-for="(item,index) in Tag.prod_Tag_style"
98 :key="index" 99 :key="index"
99 > 100 >
100 {{item.label}}<text v-if="index !== tag.prod_tag_style.length - 1">/</text> 101 {{item.label}}<text v-if="index !== Tag.prod_Tag_style.length - 1">/</text>
101 </view> 102 </view>
102 </view> 103 </view>
103 </view> 104 </view> -->
104 <view v-if="tag.prod_tag_weight && tag.prod_tag_weight.length !== 0"> 105
106 <view v-if="Tag.Colour && Tag.Colour.length !== 0">
105 <view> 107 <view>
106 重量:<view 108 重量:<view
107 v-for="(item,index) in tag.prod_tag_weight" 109 v-for="(item,index) in Tag.Colour"
108 :key="index" 110 :key="index"
109 > 111 >
110 {{item.label}}<text v-if="index !== tag.prod_tag_weight.length - 1">/</text> 112 {{item}}<text v-if="index !== Tag.Colour.length - 1">/</text>
111 </view> 113 </view>
112 </view> 114 </view>
113 </view> 115 </view>
114 </view> 116 </view>
115 </template> 117 </template>
116 118
117 <script> 119 <script>
118 export default { 120 export default {
119 props: { 121 props: {
120 tag: Object, 122 Tag: Object,
121 }, 123 },
122 created() { 124 created() {
123 }, 125 },
124 updated() { 126 updated() {
125 }, 127 },
126 } 128 }
127 </script> 129 </script>
128 130
129 <style lang="scss" scoped> 131 <style lang="scss" scoped>
130 .introduce { 132 .introduce {
131 margin-bottom: 4px; 133 margin-bottom: 4px;
132 view { 134 view {
133 display: flex; 135 display: flex;
134 align-content: center; 136 align-content: center;
135 font-size: 14px; 137 font-size: 14px;
136 color: #333333; 138 color: #333333;
137 } 139 }
138 span { 140 span {
139 margin-left: 6px; 141 margin-left: 6px;
140 margin-right: 5px; 142 margin-right: 5px;
141 font-family: "PingFangSC-Regular"; 143 font-family: "PingFangSC-Regular";
142 } 144 }
143 } 145 }
144 </style> 146 </style>
145 147
src/pages/details/details.vue
1 <template> 1 <template>
2 <view class="container"> 2 <view class="container">
3 <!-- 基础信息 --> 3 <!-- 基础信息 -->
4 <view class="basic_info"> 4 <view class="basic_info">
5 <!-- 轮播图 --> 5 <!-- 轮播图 -->
6 <swiper 6 <swiper
7 class="swiperImage" 7 class="swiperImage"
8 :indicator-dots="true" 8 :indicator-dots="true"
9 :autoplay="true" 9 :autoplay="true"
10 :interval="4000" 10 :interval="4000"
11 :duration="500" 11 :duration="500"
12 > 12 >
13 <swiper-item 13 <swiper-item
14 v-for="(item, index) in carousel" 14 v-for="(item, index) in carousel"
15 :key="index" 15 :key="index"
16 > 16 >
17 <image 17 <image
18 :src="item" 18 :src="item"
19 mode="scaleToFill" 19 mode="scaleToFill"
20 ></image> 20 ></image>
21 </swiper-item> 21 </swiper-item>
22 </swiper> 22 </swiper>
23 <!-- 产品价格及购买人数 --> 23 <!-- 产品价格及购买人数 -->
24 <view class="info_pay"> 24 <view class="info_pay">
25 <view>¥{{goodsInfo.price || '暂无'}}<span 25 <view>¥{{goodsInfo.price || '暂无'}}<span
26 v-if="goodsInfo.discountPrice" 26 v-if="goodsInfo.discountPrice"
27 class="info_pay_discount" 27 class="info_pay_discount"
28 >¥{{goodsInfo.discountPrice}}</span></view> 28 >¥{{goodsInfo.discountPrice}}</span></view>
29 <span class="info_pay_number">{{goodsInfo.tradeNumber || '暂无'}}人购买过</span> 29 <span class="info_pay_number">{{goodsInfo.tradeNumber || '暂无'}}人购买过</span>
30 </view> 30 </view>
31 <!-- 产品名称 --> 31 <!-- 产品名称 -->
32 <view class="info_name"> 32 <view class="info_name">
33 <text class="info_name_name">{{goodsInfo.name || '暂无'}}</text> 33 <text class="info_name_name">{{goodsInfo.name || '暂无'}}</text>
34 <view 34 <view
35 @tap="confirmShare" 35 @tap="confirmShare"
36 class="info_name_share" 36 class="info_name_share"
37 > 37 >
38 <image src="/static/img/detail/share-icon.png"></image> 38 <image src="/static/img/detail/share-icon.png"></image>
39 <text>分享</text> 39 <text>分享</text>
40 </view> 40 </view>
41 </view> 41 </view>
42 <!-- 产品售后信息 --> 42 <!-- 产品售后信息 -->
43 <view class="info_after"> 43 <view class="info_after">
44 <span>支持7天无理由退货</span> 44 <span>支持7天无理由退货</span>
45 <span>顺丰发货</span> 45 <span>顺丰发货</span>
46 <span>30天质量保证</span> 46 <span>30天质量保证</span>
47 </view> 47 </view>
48 </view> 48 </view>
49 <!-- 详细信息 --> 49 <!-- 详细信息 -->
50 <view class="detail_info"> 50 <view class="detail_info">
51 <!-- 详细信息菜单 --> 51 <!-- 详细信息菜单 -->
52 <view class="screen_bar"> 52 <view class="screen_bar">
53 <view 53 <view
54 v-for="(item, index) in screenItems" 54 v-for="(item, index) in screenItems"
55 :key="index" 55 :key="index"
56 @click="tabChange(index)" 56 @click="tabChange(index)"
57 > 57 >
58 <view 58 <view
59 class="screen_item" 59 class="screen_item"
60 v-bind:class="{ item_active: item_current === index }" 60 v-bind:class="{ item_active: item_current === index }"
61 >{{ screenItems[index] || '暂无' }}</view> 61 >{{ screenItems[index] || '暂无' }}</view>
62 </view> 62 </view>
63 </view> 63 </view>
64 <!-- 商品介绍 --> 64 <!-- 商品介绍 -->
65 <view 65 <view
66 class="screen_item" 66 class="screen_item"
67 v-if="item_current === 0" 67 v-if="item_current === 0"
68 > 68 >
69 <Introduce :tag="tag" /> 69 <Introduce :Tag="Tag" />
70 </view> 70 </view>
71 <!-- 规格参数 --> 71 <!-- 规格参数 -->
72 <view 72 <view
73 class="screen_item" 73 class="screen_item"
74 v-if="item_current === 1" 74 v-if="item_current === 1"
75 > 75 >
76 <view class="specification"> 76 <view class="specification">
77 <view 77 <view
78 class="spe_item" 78 class="spe_item"
79 v-for="(item, index) in specification" 79 v-for="(item, index) in specification"
80 :key="index" 80 :key="index"
81 > 81 >
82 <image 82 <image
83 class="spe_image" 83 class="spe_image"
84 v-bind:src="item.img" 84 v-bind:src="item.img"
85 ></image> 85 ></image>
86 <span>{{item.standard || '暂无'}}</span> 86 <span>{{item.standard || '暂无'}}</span>
87 <span>{{item.slength || '暂无'}}</span> 87 <span>{{item.slength || '暂无'}}</span>
88 </view> 88 </view>
89 </view> 89 </view>
90 </view> 90 </view>
91 <!-- 售后保障 --> 91 <!-- 售后保障 -->
92 <view 92 <view
93 class="screen_item" 93 class="screen_item"
94 v-if="item_current === 2" 94 v-if="item_current === 2"
95 > 95 >
96 <AfterSails /> 96 <AfterSails />
97 </view> 97 </view>
98 </view> 98 </view>
99 <!-- 评价 --> 99 <!-- 评价 -->
100 <template v-if="item_current !== 2"> 100 <template v-if="item_current !== 2">
101 <view class="evaluate"> 101 <view class="evaluate">
102 <!-- 标题 --> 102 <!-- 标题 -->
103 <view class="evaluate_title"> 103 <view class="evaluate_title">
104 <view><span>宝贝好评率</span><span class="title_rate">{{evaluate.rate}}</span></view> 104 <view><span>宝贝好评率</span><span class="title_rate">{{evaluate.rate}}</span></view>
105 <!-- 星星 --> 105 <!-- 星星 -->
106 <view class="evaluate_star"> 106 <view class="evaluate_star">
107 <view 107 <view
108 class="star" 108 class="star"
109 v-for="(item, index) in evaluate.star" 109 v-for="(item, index) in evaluate.star"
110 :key="index" 110 :key="index"
111 > 111 >
112 <image 112 <image
113 src="../../static/img/detail/d_star.png" 113 src="../../static/img/detail/d_star.png"
114 mode="aspectFill" 114 mode="aspectFill"
115 style="height: 26rpx; width: 28rpx;" 115 style="height: 26rpx; width: 28rpx;"
116 ></image> 116 ></image>
117 </view> 117 </view>
118 </view> 118 </view>
119 </view> 119 </view>
120 <!-- 标签 --> 120 <!-- 标签 -->
121 <view class="evaluate_tag"> 121 <view class="evaluate_tag">
122 <view 122 <view
123 v-for="(item, index) in evaluate.tag.Colour" 123 v-for="(item, index) in evaluate.tag.Colour"
124 :key="index" 124 :key="index"
125 >{{item}}</view> 125 >{{item}}</view>
126 </view> 126 </view>
127 </view> 127 </view>
128 </template> 128 </template>
129 <!-- 商品详情页 --> 129 <!-- 商品详情页 -->
130 <template v-if="current !==2"> 130 <template v-if="current !==2">
131 <view class="more_info"> 131 <view class="more_info">
132 <view 132 <view
133 class="more_fixed1" 133 class="more_fixed1"
134 @click="consolg(goodInfo.prodIntro1)" 134 @click="consolg(goodInfo.prodIntro1)"
135 > 135 >
136 <image src="/static/img/detail/hr.png"></image> 136 <image src="/static/img/detail/hr.png"></image>
137 <view>商品详情</view> 137 <view>商品详情</view>
138 <image src="/static/img/detail/hr.png"></image> 138 <image src="/static/img/detail/hr.png"></image>
139 </view> 139 </view>
140 <view 140 <view
141 class="more_all" 141 class="more_all"
142 v-html="more" 142 v-html="more"
143 > 143 >
144 </view> 144 </view>
145 </view> 145 </view>
146 </template> 146 </template>
147 <!-- 底部菜单 --> 147 <!-- 底部菜单 -->
148 <view class="menu"> 148 <view class="menu">
149 <view 149 <view
150 @tap="toCart()" 150 @tap="toCart()"
151 class="menu_1" 151 class="menu_1"
152 > 152 >
153 <view class="cart_icon"> 153 <view class="cart_icon">
154 <image src="/static/tab-cart.png" /> 154 <image src="/static/tab-cart.png" />
155 <text>{{cartNumber}}</text> 155 <text>{{cartNumber}}</text>
156 </view> 156 </view>
157 <view class="menu_image">购物车</view> 157 <view class="menu_image">购物车</view>
158 </view> 158 </view>
159 <view class="menu_2"> 159 <view class="menu_2">
160 <view 160 <view
161 class="menu_input" 161 class="menu_input"
162 @tap="showBottom(1)" 162 @tap="showBottom(1)"
163 >加入购物车</view> 163 >加入购物车</view>
164 <view 164 <view
165 class="menu_now" 165 class="menu_now"
166 @click="showBottom(2)" 166 @click="showBottom(2)"
167 >立即购买</view> 167 >立即购买</view>
168 </view> 168 </view>
169 </view> 169 </view>
170 <!-- 参数选择 --> 170 <!-- 参数选择 -->
171 <template v-if="isShowBottom"> 171 <template v-if="isShowBottom">
172 <BottomSheet 172 <BottomSheet
173 :isCart="isCart" 173 :isCart="isCart"
174 @addCart="addCart" 174 @addCart="addCart"
175 :pid="pid" 175 :shop_wood_id="shop_wood_id"
176 :wsp_id="skId"
176 :goodInfo="goodInfo" 177 :goodInfo="goodInfo"
177 :isShowBottom="isShowBottom" 178 :isShowBottom="isShowBottom"
178 @closeBottom="closeBottom" 179 @closeBottom="closeBottom"
179 ></BottomSheet> 180 ></BottomSheet>
180 </template> 181 </template>
181 <!-- 分享 --> 182 <!-- 分享 -->
182 <template> 183 <template>
183 <uni-popup 184 <uni-popup
184 ref="popupShare" 185 ref="popupShare"
185 type="share" 186 type="share"
186 > 187 >
187 <uni-popup-share @select="selectShare"></uni-popup-share> 188 <uni-popup-share @select="selectShare"></uni-popup-share>
188 </uni-popup> 189 </uni-popup>
189 </template> 190 </template>
190 <!-- 分享海报 --> 191 <!-- 分享海报 -->
191 <template> 192 <template>
192 <uni-popup 193 <uni-popup
193 ref="uniPopupPost" 194 ref="uniPopupPost"
194 type="center" 195 type="center"
195 > 196 >
196 <uni-popup-post :postUrl="postUrl"></uni-popup-post> 197 <uni-popup-post :postUrl="postUrl"></uni-popup-post>
197 </uni-popup> 198 </uni-popup>
198 </template> 199 </template>
199 </view> 200 </view>
200 </template> 201 </template>
201 202
202 <script> 203 <script>
203 import store from '@/store' 204 import store from '@/store'
204 import Introduce from './components/Introduce' // 商品介绍基本信息组件 205 import Introduce from './components/Introduce' // 商品介绍基本信息组件
205 import AfterSails from './components/AfterSails' // 售后保障组件 206 import AfterSails from './components/AfterSails' // 售后保障组件
206 import uniPopupShare from '@/components/uni-popup/uni-popup-share.vue' // 分享组件 207 import uniPopupShare from '@/components/uni-popup/uni-popup-share.vue' // 分享组件
207 import uniPopupPost from '@/components/uni-popup/uni-popup-post.vue' // 分享组件 208 import uniPopupPost from '@/components/uni-popup/uni-popup-post.vue' // 分享组件
208 import BottomSheet from '@/components/BottomSheet/BottomSheet.vue' // 参数选择组件 209 import BottomSheet from '@/components/BottomSheet/BottomSheet.vue' // 参数选择组件
209 210
210 export default { 211 export default {
211 components: { 212 components: {
212 Introduce, 213 Introduce,
213 AfterSails, 214 AfterSails,
214 BottomSheet, 215 BottomSheet,
215 uniPopupShare, 216 uniPopupShare,
216 uniPopupPost, 217 uniPopupPost,
217 }, 218 },
218 data () { 219 data () {
219 return { 220 return {
220 shop_wood_id: 751, // 产品ID 221 shop_wood_id: 751, // 产品ID
221 skId: 2723, // skuId 222 skId: 2723, // skuId
222 // 详细信息菜单 223 // 详细信息菜单
223 item_current: 0, 224 item_current: 0,
224 screenItems: [ 225 screenItems: [
225 '商品介绍', 226 '商品介绍',
226 '规格参数', 227 '规格参数',
227 '售后保障', 228 '售后保障',
228 ], 229 ],
229 current:0, 230 current:0,
230 showPostImg: false, // 是否展示分享海报 231 showPostImg: false, // 是否展示分享海报
231 isShowBottom: false, // 是否展示参数选择 232 isShowBottom: false, // 是否展示参数选择
232 isCart: 1, // 参数选择 按钮判断 233 isCart: 1, // 参数选择 按钮判断
233 } 234 }
234 }, 235 },
235 onLoad({ shop_wood_id = this.shop_wood_id, sk_id: skId }) { 236 onLoad({ shop_wood_id = this.shop_wood_id, sk_id: skId }) {
236 // 根据页面传参请求页面数据 237 // 根据页面传参请求页面数据
237 this.shop_wood_id = shop_wood_id 238 this.shop_wood_id = shop_wood_id
238 this.skId = skId 239 this.skId = skId
239 240
240 // 获取产品详情 241 // 获取产品详情
241 this.getDetails({ shop_wood_id, skId }) 242 this.getDetails({ shop_wood_id, skId })
242 // 获取购物车数据 243 // 获取购物车数据
243 this.getCartNum() 244 this.getCartNum()
244 }, 245 },
245 computed: { 246 computed: {
246 // 获取轮播图数据 247 // 获取轮播图数据
247 goodInfo() { 248 goodInfo() {
248 return this.$store.state.details.goodInfo 249 return this.$store.state.details.goodInfo
249 }, 250 },
250 // 获取轮播图数据 251 // 获取轮播图数据
251 carousel() { 252 carousel() {
252 return this.$store.state.details.carousel 253 return this.$store.state.details.carousel
253 }, 254 },
254 // 商品基本信息 255 // 商品基本信息
255 goodsInfo() { 256 goodsInfo() {
256 return this.$store.state.details.goodsInfo 257 return this.$store.state.details.goodsInfo
257 }, 258 },
258 // 商品介绍商品标签 259 // 商品介绍商品标签
259 tag() { 260 Tag() {
260 return this.$store.state.details.tag 261 return this.$store.state.details.Tag
261 }, 262 },
262 // 规格参数 263 // 规格参数
263 specification() { 264 specification() {
264 return this.$store.state.details.specification 265 return this.$store.state.details.specification
265 }, 266 },
266 // 评价 267 // 评价
267 evaluate() { 268 evaluate() {
268 return this.$store.state.details.evaluate 269 return this.$store.state.details.evaluate
269 }, 270 },
270 // 商品详情 271 // 商品详情
271 more() { 272 more() {
272 return this.$store.state.details.more 273 return this.$store.state.details.shop_wood_desc_rich_text
273 }, 274 },
274 // 购物车数目 275 // 购物车数目
275 cartNumber() { 276 cartNumber() {
276 return this.$store.state.details.cartNumber 277 return this.$store.state.details.cartNumber
277 }, 278 },
278 // 购物车数目 279 // 购物车数目
279 skuList() { 280 skuList() {
280 return this.$store.state.details.skuList 281 return this.$store.state.details.skuList
281 }, 282 },
282 // 分享海报 283 // 分享海报
283 postUrl() { 284 postUrl() {
284 return this.$store.state.details.postUrl 285 return this.$store.state.details.postUrl
285 }, 286 },
286 }, 287 },
287 methods: { 288 methods: {
288 // 获取产品详情 289 // 获取产品详情
289 getDetails({ shop_wood_id, skId }) { 290 getDetails({ shop_wood_id, skId }) {
290 store.dispatch('details/details', { 291 store.dispatch('details/details', {
291 shop_wood_id:shop_wood_id, 292 shop_wood_id:shop_wood_id,
292 sk_id: skId, 293 sk_id: skId,
293 }) 294 })
294 store.dispatch('read/fetch', { 295 store.dispatch('read/fetch', {
295 shop_wood_id:shop_wood_id, 296 shop_wood_id:shop_wood_id,
296 sk_id: skId, 297 sk_id: skId,
297 }) 298 })
298 }, 299 },
299 // 获取购物车数目 300 // 获取购物车数目
300 getCartNum() { 301 getCartNum() {
301 store.dispatch('details/getCartNumber') 302 store.dispatch('details/getCartNumber')
302 }, 303 },
303 // 切换详细信息菜单 304 // 切换详细信息菜单
304 tabChange (e) { 305 tabChange (e) {
305 console.error('eeeeeee', e); 306 console.error('eeeeeee', e);
306 // if (this.current !== e) { 307 // if (this.current !== e) {
307 this.current = e 308 this.current = e
308 this.item_current = e 309 this.item_current = e
309 // } 310 // }
310 }, 311 },
311 // 打开分享界面 312 // 打开分享界面
312 confirmShare() { 313 confirmShare() {
313 this.$refs.popupShare.open() 314 this.$refs.popupShare.open()
314 }, 315 },
315 // 选择分享 316 // 选择分享
316 selectShare(e, done) { 317 selectShare(e, done) {
317 switch (e.item.name) { 318 switch (e.item.name) {
318 // 分享到好物圈 319 // 分享到好物圈
319 case 'recommend': 320 case 'recommend':
320 this.shareRecommend() 321 this.shareRecommend()
321 break 322 break
322 // 分享到朋友圈 323 // 分享到朋友圈
323 case 'friend': 324 case 'friend':
324 break 325 break
325 // 生成海报 326 // 生成海报
326 case 'poster': 327 case 'poster':
327 uni.showLoading({ 328 uni.showLoading({
328 title: '生成图片中', 329 title: '生成图片中',
329 }) 330 })
330 this.sharePost() 331 this.sharePost()
331 break 332 break
332 default: 333 default:
333 break 334 break
334 } 335 }
335 done() 336 done()
336 }, 337 },
337 // 分享到好物圈 338 // 分享到好物圈
338 shareRecommend() { 339 shareRecommend() {
339 if (wx.openBusinessView) { 340 if (wx.openBusinessView) {
340 wx.openBusinessView({ 341 wx.openBusinessView({
341 businessType: 'friendGoodsRecommend', 342 businessType: 'friendGoodsRecommend',
342 extraData: { 343 extraData: {
343 product: { 344 product: {
344 item_code: '58_68', 345 item_code: '58_68',
345 title: this.goodsInfo.name, 346 title: this.goodsInfo.name,
346 image_list: this.carousel, 347 image_list: this.carousel,
347 }, 348 },
348 }, 349 },
349 success: function (res) { 350 success: function (res) {
350 uni.showToast({ 351 uni.showToast({
351 title: '好物圈分享成功!', 352 title: '好物圈分享成功!',
352 icon: 'none', 353 icon: 'none',
353 duration: 2000, 354 duration: 2000,
354 }) 355 })
355 // 向服务器报告这个事情 356 // 向服务器报告这个事情
356 // TODO:::记录这个用户的推广过程。 357 // TODO:::记录这个用户的推广过程。
357 console.log('好物圈分享成功!', res) 358 console.log('好物圈分享成功!', res)
358 }, 359 },
359 fail: function (res) { 360 fail: function (res) {
360 console.log('好物圈分享失败!', res) 361 console.log('好物圈分享失败!', res)
361 }, 362 },
362 }) 363 })
363 } 364 }
364 }, 365 },
365 // 分享到朋友/圈 366 // 分享到朋友/圈
366 shareFriend() { 367 shareFriend() {
367 this.onShareAppMessage() 368 this.onShareAppMessage()
368 }, 369 },
369 // 朋友圈设置页面 370 // 朋友圈设置页面
370 onShareAppMessage() { 371 onShareAppMessage() {
371 let myName = this.$store.state.user.userInfo.nickName 372 let myName = this.$store.state.user.userInfo.nickName
372 if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') { 373 if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') {
373 myName = '【神秘人】' 374 myName = '【神秘人】'
374 } else { 375 } else {
375 myName = '【' + myName + '】' 376 myName = '【' + myName + '】'
376 } 377 }
377 return { 378 return {
378 title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等) 379 title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等)
379 path: '/pages/details/details?sid=0&pid=' + this.pid, 380 path: '/pages/details/details?sid=0&pid=' + this.shop_wood_id,
380 imageUrl: this.skuList[0].pic, // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 381 imageUrl: this.skuList[0].pic, // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
381 success: function (res) { 382 success: function (res) {
382 if (res.errMsg === 'shareAppMessage:ok') { 383 if (res.errMsg === 'shareAppMessage:ok') {
383 console.log('分享成功!', res) 384 console.log('分享成功!', res)
384 } 385 }
385 }, 386 },
386 fail: function (res) { 387 fail: function (res) {
387 if (res.errMsg === 'shareAppMessage:fail cancel') { 388 if (res.errMsg === 'shareAppMessage:fail cancel') {
388 console.log('fail', '放弃分享') 389 console.log('fail', '放弃分享')
389 } else if (res.errMsg === 'shareAppMessage:fail') { 390 } else if (res.errMsg === 'shareAppMessage:fail') {
390 console.log('fail', '分享失败') 391 console.log('fail', '分享失败')
391 } 392 }
392 }, 393 },
393 } 394 }
394 }, 395 },
395 // 生成海报 396 // 生成海报
396 sharePost() { 397 sharePost() {
397 const fromsid = this.$store.state.user.fromInfo.fromsid || 'undefined' 398 const fromsid = this.$store.state.user.fromInfo.fromsid || 'undefined'
398 399
399 store.dispatch('details/post', { 400 store.dispatch('details/post', {
400 pid: this.pid, 401 pid: this.pid,
401 sid: fromsid === 'undefined' ? 0 : fromsid, 402 sid: fromsid === 'undefined' ? 0 : fromsid,
402 }).then((data) => { 403 }).then((data) => {
403 uni.hideLoading() 404 uni.hideLoading()
404 this.$refs.uniPopupPost.open() 405 this.$refs.uniPopupPost.open()
405 }) 406 })
406 }, 407 },
407 // 参数选择弹窗开关 408 // 参数选择弹窗开关
408 showBottom(isCart) { 409 showBottom(isCart) {
409 this.isCart = isCart 410 this.isCart = isCart
410 this.isShowBottom = true 411 this.isShowBottom = true
411 }, 412 },
412 closeBottom() { 413 closeBottom() {
413 this.isShowBottom = false 414 this.isShowBottom = false
414 }, 415 },
415 // 前往购物车 416 // 前往购物车
416 toCart() { 417 toCart() {
417 uni.switchTab({ 418 uni.switchTab({
418 url: '/pages/cart/cart', 419 url: '/pages/cart/cart',
419 success: res => {}, 420 success: res => {},
420 fail: (error) => { console.log('跳转购物车失败======>', error) }, 421 fail: (error) => { console.log('跳转购物车失败======>', error) },
421 complete: () => { console.log('toCart') }, 422 complete: () => { console.log('toCart') },
422 }) 423 })
423 }, 424 },
424 // 加入购物车 425 // 加入购物车
425 addCart (mpId, num, checkedSKU, skId, price) { 426 addCart (mpId, num, checkedSKU, skId, price) {
426 const addCartList = {} 427 const addCartList = {}
427 addCartList.mp_id = mpId 428 addCartList.mp_id = mpId
428 addCartList.sk_id = skId 429 addCartList.sk_id = skId
429 addCartList.num = num 430 addCartList.num = num
430 // addCartList.checkedSKU = checkedSKU 431 // addCartList.checkedSKU = checkedSKU
431 addCartList.pid = this.pid 432 addCartList.shop_wood_id = this.shop_wood_id
432 addCartList.price = price 433 addCartList.price = price
433 console.log('添加购物车的参数', addCartList) 434 console.log('添加购物车的参数', addCartList)
434 store.dispatch('cart/addCart', addCartList).then((res) => { 435 store.dispatch('cart/addCart', addCartList).then((res) => {
435 if (res.code === 1) { 436 if (res.code === 1) {
436 uni.showToast({ 437 uni.showToast({
437 title: '添加成功~', 438 title: '添加成功~',
438 icon: 'success', 439 icon: 'success',
439 }) 440 })
440 } 441 }
441 // 再次请求购物车接口,实现实时更新 442 // 再次请求购物车接口,实现实时更新
442 store.dispatch('details/getCartNumber') 443 store.dispatch('details/getCartNumber')
443 }) 444 })
444 }, 445 },
445 }, 446 },
446 } 447 }
447 </script> 448 </script>
448 449
449 <style lang="scss"> 450 <style lang="scss">
450 .container { 451 .container {
451 background-color: #f8f8f8; 452 background-color: #f8f8f8;
452 font-family: "PingFangSC-Regular"; 453 font-family: "PingFangSC-Regular";
453 // 板块样式 454 // 板块样式
454 > view { 455 > view {
455 background: #ffffff; 456 background: #ffffff;
456 margin-bottom: 10px; 457 margin-bottom: 10px;
457 padding: 8px 20px 8px 20px; 458 padding: 8px 20px 8px 20px;
458 box-sizing: border-box; 459 box-sizing: border-box;
459 } 460 }
460 // 基础信息板块 461 // 基础信息板块
461 .basic_info { 462 .basic_info {
462 // 轮播图 463 // 轮播图
463 .swiperImage { 464 .swiperImage {
464 width: 684rpx; 465 width: 684rpx;
465 height: 480rpx; 466 height: 480rpx;
466 text-align: center; 467 text-align: center;
467 image { 468 image {
468 max-width: 100%; 469 max-width: 100%;
469 max-height: 100%; 470 max-height: 100%;
470 border-radius: 16rpx; 471 border-radius: 16rpx;
471 } 472 }
472 } 473 }
473 // 产品价格及购买人数 474 // 产品价格及购买人数
474 .info_pay { 475 .info_pay {
475 color: #eb5d3b; 476 color: #eb5d3b;
476 font-size: 18px; 477 font-size: 18px;
477 margin-top: 5px; 478 margin-top: 5px;
478 font-family: "PingFangSC-Semibold"; 479 font-family: "PingFangSC-Semibold";
479 display: flex; 480 display: flex;
480 justify-content: space-between; 481 justify-content: space-between;
481 .info_pay_discount { 482 .info_pay_discount {
482 text-decoration: line-through; 483 text-decoration: line-through;
483 margin-left: 8rpx; 484 margin-left: 8rpx;
484 color: #999; 485 color: #999;
485 font-size: 14px; 486 font-size: 14px;
486 } 487 }
487 .info_pay_number { 488 .info_pay_number {
488 color: #999; 489 color: #999;
489 font-size: 14px; 490 font-size: 14px;
490 font-family: PingFangSC-Regular; 491 font-family: PingFangSC-Regular;
491 } 492 }
492 } 493 }
493 // 产品名称 494 // 产品名称
494 .info_name { 495 .info_name {
495 margin-top: 5px; 496 margin-top: 5px;
496 display: flex; 497 display: flex;
497 justify-content: space-between; 498 justify-content: space-between;
498 .info_name_name { 499 .info_name_name {
499 margin-right: 10px; 500 margin-right: 10px;
500 font-size: 16px; 501 font-size: 16px;
501 font-family: "PingFangSC-Semibold"; 502 font-family: "PingFangSC-Semibold";
502 max-width: 592rpx; 503 max-width: 592rpx;
503 } 504 }
504 .info_name_share { 505 .info_name_share {
505 display: flex; 506 display: flex;
506 flex-direction: column; 507 flex-direction: column;
507 justify-content: space-between; 508 justify-content: space-between;
508 align-items: center; 509 align-items: center;
509 margin-top: 14rpx; 510 margin-top: 14rpx;
510 > image { 511 > image {
511 height: 40rpx; 512 height: 40rpx;
512 width: 40rpx; 513 width: 40rpx;
513 } 514 }
514 > text { 515 > text {
515 font-family: PingFangSC-Regular; 516 font-family: PingFangSC-Regular;
516 font-size: 12px; 517 font-size: 12px;
517 color: #999; 518 color: #999;
518 letter-spacing: -0.23px; 519 letter-spacing: -0.23px;
519 } 520 }
520 } 521 }
521 } 522 }
522 // 售后服务 523 // 售后服务
523 .info_after { 524 .info_after {
524 font-size: 10px; 525 font-size: 10px;
525 color: #999; 526 color: #999;
526 margin-top: 20rpx; 527 margin-top: 20rpx;
527 > span { 528 > span {
528 height: 14px; 529 height: 14px;
529 margin-right: 10px; 530 margin-right: 10px;
530 } 531 }
531 } 532 }
532 } 533 }
533 // 详细信息 534 // 详细信息
534 .detail_info { 535 .detail_info {
535 margin-bottom: 20rpx; 536 margin-bottom: 20rpx;
536 .screen_bar { 537 .screen_bar {
537 width: 670rpx; 538 width: 670rpx;
538 margin-top: 20rpx; 539 margin-top: 20rpx;
539 margin-bottom: 24rpx; 540 margin-bottom: 24rpx;
540 display: flex; 541 display: flex;
541 flex-direction: row; 542 flex-direction: row;
542 justify-content: space-between; 543 justify-content: space-between;
543 align-items: center; 544 align-items: center;
544 font-size: 14px; 545 font-size: 14px;
545 color: #333333; 546 color: #333333;
546 transition: all 0.2s; 547 transition: all 0.2s;
547 } 548 }
548 .item_active { 549 .item_active {
549 border-bottom: 4rpx solid #ff6b4a; 550 border-bottom: 4rpx solid #ff6b4a;
550 } 551 }
551 .screen_item { 552 .screen_item {
552 font-size: 32rpx; 553 font-size: 32rpx;
553 color: #333333; 554 color: #333333;
554 display: flex; 555 display: flex;
555 transition: all 0.2s; 556 transition: all 0.2s;
556 // 规格参数 557 // 规格参数
557 .specification { 558 .specification {
558 margin-bottom: 4px; 559 margin-bottom: 4px;
559 .spe_item { 560 .spe_item {
560 image { 561 image {
561 width: 50px; 562 width: 50px;
562 height: 25px; 563 height: 25px;
563 margin-right: 6px; 564 margin-right: 6px;
564 vertical-align: middle; 565 vertical-align: middle;
565 } 566 }
566 span { 567 span {
567 margin-left: 24rpx; 568 margin-left: 24rpx;
568 } 569 }
569 } 570 }
570 } 571 }
571 } 572 }
572 // 573 //
573 } 574 }
574 // 宝贝好评率 575 // 宝贝好评率
575 .evaluate { 576 .evaluate {
576 .evaluate_title { 577 .evaluate_title {
577 font-size: 14px; 578 font-size: 14px;
578 color: #333333; 579 color: #333333;
579 display: flex; 580 display: flex;
580 justify-content: space-between; 581 justify-content: space-between;
581 .title_rate { 582 .title_rate {
582 margin-left: 10rpx; 583 margin-left: 10rpx;
583 } 584 }
584 .evaluate_star { 585 .evaluate_star {
585 width: 90px; 586 width: 90px;
586 display: flex; 587 display: flex;
587 align-items: center; 588 align-items: center;
588 justify-content: space-between; 589 justify-content: space-between;
589 } 590 }
590 view { 591 view {
591 font-size: 14px; 592 font-size: 14px;
592 color: #333333; 593 color: #333333;
593 font-weight: bold; 594 font-weight: bold;
594 } 595 }
595 } 596 }
596 .evaluate_tag { 597 .evaluate_tag {
597 view { 598 view {
598 display: inline-block; 599 display: inline-block;
599 margin-right: 20rpx; 600 margin-right: 20rpx;
600 min-width: 180rpx; 601 min-width: 180rpx;
601 margin-top: 10px; 602 margin-top: 10px;
602 height: 48rpx; 603 height: 48rpx;
603 background: #f2f2f2; 604 background: #f2f2f2;
604 border-radius: 2px; 605 border-radius: 2px;
605 font-family: PingFangSC-Regular; 606 font-family: PingFangSC-Regular;
606 font-size: 12px; 607 font-size: 12px;
607 color: #666666; 608 color: #666666;
608 letter-spacing: -0.23px; 609 letter-spacing: -0.23px;
609 text-align: center; 610 text-align: center;
610 padding: 0 48rpx; 611 padding: 0 48rpx;
611 line-height: 48rpx; 612 line-height: 48rpx;
612 } 613 }
613 } 614 }
614 } 615 }
615 // 商品详情 616 // 商品详情
616 .more_info { 617 .more_info {
617 .more_fixed1 { 618 .more_fixed1 {
618 display: flex; 619 display: flex;
619 justify-content: space-between; 620 justify-content: space-between;
620 align-content: center; 621 align-content: center;
621 margin-bottom: 12px; 622 margin-bottom: 12px;
622 view { 623 view {
623 font-size: 14px; 624 font-size: 14px;
624 color: #333333; 625 color: #333333;
625 font-weight: bold; 626 font-weight: bold;
626 font-family: "PingFangSC-Medium"; 627 font-family: "PingFangSC-Medium";
627 line-height: 24px; 628 line-height: 24px;
628 } 629 }
629 image { 630 image {
630 width: 240rpx; 631 width: 240rpx;
631 height: 3px; 632 height: 3px;
632 margin-top: 10px; 633 margin-top: 10px;
633 } 634 }
634 } 635 }
635 .more_all { 636 .more_all {
636 width: 100%; 637 width: 100%;
637 margin-top: 30rpx; 638 margin-top: 30rpx;
638 margin-right: 30rpx; 639 margin-right: 30rpx;
639 margin-bottom: 180rpx; 640 margin-bottom: 180rpx;
640 font-family: "PingFangSC-Regular"; 641 font-family: "PingFangSC-Regular";
641 } 642 }
642 } 643 }
643 // 菜单 644 // 菜单
644 .menu { 645 .menu {
645 position: fixed; 646 position: fixed;
646 bottom: 0; 647 bottom: 0;
647 min-height: 74px; 648 min-height: 74px;
648 width: 100%; 649 width: 100%;
649 background: #ffffff; 650 background: #ffffff;
650 padding: 20px 20px 8px 20px; 651 padding: 20px 20px 8px 20px;
651 font-family: "PingFangSC-Regular"; 652 font-family: "PingFangSC-Regular";
652 box-sizing: border-box; 653 box-sizing: border-box;
653 display: flex; 654 display: flex;
654 justify-content: space-between; 655 justify-content: space-between;
655 align-content: center; 656 align-content: center;
656 margin: 0; 657 margin: 0;
657 /* iphonex 等安全区设置,底部安全区适配 */ 658 /* iphonex 等安全区设置,底部安全区适配 */
658 /* #ifndef APP-NVUE */ 659 /* #ifndef APP-NVUE */
659 padding-bottom: constant(safe-area-inset-bottom); 660 padding-bottom: constant(safe-area-inset-bottom);
660 padding-bottom: env(safe-area-inset-bottom); 661 padding-bottom: env(safe-area-inset-bottom);
661 .menu_1 { 662 .menu_1 {
662 width: 20%; 663 width: 20%;
663 height: 100%; 664 height: 100%;
664 text-align: center; 665 text-align: center;
665 color: #989898; 666 color: #989898;
666 .cart_icon { 667 .cart_icon {
667 position: relative; 668 position: relative;
668 text { 669 text {
669 position: absolute; 670 position: absolute;
670 color: white; 671 color: white;
671 font-size: 17px; 672 font-size: 17px;
672 background-color: red; 673 background-color: red;
673 min-height: 24px; 674 min-height: 24px;
674 min-width: 24px; 675 min-width: 24px;
675 line-height: 24px; 676 line-height: 24px;
676 right: -12%; 677 right: -12%;
677 top: -12px; 678 top: -12px;
678 text-align: center; 679 text-align: center;
679 border-radius: 24px; 680 border-radius: 24px;
680 padding: 2px; 681 padding: 2px;
681 } 682 }
682 } 683 }
683 } 684 }
684 image { 685 image {
685 width: 42%; 686 width: 42%;
686 height: 26px; 687 height: 26px;
687 } 688 }
688 .menu_image { 689 .menu_image {
689 font-size: 12px; 690 font-size: 12px;
690 text-align: center; 691 text-align: center;
691 } 692 }
692 .menu_2 { 693 .menu_2 {
693 width: 74%; 694 width: 74%;
694 height: 80rpx; 695 height: 80rpx;
695 display: grid; 696 display: grid;
696 grid-template-columns: 50% 50%; 697 grid-template-columns: 50% 50%;
697 } 698 }
698 .menu_input { 699 .menu_input {
699 display: inline-flex; 700 display: inline-flex;
700 align-items: center; 701 align-items: center;
701 justify-content: space-around; 702 justify-content: space-around;
702 background: #fff0ec; 703 background: #fff0ec;
703 font-size: 16px; 704 font-size: 16px;
704 color: #ff6b4a; 705 color: #ff6b4a;
705 border-radius: 20px 0 0 20px; 706 border-radius: 20px 0 0 20px;
706 } 707 }
707 .menu_now { 708 .menu_now {
708 display: inline-flex; 709 display: inline-flex;
709 align-items: center; 710 align-items: center;
710 justify-content: space-around; 711 justify-content: space-around;
711 background: #ff6b4a; 712 background: #ff6b4a;
712 font-size: 16px; 713 font-size: 16px;
713 color: #ffffff; 714 color: #ffffff;
714 border-radius: 0 20px 20px 0; 715 border-radius: 0 20px 20px 0;
715 } 716 }
716 } 717 }
717 /* #endif */ 718 /* #endif */
718 719
719 } 720 }
720 </style> 721 </style>
721 722
src/pages/myOrder/components/OrderCard.vue
1 <template> 1 <template>
2 <view> 2 <view>
3 <view 3 <view class="card" v-if="current == '200000' ">
4 class="card"
5 v-if="current == status"
6
7 >
8 <view class="cardHeader">
9 <text
10 class="orderId"
11 v-if="status == '0'||status == '1'"
12 >订单号:{{order.pay_id}}</text>
13 <text
14 class="orderId"
15 v-if="status == '2'||status == '3'"
16 >下单时间:{{order.pay_time}}</text>
17 <text
18 class="orderType"
19 v-if="status=='0'"
20 >待付款</text>
21 <text
22 class="orderType"
23 v-if="status=='1'"
24 >待收货</text>
25 <text
26 class="orderType"
27 v-if="status == '2'||status == '3'"
28 >已完成</text>
29 <!-- <text class="orderType" v-if="status == '3'">已评价</text> -->
30 </view>
31 <view
32 class="orderCardInfo"
33 @click="toOrderInfo(status,order.pay_id)"
34 v-for="(orderInfo, index) in orderInfoList"
35 :key="index"
36 >
37 <image
38 :src="orderInfo.imgUrl"
39 mode="aspectFill"
40 ></image>
41 <view class="infoText">
42 <view class="orderName">{{orderInfo.p_name}}</view>
43 <view class="orderDescrib">{{orderInfo.p_name}}</view>
44 <view class="infoText-bottom">
45 <view class="markPrice">{{orderInfo.nowPrice}}</view>
46 <view class="buy-num">X {{orderInfo.num}}</view>
47 </view>
48 </view>
49 </view>
50 <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view>
51 <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 -->
52 <view
53 class="btns"
54 v-if="status == '0'"
55 >
56 <view class="btn-type1" @click="cancleOrder">取消订单</view>
57 <view class="btn-type2" @click="paylog">去支付</view>
58 </view>
59 <view
60 class="btns"
61 v-if="status == '1'"
62 >
63 <view class="btn-type2">确认收货</view>
64 </view>
65 <view
66 class="btns"
67 v-if="status == '2'"
68 >
69 <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view>
70 </view>
71 <!-- <view class="btns" v-if="status == '3'">
72 <view class="btn-type2">再次购买</view>
73 </view> -->
74 </view>
75 <view class="card" v-if="current == '10'" >
76 <view class="cardHeader"> 4 <view class="cardHeader">
77 <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.pay_id}}</text> 5 <text class="orderId" v-if="order_status == '0'||order_status == '100000'">订单号:{{order.order_no}}</text>
78 <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> 6 <text class="orderId"
79 <text class="orderType" v-if="status=='0'">待付款</text> 7 v-if="order_status == '200000'||order_status == '300000'">下单时间:{{order.order_time}}</text>
80 <text class="orderType" v-if="status=='1'">待收货</text> 8 <text class="orderType" v-if="order_status=='100000'">待付款</text>
81 <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> 9 <text class="orderType" v-if="order_status=='200000'">待收货</text>
82 <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> 10 <text class="orderType" v-if="order_status == '200000'||order_status == '300000'">已完成</text>
11 <text class="orderType" v-if="order_status == '300000'">已评价</text>
83 </view> 12 </view>
84 <view class="orderCardInfo" @click="toOrderInfo(status,order.pay_id)" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> 13 <view class="orderCardInfo" @click="toOrderInfo(order_status, order.order_id)"
85 <image :src="orderInfo.imgUrl" mode="aspectFill"></image> 14 v-for="(orderInfo, index) in orderInfoList" :key="index">
15 <!-- -->
16 <image :src="orderInfo.img" mode="aspectFill"></image>
86 <view class="infoText"> 17 <view class="infoText">
87 <view class="orderName">{{orderInfo.p_name}}</view> 18 <view class="orderName">{{orderInfo.wsp_sku_name}}--1</view>
88 <view class="orderDescrib">{{orderInfo.p_name}}</view> 19 <view class="orderDescrib">{{orderInfo.wsp_sku_name}}</view>
89 <view class="infoText-bottom"> 20 <view class="infoText-bottom">
90 <view class="markPrice">{{orderInfo.nowPrice}}</view> 21 <view class="markPrice">{{orderInfo.price}}</view>
91 <view class="buy-num">X {{orderInfo.num}}</view> 22 <view class="buy-num">X {{orderInfo.num}}</view>
92 </view> 23 </view>
93 </view> 24 </view>
94 </view> 25 </view>
95 <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> 26 <view class="payPrice">总额:<text class="priceNum">{{orderObj.all_money}}</text>,优惠:<text class="priceNum">{{orderObj.reduce_all_price}}</text>,实付:<text class="priceNum">{{orderObj.final_money}}</text> </view>
96 <view class="btns" v-if="status == '0'"> 27 <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 -->
97 <view class="btn-type1" @click="cancleOrder">取消订单</view> 28 <view class="btns" v-if="order_status == '0'">
29 <view class="btn-type1" @click="cancleOrder">取消订单</view>
98 <view class="btn-type2" @click="paylog">去支付</view> 30 <view class="btn-type2" @click="paylog">去支付</view>
99 </view> 31 </view>
100 <view class="btns" v-if="status == '1'"> 32 <view class="btns" v-if="order_status == '1'">
101 <view class="btn-type2">确认收货</view> 33 <view class="btn-type2">确认收货</view>
102 </view> 34 </view>
103 <view class="btns" v-if="status == '2'||status == '3'"> 35 <view class="btns" v-if="order_status == '2'">
36 <view class="btn-type2" @click="toDetail(orderObj.order_detail.sku_arr[0].shop_wood_id)">再次购买</view>
37 </view>
38
39 </view>
40 <view class="card" v-if="current == '100000'">
41 <view class="cardHeader">
42 <text class="orderId">订单号:{{order.order_no}}</text>
43 <text class="orderId"
44 v-if="order_status == '200000'||order_status == '300000'">下单时间:{{order.order_time}}</text>
45 <text class="orderType" v-if="order_status=='100000'">待付款</text>
46 <text class="orderType" v-if="order_status=='200000'">待收货</text>
47 <text class="orderType" v-if="order_status == '200000'||order_status == '300000'">已完成</text>
48 <!-- <text class="orderType" v-if="order_status == '3'">已评价</text> -->
49 </view>
50 <view class="orderCardInfo" @click="toOrderInfo(order_status, order.order_id)"
51 v-for="(orderInfo) in orderInfoList">
52 <image :src="orderInfo.img" mode="aspectFill"></image>
53 <view class="infoText">
54 <view class="orderName">{{orderInfo.wsp_sku_name}}</view>
55 <view class="orderDescrib">{{orderInfo.wsp_sku_name}}</view>
56 <view class="infoText-bottom">
57 <view class="markPrice">{{orderInfo.price}}</view>
58 <view class="buy-num">X {{orderInfo.num}}</view>
59 </view>
60 </view>
61 </view>
62 <view class="payPrice">总额:<text class="priceNum">{{orderObj.all_money}}</text>,优惠:<text class="priceNum">{{orderObj.reduce_all_price}}</text>,实付:<text class="priceNum">{{orderObj.final_money}}</text> </view>
63 <!-- <view class="payPrice">实付:<text class="priceNum">{{orderObj.final_money}}</text> </view> -->
64 <view class="btns" v-if="order_status == '100000'">
65 <view class="btn-type1" @click="cancleOrder">取消订单</view>
66 <view class="btn-type2" @click="paylog">去支付</view>
67 </view>
68 <view class="btns" v-if="order_status == '200000'">
69 <view class="btn-type1">确认收货</view>
70 </view>
71 <view class="btns" v-if="order_status == '200000'||order_status == '300000'">
72 <!-- <view class="btn-type1" v-if="order_status == '200000'" @click="toDetail(order.order_info[0].pid)">确认收货</view> -->
104 <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> 73 <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view>
105 </view> 74 </view>
106 </view> 75 </view>
107 </view> 76 </view>
108 </template> 77 </template>
109 78
110 <script> 79 <script>
111 import MD5Util from '../../../utils/md5' 80 import MD5Util from '../../../utils/md5'
112 import store from "@/store"; 81 import store from "@/store";
113 export default { 82 export default {
114 data() { 83 data() {
115 return { 84 return {
116 85 orderObj:JSON.parse(this.order.order_data_obj)
117 }; 86 };
118 }, 87 },
119 props: { 88 props: {
120 /** 89 /**
121 * 订单数据 90 * 订单数据
122 */ 91 */
123 order: {}, 92 order: {},
124 /** 93 /**
125 * 当前选择 94 * 当前选择
126 */ 95 */
127 current:Number 96 current: String
128 97
129 }, 98 },
130 created() { 99 created() {
131 console.log('order',this.order); 100 console.error('order',this.order);
101 // let a = ;
102 // this.order = JSON.parse(this.order.order_data_obj);
132 // console.log(this.order.status ); 103 // console.log(this.order.status );
133 // console.log(this.current); 104 // console.log(this.current);
134 }, 105 },
135 computed:{ 106 computed: {
136 status(){ 107 order_status() {
137 return this.order.status 108 return this.order.order_status
138 }, 109 },
139 orderInfoList(){ 110 // orderObj(){
140 return this.order.order_info 111
112 // return a;
113 // },
114 orderInfoList() {
115 let a = JSON.parse(this.order.order_data_obj);
116 console.log('orderInfoList=====>', a)
117 // return JSON.parse(this.order.order_info)
118 return a.order_detail.sku_arr;
141 } 119 }
142 }, 120 },
143 methods:{ 121 methods: {
144 async paylog() { 122 async paylog() {
145 const openid = uni.getStorageSync('openid') 123 const openid = uni.getStorageSync('openid')
146 const uid = this.order.uid; 124 const uid = this.order.uid;
147 //先拿订单详情 125 //先拿订单详情
148 await store.dispatch('orderRead/getOrderInfo', { 126 await store.dispatch('orderRead/getOrderInfo', {
149 pay_id: this.order.pay_id, 127 pay_id: this.order.order_id,
150 uid: uid, 128 uid: uid,
151 openid: openid 129 openid: openid
152 }).then((res)=>{ 130 }).then((res) => {
153 // console.log(res) 131 // console.log(res)
154 const { data, exKeyName: keyName } = res.order_info 132 const {
155 const timeStamp = new Date().getTime().toString() 133 data,
156 const total_fee = res.total_fee 134 exKeyName: keyName
157 const payId = res.pay_id 135 } = res.order_info
158 const nonceStr = 'asfafasfasfasfasf' 136 const timeStamp = new Date().getTime().toString()
159 // 支付参数 137 const total_fee = res.total_fee
160 const fieldSet = { 138 const payId = res.pay_id
161 openid: openid, 139 const nonceStr = 'asfafasfasfasfasf'
162 uid: uid, 140 // 支付参数
163 shopid: 0, 141 const fieldSet = {
164 payCate: 2020, 142 openid: openid,
165 payMoney: total_fee, 143 uid: uid,
166 payWoodId: `fcdj-${uid}-${keyName}`, 144 shopid: 0,
167 payWoodDesc: '在【非常戴镜】的微信付款凭证', 145 payCate: 2020,
168 nonceStr, 146 payMoney: total_fee,
169 signType: 'MD5', 147 payWoodId: `fcdj-${uid}-${keyName}`,
170 app_uid: 2020, 148 payWoodDesc: '在【非常戴镜】的微信付款凭证',
171 timeStamp, 149 nonceStr,
172 keyname: keyName, 150 signType: 'MD5',
173 billInfo: JSON.stringify(data), 151 app_uid: 2020,
174 } 152 timeStamp,
175 // 请求后台支付接口 153 keyname: keyName,
176 store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { 154 billInfo: JSON.stringify(data),
177 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { 155 }
178 const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` 156 // 请求后台支付接口
179 const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' 157 store.dispatch('order/pay', fieldSet).then(({
180 158 data,
181 // 微信支付接口 159 data2,
182 uni.requestPayment({ 160 pay_id: payId
183 appId: data.appid, 161 }) => {
184 timeStamp, 162 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') {
185 nonceStr, 163 const stringA =
186 total_fee: total_fee, 164 `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}`
187 package: `prepay_id=${data.prepay_id}`, 165 const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789'
188 signType: 'MD5', 166
189 paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), 167 // 微信支付接口
190 success: (res) => { 168 uni.requestPayment({
191 // 支付成功 169 appId: data.appid,
192 uni.showModal({ 170 timeStamp,
193 content: '支付成功', 171 nonceStr,
194 showCancel: false, 172 total_fee: total_fee,
195 }) 173 package: `prepay_id=${data.prepay_id}`,
196 // //修改订单状态 待付款==>待收货 174 signType: 'MD5',
197 // store.dispatch("statusConfirm/confirm", { 175 paySign: MD5Util.MD5(stringSignTemp).toUpperCase(),
198 // uid: this.uid, 176 success: (res) => {
199 // openid: this.openid, 177 // 支付成功
200 // oldway: "0", 178 uni.showModal({
201 // way: "1", 179 content: '支付成功',
202 // pay_id: payId, 180 showCancel: false,
203 // judgeContent: "", 181 })
204 // orderInfo: this.orderInfo.order_info 182 // //修改订单状态 待付款==>待收货
205 // }) 183 // store.dispatch("statusConfirm/confirm", {
206 }, 184 // uid: this.uid,
207 fail: (res) => { 185 // openid: this.openid,
208 // 支付失败 186 // oldway: "0",
209 uni.showModal({ 187 // way: "1",
210 content: '支付失败', 188 // pay_id: payId,
211 showCancel: false, 189 // judgeContent: "",
212 }) 190 // orderInfo: this.orderInfo.order_info
213 }, 191 // })
214 complete: () => { 192 },
215 uni.hideLoading() 193 fail: (res) => {
216 }, 194 // 支付失败
217 }) 195 uni.showModal({
218 } else { 196 content: '支付失败',
219 uni.showModal({ 197 showCancel: false,
220 content: '支付失败', 198 })
221 showCancel: false, 199 },
222 }) 200 complete: () => {
223 console.log('支付失败') 201 uni.hideLoading()
224 uni.hideLoading() 202 },
225 } 203 })
226 }) 204 } else {
205 uni.showModal({
206 content: '支付失败',
207 showCancel: false,
208 })
209 console.log('支付失败')
210 uni.hideLoading()
211 }
212 })
227 //修改订单状态 待付款==>待收货 213 //修改订单状态 待付款==>待收货
228 // store.dispatch("statusConfirm/confirm", { 214 // store.dispatch("statusConfirm/confirm", {
229 // uid: this.uid, 215 // uid: this.uid,
230 // openid: this.openid, 216 // openid: this.openid,
231 // oldway: "0", 217 // oldway: "0",
232 // way: "1", 218 // way: "1",
233 // pay_id: this.payId, 219 // pay_id: this.payId,
234 // judgeContent: "", 220 // judgeContent: "",
235 // orderInfo: this.orderInfo.order_info 221 // orderInfo: this.orderInfo.order_info
236 // }) 222 // })
237 }) 223 })
238 }, 224 },
239 225
240 async cancleOrder(e) { 226 async cancleOrder(e) {
241 const openid = uni.getStorageSync('openid') 227 const openid = uni.getStorageSync('openid')
242 const uid = this.order.uid; 228 const uid = this.order.uid;
243 //先从订单详情中拿到keyname 229 //先从订单详情中拿到keyname
244 await store.dispatch('orderRead/getOrderInfo', { 230 await store.dispatch('orderRead/getOrderInfo', {
245 pay_id: this.order.pay_id, 231 pay_id: this.order.pay_id,
246 uid: uid, 232 uid: uid,
247 openid: openid 233 openid: openid
248 }).then((res)=>{ 234 }).then((res) => {
249 const keyname = res.order_info.keyname 235 const keyname = res.order_info.keyname
250 uni.showModal({ 236 uni.showModal({
251 title: "提示", 237 title: "提示",
252 content: "现在取消,订单不可恢复哦,确认取消吗?", 238 content: "现在取消,订单不可恢复哦,确认取消吗?",
253 success: function(res) { 239 success: function(res) {
254 if (res.confirm) { 240 if (res.confirm) {
255 store.dispatch("cancelOrder/cancel", { 241 store.dispatch("cancelOrder/cancel", {
256 keyname: keyname, 242 keyname: keyname,
257 uid: uid, 243 uid: uid,
258 openid: openid 244 openid: openid
259 }).then((res)=>{ 245 }).then((res) => {
260 console.log(res) 246 console.log(res)
261 if(res.code == 1){ 247 if (res.code == 1) {
262 store.dispatch("myOrder/getList", { 248 store.dispatch("myOrder/getList", {
263 way: "" 249 way: ""
250 });
251 } else {
252 uni.showToast({
253 title: '取消失败,服务器错误!',
254 icon: 'none'
255 })
256 }
264 }); 257 });
265 }else{ 258 } else if (res.cancel) {
266 uni.showToast({ 259 console.log("用户点击取消");
267 title:'取消失败,服务器错误!',
268 icon:'none'
269 })
270 } 260 }
271 }); 261 }
272 } else if (res.cancel) { 262 });
273 console.log("用户点击取消"); 263 });
274 } 264
275 }
276 });
277 });
278
279 }, 265 },
280 toDetail(pid){ 266 toDetail(pid) {
281 console.log('pid',pid) 267 console.log('pid', pid)
282 uni.navigateTo({ 268 uni.navigateTo({
283 url: '../details/details?pid='+pid, 269 url: '../details/details?pid=' + pid,
284 fail: (res) => {console.log(res)}, 270 fail: (res) => {
271 console.log(res)
272 },
285 }); 273 });
286 }, 274 },
287 toRefundment(){ 275 toRefundment() {
288 uni.navigateTo({ 276 uni.navigateTo({
289 url: '../refundment/refundment', 277 url: '../refundment/refundment',
290 success: res => {}, 278 success: res => {},
291 fail: () => {}, 279 fail: () => {},
292 complete: () => {} 280 complete: () => {}
293 }); 281 });
294 }, 282 },
295 toOrderInfo(status,payId){ 283 toOrderInfo(status, payId) {
296 console.log(status,payId) 284 console.log(status, payId)
297 switch(status){ 285 switch (status) {
298 // 0待付款 1待收货 2已收货 3 已评价 286 // 0待付款 1待收货 2已收货 3 已评价
299 case '0': 287 case '100000':
300 uni.navigateTo({
301 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId,
302 fail(errMsg) {
303 console.log(errMsg)
304 }
305 })
306 break;
307 case '1':
308 uni.navigateTo({ 288 uni.navigateTo({
309 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, 289 url: `../myOrderPaying/myOrderPaying?status=` + status + `&payId=` + payId,
310 fail(errMsg) { 290 fail(errMsg) {
311 console.log(errMsg) 291 console.log(errMsg)
312 } 292 }
313 }) 293 })
314 294 break;
315 break; 295 case '200000':
316 case '2' || '3':
317 uni.navigateTo({ 296 uni.navigateTo({
318 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, 297 url: `../myOrderPaying/myOrderPaying?status=` + status + `&payId=` + payId,
319 fail(errMsg) { 298 fail(errMsg) {
320 console.log(errMsg) 299 console.log(errMsg)
321 } 300 }
322 }) 301 })
323 break; 302
303 break;
304 // case '200000' || '300000':
305 // uni.navigateTo({
306 // url: `../myOrderPaying/myOrderPaying?status=` + status + `&payId=` + payId,
307 // fail(errMsg) {
308 // console.log(errMsg)
309 // }
310 // })
311 // break;
324 default: 312 default:
325 break; 313 break;
326 314
327 } 315 }
328 } 316 }
329 } 317 }
330 } 318 }
331
332 </script> 319 </script>
333 320
334 <style lang="scss"> 321 <style lang="scss">
335 .card { 322 .card {
336 width: 670rpx; 323 width: 670rpx;
337 // height: 478rpx; 324 // height: 478rpx;
338 background: #ffffff; 325 background: #ffffff;
339 box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06); 326 box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06);
340 border-radius: 8px; 327 border-radius: 8px;
341 border-radius: 8px; 328 border-radius: 8px;
342 margin-top: 20rpx; 329 margin-top: 20rpx;
343 padding: 40rpx; 330 padding: 40rpx;
344 box-sizing: border-box; 331 box-sizing: border-box;
345 .cardHeader { 332
346 width: 100%; 333 .cardHeader {
347 height: 40rpx; 334 width: 100%;
348 display: flex; 335 height: 40rpx;
349 justify-content: space-between; 336 display: flex;
350 align-items: center; 337 justify-content: space-between;
351 .orderId { 338 align-items: center;
352 font-size: 12px; 339
353 color: #999999; 340 .orderId {
354 } 341 font-size: 12px;
355 .orderType { 342 color: #999999;
356 font-size: 14px; 343 }
357 color: #ff6b4a; 344
358 } 345 .orderType {
359 } 346 font-size: 14px;
360 .orderCardInfo { 347 color: #ff6b4a;
361 width: 100%; 348 }
362 height: 188rpx; 349 }
363 display: flex; 350
364 flex-direction: row; 351 .orderCardInfo {
365 justify-content: space-between; 352 width: 100%;
366 align-items: center; 353 height: 188rpx;
367 margin-top: 40rpx; 354 display: flex;
368 image { 355 flex-direction: row;
369 height: 188rpx; 356 border: 1px #000 solid;
370 width: 188rpx; 357 justify-content: space-between;
371 margin-right: 24rpx; 358 align-items: center;
372 } 359 margin-top: 40rpx;
373 .infoText { 360
374 display: flex; 361 image {
375 flex-direction: column; 362 height: 188rpx;
376 justify-content: space-between; 363 width: 188rpx;
377 align-items: flex-start; 364 margin-right: 24rpx;
378 height: 188rpx; 365 }
379 width: 368rpx; 366
380 } 367 .infoText {
381 .orderName { 368 display: flex;
382 font-size: 14px; 369 flex-direction: column;
383 color: #333333; 370 justify-content: space-between;
384 display: -webkit-box; 371 align-items: flex-start;
385 overflow: hidden; 372 height: 188rpx;
386 -webkit-box-orient: vertical; 373 width: 368rpx;
387 -webkit-line-clamp: 2; 374 }
388 } 375
src/pages/myOrder/myOrder.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 class="searchIpt" placeholder="搜索订单关键字..." confirm-type="search" />
8 </view> --> 8 </view>
9 <view class="screenBar"> 9 <view class="screenBar">
10 <view 10 <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)">
11 v-for="item in screenItems" 11 <view class="screenItem" v-bind:class="{ active: current === item.current }">{{ item.text }}</view>
12 :key="item.current" 12 </view>
13 @click="onClickItem(item.current)" 13 </view>
14 > 14 </view>
15 <view 15 <view class="orderList">
16 class="screenItem" 16 <view v-for="(order) in orderList" :key="order.order_id">
17 v-bind:class="{ active: current === item.current }" 17 <OrderCard :order="order" :current="current" v-if="order.order_info !== null"></OrderCard>
18 >{{ item.text }}</view> 18 </view>
19 </view> 19 </view>
20 </view> 20 <view class="footer">没有更多订单了,去商城看看吧~</view>
21 </view> 21 </view>
22 <view class="orderList">
23 <view
24 v-for="(order) in orderList"
25 :key="order.pay_id"
26 >
27 <OrderCard
28 :order="order"
29 :current="current"
30 v-if="order.order_info !== null"
31 ></OrderCard>
32 </view>
33 </view>
34 <view class="footer">没有更多订单了,去商城看看吧~</view>
35 </view>
36 </template> 22 </template>
37 <script> 23 <script>
38 import OrderCard from "./components/OrderCard.vue"; 24 import OrderCard from "./components/OrderCard.vue";
39 import store from "@/store"; 25 import store from "@/store";
40 26
41 export default { 27 export default {
42 components: { 28 components: {
43 OrderCard: OrderCard 29 OrderCard: OrderCard
44 }, 30 },
45 data() { 31 data() {
46 return { 32 return {
47 // 顶部筛选项 33 // 顶部筛选项
48 screenItems: [ 34 screenItems: [{
49 { current: "10", text: "全部" }, 35 current: "0",
50 { current: "0", text: "待付款" }, 36 text: "全部"
51 { current: "1", text: "待收货" }, 37 },
52 { current: "2", text: "已完成" } 38 {
53 // {current:"3",text:'已评价'}, 39 current: "100000",
54 // {current:"4",text:'退款'}, 40 text: "待付款"
55 ], 41 },
56 // 当前所在item 默认10-->全部 42 {
57 current: "10" 43 current: "200000",
58 }; 44 text: "待收货"
59 }, 45 },
46 {
47 current: "300000",
48 text: "已完成"
49 }, {
50 current: "400000",
51 text: '已评价'
52 },
53 {
54 current: "500000",
55 text: '退款'
56 },
57 ],
58 // 当前所在item 默认10-->全部
59 current: "100000"
60 };
61 },
60 62
61 onShow() { 63 onShow() {
62 store.dispatch("myOrder/getList", { 64 store.dispatch("myOrder/getList", {
63 way: "" 65 way: ""
64 }); 66 });
65 }, 67 },
66 onLoad: function(option) { 68 onLoad: function(option) {
67 // 获取订单列表 69 // 获取订单列表
68 // store.dispatch("myOrder/getList", { 70 // store.dispatch("myOrder/getList", {
69 // way: "" 71 // way: ""
70 // }); 72 // });
71 // 从user过来传的status,给current,以显示对应item 73 // 从user过来传的status,给current,以显示对应item
72 this.current = option.status; 74 this.current = option.status;
73 }, 75 },
74 computed: { 76 computed: {
75 orderList() { 77 orderList() {
76 console.log('orderList', this.$store.state.myOrder.orderList); 78 console.log('orderList', this.$store.state.myOrder.orderList);
77 return this.$store.state.myOrder.orderList; 79 return this.$store.state.myOrder.orderList;
78 } 80 }
79 }, 81 },
80 methods: { 82 methods: {
81 // tab点击事件 83 // tab点击事件
82 onClickItem(e) { 84 onClickItem(e) {
83 if (this.current !== e) { 85 if (this.current !== e) {
84 this.current = e; 86 this.current = e;
85 } 87 }
86 } 88 }
87 } 89 }
88 }; 90 };
89 </script> 91 </script>
90 92
91 <style lang="scss"> 93 <style lang="scss">
92 .content { 94 .content {
93 display: flex; 95 display: flex;
94 flex-direction: column; 96 flex-direction: column;
95 align-items: center; 97 align-items: center;
96 background-color: #f7f6f6; 98 background-color: #f7f6f6;
97 min-height: 100vh; 99 min-height: 100vh;
98 .header {
99 background-color: #ffffff;
100 width: 100%;
101 // height: 232rpx;
102 padding: 20rpx 40rpx 16rpx 40rpx;
103 box-sizing: border-box;
104 position: fixed;
105 top: 0;
106 left: 0;
107 // .searchBar {
108 // width: 670rpx;
109 // display: flex;
110 // justify-content: center;
111 // align-items: center;
112 // box-sizing: border-box;
113 // padding: 0rpx 16rpx;
114 // border: 1px solid #ff6b4a;
115 // border-radius: 8rpx;
116 // background-color: #ffffff;
117 // }
118 100
119 .screenBar { 101 .header {
120 width: 670rpx; 102 background-color: #ffffff;
121 // height: 110rpx; 103 width: 100%;
122 height: 70rpx; 104 // height: 232rpx;
123 display: flex; 105 padding: 20rpx 40rpx 16rpx 40rpx;
124 flex-direction: row; 106 box-sizing: border-box;
125 justify-content: space-between; 107 position: fixed;
126 align-items: center; 108 top: 0;
127 color: #333333; 109 left: 0;
128 font-size: 32rpx; 110 // .searchBar {
129 } 111 // width: 670rpx;
130 .screenItem { 112 // display: flex;
131 height: 50rpx; 113 // justify-content: center;
132 font-size: 32rpx; 114 // align-items: center;
133 color: #333333; 115 // box-sizing: border-box;
134 display: flex; 116 // padding: 0rpx 16rpx;
135 justify-content: center; 117 // border: 1px solid #ff6b4a;
136 align-items: center; 118 // border-radius: 8rpx;
137 transition: all 0.2s; 119 // background-color: #ffffff;
138 } 120 // }
139 .active { 121
140 // font-size: 34rpx; 122 .screenBar {
141 color: #ec5d3b; 123 width: 670rpx;
142 } 124 // height: 110rpx;
143 .searchIpt { 125 height: 70rpx;
144 height: 68rpx; 126 display: flex;
145 width: 670rpx; 127 flex-direction: row;
146 padding: 16rpx; 128 justify-content: space-between;
147 font-size: 28rpx; 129 align-items: center;
148 box-sizing: border-box; 130 color: #333333;
149 } 131 font-size: 32rpx;
150 } 132 }
151 .orderList { 133
152 // margin-top: 232rpx; 134 .screenItem {
153 margin-top: 132rpx; 135 height: 50rpx;
154 } 136 font-size: 32rpx;
src/pages/user/user.vue
1 <template> 1 <template>
2 <view class="wrap"> 2 <view class="wrap">
3 <!-- 弹窗 --> 3 <!-- 弹窗 -->
4 <uni-popup 4 <uni-popup
5 ref="popup" 5 ref="popup"
6 type="center" 6 type="center"
7 > 7 >
8 <!-- 给一个左边弹窗的样式 --> 8 <!-- 给一个左边弹窗的样式 -->
9 <!-- 关闭弹窗按钮 --> 9 <!-- 关闭弹窗按钮 -->
10 <view 10 <view
11 class="closeBtn" 11 class="closeBtn"
12 @tap="this.$refs.popup.close()" 12 @tap="this.$refs.popup.close()"
13 >x</view> 13 >x</view>
14 <view 14 <view
15 class="popUpWrap" 15 class="popUpWrap"
16 v-if="whichTap==0" 16 v-if="whichTap==0"
17 > 17 >
18 <text>这是一款眼镜及周边产品的销售平台,我们将帮您进行建立全球销售网络,欢迎入驻。</text> 18 <text>这是一款眼镜及周边产品的销售平台,我们将帮您进行建立全球销售网络,欢迎入驻。</text>
19 19
20 <!-- 左 --> 20 <!-- 左 -->
21 <!-- <image class="glassInfo" src="../../static/img/myOpticsData/glassInfo.png" v-if="whichTap == 0" mode="aspectFit"></image> --> 21 <!-- <image class="glassInfo" src="../../static/img/myOpticsData/glassInfo.png" v-if="whichTap == 0" mode="aspectFit"></image> -->
22 <!-- 右 --> 22 <!-- 右 -->
23 <!-- <image class="dataInfo" src="../../static/img/myOpticsData/dataInfo.png" v-else mode="aspectFit"></image> --> 23 <!-- <image class="dataInfo" src="../../static/img/myOpticsData/dataInfo.png" v-else mode="aspectFit"></image> -->
24 </view> 24 </view>
25 <view 25 <view
26 class="popUpWrap" 26 class="popUpWrap"
27 v-if="whichTap==1" 27 v-if="whichTap==1"
28 > 28 >
29 <text>本平台欢迎全国各地的眼镜工厂、品牌、眼镜店加入。请联系我们申请注册账号。</text> 29 <text>本平台欢迎全国各地的眼镜工厂、品牌、眼镜店加入。请联系我们申请注册账号。</text>
30 </view> 30 </view>
31 <view 31 <view
32 class="popUpWrap" 32 class="popUpWrap"
33 v-if="whichTap==2" 33 v-if="whichTap==2"
34 > 34 >
35 <button @tap="chatOur(1)">客服1</button> 35 <button @tap="chatOur(1)">客服1</button>
36 <button @tap="chatOur(2)">客服2</button> 36 <button @tap="chatOur(2)">客服2</button>
37 </view> 37 </view>
38 </uni-popup> 38 </uni-popup>
39 <!-- <scroll-view 39 <!-- <scroll-view
40 enable-flex 40 enable-flex
41 @scrolltolower="handleScrolltolower" 41 @scrolltolower="handleScrolltolower"
42 scroll-y 42 scroll-y
43 style="height: 1000px;" 43 style="height: 1000px;"
44 > --> 44 > -->
45 <view 45 <view
46 v-if="isAuth" 46 v-if="isAuth"
47 class="content" 47 class="content"
48 > 48 >
49 <view class="userInfo"> 49 <view class="userInfo">
50 <view class="info"> 50 <view class="info">
51 <image 51 <image
52 :src="headerphoto" 52 :src="headerphoto"
53 mode="aspectFill" 53 mode="aspectFill"
54 ></image> 54 ></image>
55 <view class="infoText"> 55 <view class="infoText">
56 <text class="userName">{{nickName}}</text> 56 <text class="userName">{{nickName}}</text>
57 </view> 57 </view>
58 </view> 58 </view>
59 <!-- <view class="service"> 59 <!-- <view class="service">
60 <image src="../../static/serviceLogo.png" mode="aspectFill"></image> 60 <image src="../../static/serviceLogo.png" mode="aspectFill"></image>
61 </view> --> 61 </view> -->
62 </view> 62 </view>
63 <view 63 <view
64 class="myOpticsData" 64 class="myOpticsData"
65 @tap="toOpticsData" 65 @tap="toOpticsData"
66 > 66 >
67 <view class="left"> 67 <view class="left">
68 <image 68 <image
69 src="../../static/img/user/dataWrite.png" 69 src="../../static/img/user/dataWrite.png"
70 mode="aspectFit" 70 mode="aspectFit"
71 ></image> 71 ></image>
72 <text>验光数据</text> 72 <text>验光数据</text>
73 </view> 73 </view>
74 <image 74 <image
75 src="../../static/right.png" 75 src="../../static/right.png"
76 mode="aspectFit" 76 mode="aspectFit"
77 ></image> 77 ></image>
78 </view> 78 </view>
79 <view class="myOrder"> 79 <view class="myOrder">
80 <view class="orderHeader" @click="toMyOrder('10')" > 80 <view class="orderHeader" @click="toMyOrder('100000')" >
81 <text>我的订单</text> 81 <text>我的订单</text>
82 <view class="btn"> 82 <view class="btn">
83 全部 83 全部
84 <image 84 <image
85 src="../../static/right.png" 85 src="../../static/right.png"
86 mode="aspectFit" 86 mode="aspectFit"
87 ></image> 87 ></image>
88 </view> 88 </view>
89 </view> 89 </view>
90 <view class="orderBody"> 90 <view class="orderBody">
91 <view 91 <view
92 class="item waitPay" 92 class="item waitPay"
93 @click="toMyOrder('0')" 93 @click="toMyOrder('100000')"
94 > 94 >
95 <image 95 <image
96 src="../../static/img/user/waitDeliver.png" 96 src="../../static/img/user/waitDeliver.png"
97 mode="aspectFit" 97 mode="aspectFit"
98 ></image> 98 ></image>
99 <text>待付款</text> 99 <text>待付款</text>
100 </view> 100 </view>
101 <view 101 <view
102 class="item waitDeliver" 102 class="item waitDeliver"
103 @click="toMyOrder('1')" 103 @click="toMyOrder('200000')"
104 > 104 >
105 <image 105 <image
106 src="../../static/img/user/waitPay.png" 106 src="../../static/img/user/waitPay.png"
107 mode="aspectFit" 107 mode="aspectFit"
108 ></image> 108 ></image>
109 <text>待收货</text> 109 <text>待收货</text>
110 </view> 110 </view>
111 <view 111 <view
112 class="item waitReceive" 112 class="item waitReceive"
113 @click="toMyOrder('2')" 113 @click="toMyOrder('300000')"
114 > 114 >
115 <image 115 <image
116 src="../../static/img/user/waitReceive.png" 116 src="../../static/img/user/waitReceive.png"
117 mode="aspectFit" 117 mode="aspectFit"
118 ></image> 118 ></image>
119 <text>已完成</text> 119 <text>已完成</text>
120 </view> 120 </view>
121 <!-- <view class="item service" @click="toMyOrder('3')"> 121 <!-- <view class="item service" @click="toMyOrder('3')">
122 <image src="../../static/img/user/refound.png" mode="aspectFit"></image> 122 <image src="../../static/img/user/refound.png" mode="aspectFit"></image>
123 <text>已评价</text> 123 <text>已评价</text>
124 </view> --> 124 </view> -->
125 </view> 125 </view>
126 </view> 126 </view>
127 <view class="someItem"> 127 <view class="someItem">
128 <!-- <view class="item"> 128 <!-- <view class="item">
129 <view class="left"> 129 <view class="left">
130 <image src="../../static/img/user/shouyi.png" mode="aspectFit"></image> 130 <image src="../../static/img/user/shouyi.png" mode="aspectFit"></image>
131 <text>推广记录与收益</text> 131 <text>推广记录与收益</text>
132 </view> 132 </view>
133 <image src="../../static/right.png" mode="aspectFit"></image> 133 <image src="../../static/right.png" mode="aspectFit"></image>
134 </view> --> 134 </view> -->
135 <view 135 <view
136 @tap="toAddress" 136 @tap="toAddress"
137 class="item" 137 class="item"
138 > 138 >
139 <image 139 <image
140 src="../../static/address-icon.png" 140 src="../../static/address-icon.png"
141 mode="aspectFit" 141 mode="aspectFit"
142 ></image> 142 ></image>
143 <view class="left"> 143 <view class="left">
144 <text>地址管理</text> 144 <text>地址管理</text>
145 <image 145 <image
146 class="image2" 146 class="image2"
147 src="../../static/right.png" 147 src="../../static/right.png"
148 mode="aspectFit" 148 mode="aspectFit"
149 ></image> 149 ></image>
150 </view> 150 </view>
151 151
152 </view> 152 </view>
153 <view 153 <view
154 @tap="introduce" 154 @tap="introduce"
155 class="item" 155 class="item"
156 > 156 >
157 <image 157 <image
158 src="../../static/img/user/introduce.png" 158 src="../../static/img/user/introduce.png"
159 mode="aspectFit" 159 mode="aspectFit"
160 ></image> 160 ></image>
161 <view class="left"> 161 <view class="left">
162 <text>系统介绍</text> 162 <text>系统介绍</text>
163 <image 163 <image
164 src="../../static/right.png" 164 src="../../static/right.png"
165 mode="aspectFit" 165 mode="aspectFit"
166 ></image> 166 ></image>
167 </view> 167 </view>
168 </view> 168 </view>
169 <view 169 <view
170 @tap="joinUs" 170 @tap="joinUs"
171 class="item" 171 class="item"
172 > 172 >
173 <image 173 <image
174 src="../../static/img/user/joinUs.png" 174 src="../../static/img/user/joinUs.png"
175 mode="aspectFit" 175 mode="aspectFit"
176 ></image> 176 ></image>
177 <view class="left"> 177 <view class="left">
178 <text>加入我们</text> 178 <text>加入我们</text>
179 <image 179 <image
180 src="../../static/right.png" 180 src="../../static/right.png"
181 mode="aspectFit" 181 mode="aspectFit"
182 ></image> 182 ></image>
183 </view> 183 </view>
184 </view> 184 </view>
185 <view class="item"> 185 <view class="item">
186 <image 186 <image
187 src="../../static/img/user/service.png" 187 src="../../static/img/user/service.png"
188 mode="aspectFit" 188 mode="aspectFit"
189 ></image> 189 ></image>
190 <view class="left lastLeft"> 190 <view class="left lastLeft">
191 <text>联系客服</text> 191 <text>联系客服</text>
192 <image 192 <image
193 src="../../static/right.png" 193 src="../../static/right.png"
194 mode="aspectFit" 194 mode="aspectFit"
195 ></image> 195 ></image>
196 </view> 196 </view>
197 </view> 197 </view>
198 </view> 198 </view>
199 <view class="recommend"> 199 <view class="recommend">
200 <view class="title"> 200 <view class="title">
201 <view class="line"></view> 201 <view class="line"></view>
202 <view class="text">精选推荐</view> 202 <view class="text">精选推荐</view>
203 <view class="line"></view> 203 <view class="line"></view>
204 </view> 204 </view>
205 <!-- 商品列表 --> 205 <!-- 商品列表 -->
206 <view class="goods-list"> 206 <view class="goods-list">
207 <!-- <scroll-view 207 <!-- <scroll-view
208 enable-flex 208 enable-flex
209 @scrolltolower="handleScrolltolower" 209 @scrolltolower="handleScrolltolower"
210 scroll-y 210 scroll-y
211 class="product-list" 211 class="product-list"
212 > --> 212 > -->
213 <view class="product-list"> 213 <view class="product-list">
214 <view 214 <view
215 class="product" 215 class="product"
216 v-for="(item, index) in userRecommandList" 216 v-for="(item, index) in userRecommandList"
217 :key="index" 217 :key="index"
218 > 218 >
219 <Card 219 <Card
220 :goods="item" 220 :goods="item"
221 :scrollTop="scrollTop" 221 :scrollTop="scrollTop"
222 :viewHeight="viewHeight" 222 :viewHeight="viewHeight"
223 ></Card> 223 ></Card>
224 </view> 224 </view>
225 </view> 225 </view>
226 <!-- </scroll-view> --> 226 <!-- </scroll-view> -->
227 <view class="loading-text">{{loadingText}}</view> 227 <view class="loading-text">{{loadingText}}</view>
228 </view> 228 </view>
229 </view> 229 </view>
230 </view> 230 </view>
231 <view 231 <view
232 v-else 232 v-else
233 class="auth" 233 class="auth"
234 > 234 >
235 <view class="icon"></view> 235 <view class="icon"></view>
236 <view class="divider"></view> 236 <view class="divider"></view>
237 <view class="title">申请获取以下权限</view> 237 <view class="title">申请获取以下权限</view>
238 <view class="text">获得您的公开信息(昵称、头像等)</view> 238 <view class="text">获得您的公开信息(昵称、头像等)</view>
239 <button 239 <button
240 type="primary" 240 type="primary"
241 open-type="getUserInfo" 241 open-type="getUserInfo"
242 @getuserinfo="onGotUserInfo" 242 @getuserinfo="onGotUserInfo"
243 >授权登陆</button> 243 >授权登陆</button>
244 </view> 244 </view>
245 <!-- </scroll-view> --> 245 <!-- </scroll-view> -->
246 </view> 246 </view>
247 </template> 247 </template>
248 248
249 <script> 249 <script>
250 import Card from '@/components/CommodityCard/CommodityCard.vue' 250 import Card from '@/components/CommodityCard/CommodityCard.vue'
251 import store from '@/store' 251 import store from '@/store'
252 import UniPopup from '@/components/UniPopup/uni-popup.vue' 252 import UniPopup from '@/components/UniPopup/uni-popup.vue'
253 253
254 export default { 254 export default {
255 components: { 255 components: {
256 Card, 256 Card,
257 UniPopup, 257 UniPopup,
258 }, 258 },
259 data() { 259 data() {
260 return { 260 return {
261 isAuth: true, // 是否显示授权页面, 261 isAuth: true, // 是否显示授权页面,
262 pagesnum: 1, // 分页请求初始值 262 pagesnum: 1, // 分页请求初始值
263 whichTap: 0, // 弹窗渲染选择条件 263 whichTap: 0, // 弹窗渲染选择条件
264 loadingText: '到底了', 264 loadingText: '到底了',
265 scrollTop: 0, 265 scrollTop: 0,
266 viewHeight: uni.getSystemInfoSync().windowHeight, 266 viewHeight: uni.getSystemInfoSync().windowHeight,
267 } 267 }
268 }, 268 },
269 onPageScroll({ scrollTop }) { 269 onPageScroll({ scrollTop }) {
270 // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件 270 // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
271 this.scrollTop = scrollTop 271 this.scrollTop = scrollTop
272 }, 272 },
273 onLoad() { 273 onLoad() {
274 const that = this 274 const that = this
275 // 判断是否授权 275 // 判断是否授权
276 uni.getSetting({ 276 uni.getSetting({
277 success(res) { 277 success(res) {
278 console.log('authSetting', res.authSetting) 278 console.log('authSetting', res.authSetting)
279 if (res.authSetting['scope.userInfo'] === true) { 279 if (res.authSetting['scope.userInfo'] === true) {
280 that.isAuth = true 280 that.isAuth = true
281 } else { 281 } else {
282 that.isAuth = false 282 that.isAuth = false
283 } 283 }
284 }, 284 },
285 }) 285 })
286 store.dispatch('userRecommand/getRecommandList', { 286 store.dispatch('userRecommand/getRecommandList', {
287 uid: that.$store.state.user.userInfo.uid, 287 uid: that.$store.state.user.userInfo.uid,
288 openid: that.$store.state.user.userInfo.openid, 288 openid: that.$store.state.user.userInfo.openid,
289 page: that.pagesnum, 289 page: that.pagesnum,
290 }) 290 })
291 }, 291 },
292 onReachBottom() { 292 onReachBottom() {
293 // console.log('usr-my',this.$store.state.user.userInfo) 293 // console.log('usr-my',this.$store.state.user.userInfo)
294 this.pagesnum++ 294 this.pagesnum++
295 store.dispatch('userRecommand/getRecommandList', { 295 store.dispatch('userRecommand/getRecommandList', {
296 uid: this.$store.state.user.userInfo.uid, 296 uid: this.$store.state.user.userInfo.uid,
297 openid: this.$store.state.user.userInfo.openid, 297 openid: this.$store.state.user.userInfo.openid,
298 page: this.pagesnum, 298 page: this.pagesnum,
299 }) 299 })
300 }, 300 },
301 computed: { 301 computed: {
302 nickName() { 302 nickName() {
303 return this.$store.state.user.userInfo.nickName 303 return this.$store.state.user.userInfo.nickName
304 }, 304 },
305 headerphoto() { 305 headerphoto() {
306 return this.$store.state.user.userInfo.headerphoto 306 return this.$store.state.user.userInfo.headerphoto
307 }, 307 },
308 userRecommandList() { 308 userRecommandList() {
309 console.log('userRecommandList=====>', this.$store.state.userRecommand.recommandList) 309 console.log('userRecommandList=====>', this.$store.state.userRecommand.recommandList)
310 return this.$store.state.userRecommand.recommandList 310 return this.$store.state.userRecommand.recommandList
311 }, 311 },
312 }, 312 },
313 methods: { 313 methods: {
314 // 弹窗 314 // 弹窗
315 changeTap(item) { 315 changeTap(item) {
316 this.whichTap = item 316 this.whichTap = item
317 this.$refs.popup.open() 317 this.$refs.popup.open()
318 }, 318 },
319 chatOur(item) { 319 chatOur(item) {
320 if (item === 1) { 320 if (item === 1) {
321 uni.makePhoneCall({ 321 uni.makePhoneCall({
322 phoneNumber: 13376189297, // 客服1 电话 322 phoneNumber: 13376189297, // 客服1 电话
323 }) 323 })
324 } else { 324 } else {
325 uni.makePhoneCall({ 325 uni.makePhoneCall({
326 phoneNumber: 18014995101, // 客服2 电话 326 phoneNumber: 18014995101, // 客服2 电话
327 }) 327 })
328 } 328 }
329 }, 329 },
330 // 授权 330 // 授权
331 onGotUserInfo(e) { 331 onGotUserInfo(e) {
332 if (e.detail.errMsg === 'getUserInfo:ok') { 332 if (e.detail.errMsg === 'getUserInfo:ok') {
333 const { fromInfo } = this.$store.state.user 333 const { fromInfo } = this.$store.state.user
334 // 用户授权成功 334 // 用户授权成功
335 store.dispatch('user/getUserInfo', fromInfo) 335 store.dispatch('user/getUserInfo', fromInfo)
336 this.isAuth = true 336 this.isAuth = true
337 } 337 }
338 }, 338 },
339 toAddress() { 339 toAddress() {
340 uni.navigateTo({ 340 uni.navigateTo({
341 url: '../address/addressList', 341 url: '../address/addressList',
342 success: res => {}, 342 success: res => {},
343 fail: () => {}, 343 fail: () => {},
344 complete: () => {}, 344 complete: () => {},
345 }) 345 })
346 }, 346 },
347 introduce() { 347 introduce() {
348 uni.showModal({ 348 uni.showModal({
349 content: '这是一款眼镜及周边产品的销售平台,我们将帮您进行建立全球销售网络,欢迎入住。', 349 content: '这是一款眼镜及周边产品的销售平台,我们将帮您进行建立全球销售网络,欢迎入住。',
350 showCancel: false, 350 showCancel: false,
351 }) 351 })
352 }, 352 },
353 joinUs() { 353 joinUs() {
354 uni.showModal({ 354 uni.showModal({
355 content: '本平台欢迎全国各地的眼镜工厂、品牌、眼镜店加入。请联系我们申请注册账号', 355 content: '本平台欢迎全国各地的眼镜工厂、品牌、眼镜店加入。请联系我们申请注册账号',
356 showCancel: false, 356 showCancel: false,
357 }) 357 })
358 }, 358 },
359 toMyOrder(status) { 359 toMyOrder(status) {
360 uni.navigateTo({ 360 uni.navigateTo({
361 url: `../myOrder/myOrder?status=${status}`, 361 url: `../myOrder/myOrder?status=${status}`,
362 success: res => {}, 362 success: res => {},
363 fail: () => {}, 363 fail: () => {},
364 complete: () => {}, 364 complete: () => {},
365 }) 365 })
366 }, 366 },
367 toOpticsData() { 367 toOpticsData() {
368 uni.navigateTo({ 368 uni.navigateTo({
369 url: '../addOpticsData/addOpticsData', 369 url: '../addOpticsData/addOpticsData',
370 }) 370 })
371 }, 371 },
372 }, 372 },
373 } 373 }
374 </script> 374 </script>
375 375
376 <style lang="scss"> 376 <style lang="scss">
377 .warp { 377 .warp {
378 font-size: 24rpx; 378 font-size: 24rpx;
379 background-color: #f2f2f2; 379 background-color: #f2f2f2;
380 height: 100vh; 380 height: 100vh;
381 } 381 }
382 .content { 382 .content {
383 display: flex; 383 display: flex;
384 flex-direction: column; 384 flex-direction: column;
385 align-items: center; 385 align-items: center;
386 justify-content: center; 386 justify-content: center;
387 background-color: #f2f2f2; 387 background-color: #f2f2f2;
388 } 388 }
389 .userInfo { 389 .userInfo {
390 background-image: linear-gradient(270deg, #f79067 0%, #ff5f3b 66%); 390 background-image: linear-gradient(270deg, #f79067 0%, #ff5f3b 66%);
391 width: 100%; 391 width: 100%;
392 height: 240rpx; 392 height: 240rpx;
393 color: #ffffff; 393 color: #ffffff;
394 padding: 60rpx 82rpx 80rpx 44rpx; 394 padding: 60rpx 82rpx 80rpx 44rpx;
395 box-sizing: border-box; 395 box-sizing: border-box;
396 display: flex; 396 display: flex;
397 flex-direction: row; 397 flex-direction: row;
398 justify-content: space-between; 398 justify-content: space-between;
399 align-items: flex-start; 399 align-items: flex-start;
400 .info { 400 .info {
401 display: flex; 401 display: flex;
402 flex-direction: row; 402 flex-direction: row;
403 justify-content: space-between; 403 justify-content: space-between;
404 align-items: center; 404 align-items: center;
405 image { 405 image {
406 border-radius: 50rpx; 406 border-radius: 50rpx;
407 height: 100rpx; 407 height: 100rpx;
408 width: 100rpx; 408 width: 100rpx;
409 margin-right: 40rpx; 409 margin-right: 40rpx;
410 } 410 }
411 .infoText { 411 .infoText {
412 display: flex; 412 display: flex;
413 flex-direction: column; 413 flex-direction: column;
414 justify-content: space-between; 414 justify-content: space-between;
415 align-items: flex-scetart; 415 align-items: flex-scetart;
416 .userName { 416 .userName {
417 font-size: 18px; 417 font-size: 18px;
418 color: #ffffff; 418 color: #ffffff;
419 margin-bottom: 8rpx; 419 margin-bottom: 8rpx;
420 } 420 }
421 .nickName { 421 .nickName {
422 font-size: 12px; 422 font-size: 12px;
423 color: #ffffff; 423 color: #ffffff;
424 } 424 }
425 } 425 }
426 } 426 }
427 // .service { 427 // .service {
428 // margin-top: 20rpx; 428 // margin-top: 20rpx;
429 // image { 429 // image {
430 // height: 36rpx; 430 // height: 36rpx;
431 // width: 36rpx; 431 // width: 36rpx;
432 // } 432 // }
433 // } 433 // }
434 } 434 }
435 .myOpticsData { 435 .myOpticsData {
436 width: 670rpx; 436 width: 670rpx;
437 height: 120rpx; 437 height: 120rpx;
438 background-color: #ffffff; 438 background-color: #ffffff;
439 border-radius: 6px; 439 border-radius: 6px;
440 box-shadow: 1px 1px 7px 0 rgba(133, 107, 107, 0.1); 440 box-shadow: 1px 1px 7px 0 rgba(133, 107, 107, 0.1);
441 position: relative; 441 position: relative;
442 bottom: 44rpx; 442 bottom: 44rpx;
443 padding: 40rpx; 443 padding: 40rpx;
444 box-sizing: border-box; 444 box-sizing: border-box;
445 display: flex; 445 display: flex;
446 justify-content: space-between; 446 justify-content: space-between;
447 align-items: center; 447 align-items: center;
448 .left { 448 .left {
449 font-size: 14px; 449 font-size: 14px;
450 color: #333333; 450 color: #333333;
451 display: flex; 451 display: flex;
452 align-items: center; 452 align-items: center;
453 image { 453 image {
454 margin-right: 32rpx; 454 margin-right: 32rpx;
455 width: 40rpx; 455 width: 40rpx;
456 height: 44rpx; 456 height: 44rpx;
457 } 457 }
458 } 458 }
459 image { 459 image {
460 height: 16px; 460 height: 16px;
461 width: 8px; 461 width: 8px;
462 } 462 }
463 } 463 }
464 .myOrder { 464 .myOrder {
465 width: 100%; 465 width: 100%;
466 height: 296rpx; 466 height: 296rpx;
467 // margin-top: 116rpx; 467 // margin-top: 116rpx;
468 margin-bottom: 20rpx; 468 margin-bottom: 20rpx;
469 padding: 0 40rpx; 469 padding: 0 40rpx;
470 box-sizing: border-box; 470 box-sizing: border-box;
471 background: #ffffff; 471 background: #ffffff;
472 box-shadow: 0 0 4px 0 rgba(133, 107, 107, 0.1); 472 box-shadow: 0 0 4px 0 rgba(133, 107, 107, 0.1);
473 border-radius: 6px; 473 border-radius: 6px;
474 border-radius: 6px; 474 border-radius: 6px;
475 display: flex; 475 display: flex;
476 flex-direction: column; 476 flex-direction: column;
477 justify-content: space-around; 477 justify-content: space-around;
478 align-items: center; 478 align-items: center;
479 .orderHeader { 479 .orderHeader {
480 width: 100%; 480 width: 100%;
481 height: 100rpx; 481 height: 100rpx;
482 display: flex; 482 display: flex;
483 flex-direction: row; 483 flex-direction: row;
484 justify-content: space-between; 484 justify-content: space-between;
485 align-items: center; 485 align-items: center;
486 border-bottom: 1px solid #f5f5f5; 486 border-bottom: 1px solid #f5f5f5;
487 font-weight: bold; 487 font-weight: bold;
488 font-size: 18px; 488 font-size: 18px;
489 color: #333333; 489 color: #333333;
490 .btn { 490 .btn {
491 font-size: 12px; 491 font-size: 12px;
492 color: #999999; 492 color: #999999;
493 display: flex; 493 display: flex;
494 align-items: center; 494 align-items: center;
495 image { 495 image {
496 margin-left: 20rpx; 496 margin-left: 20rpx;
497 height: 32rpx; 497 height: 32rpx;
498 width: 16rpx; 498 width: 16rpx;
499 } 499 }
500 } 500 }
501 } 501 }
502 .orderBody { 502 .orderBody {
503 width: 100%; 503 width: 100%;
504 display: flex; 504 display: flex;
505 flex-direction: row; 505 flex-direction: row;
506 justify-content: space-around; 506 justify-content: space-around;
507 align-items: center; 507 align-items: center;
508 .item { 508 .item {
509 display: flex; 509 display: flex;
510 flex-direction: column; 510 flex-direction: column;
511 align-items: center; 511 align-items: center;
512 image { 512 image {
513 width: 62rpx; 513 width: 62rpx;
514 height: 46rpx; 514 height: 46rpx;
515 } 515 }
516 text { 516 text {
517 margin-top: 24rpx; 517 margin-top: 24rpx;
518 font-size: 12px; 518 font-size: 12px;
519 color: #333333; 519 color: #333333;
520 } 520 }
521 } 521 }
522 } 522 }
523 } 523 }
524 .someItem { 524 .someItem {
525 width: 100%; 525 width: 100%;
526 height: 336rpx; 526 height: 336rpx;
527 background: #ffffff; 527 background: #ffffff;
528 box-shadow: 0 0 4px 0 rgba(133, 107, 107, 0.1); 528 box-shadow: 0 0 4px 0 rgba(133, 107, 107, 0.1);
529 border-radius: 6px; 529 border-radius: 6px;
530 border-radius: 6px; 530 border-radius: 6px;
531 margin-bottom: 18rpx; 531 margin-bottom: 18rpx;
532 box-sizing: border-box; 532 box-sizing: border-box;
533 padding: 21rpx 48rpx 21rpx 42rpx; 533 padding: 21rpx 48rpx 21rpx 42rpx;
534 box-sizing: border-box; 534 box-sizing: border-box;
535 display: flex; 535 display: flex;
536 flex-direction: column; 536 flex-direction: column;
537 justify-content: space-between; 537 justify-content: space-between;
538 align-items: center; 538 align-items: center;
539 .item { 539 .item {
540 display: grid; 540 display: grid;
541 grid-template-columns: 10% 90%; 541 grid-template-columns: 10% 90%;
542 align-items: center; 542 align-items: center;
543 height: 72rpx; 543 height: 72rpx;
544 width: 100%; 544 width: 100%;
545 .left { 545 .left {
546 font-size: 14px; 546 font-size: 14px;
547 color: #333333; 547 color: #333333;
548 display: flex; 548 display: flex;
549 align-items: center; 549 align-items: center;
550 justify-content: space-between; 550 justify-content: space-between;
551 height: 72rpx; 551 height: 72rpx;
552 border-bottom: 1px solid #f2f2f2; 552 border-bottom: 1px solid #f2f2f2;
553 image { 553 image {
554 margin-right: 0; 554 margin-right: 0;
555 height: 16px; 555 height: 16px;
556 width: 8px; 556 width: 8px;
557 } 557 }
558 } 558 }
559 image { 559 image {
560 margin-right: 32rpx; 560 margin-right: 32rpx;
561 width: 40rpx; 561 width: 40rpx;
562 height: 44rpx; 562 height: 44rpx;
563 } 563 }
564 .lastLeft { 564 .lastLeft {
565 border-bottom: none; 565 border-bottom: none;
566 } 566 }
567 } 567 }
568 } 568 }
569 .recommend { 569 .recommend {
570 background: #ffffff; 570 background: #ffffff;
571 box-shadow: 0 0 4px 0 rgba(133, 107, 107, 0.1); 571 box-shadow: 0 0 4px 0 rgba(133, 107, 107, 0.1);
572 border-radius: 6px; 572 border-radius: 6px;
573 border-radius: 6px; 573 border-radius: 6px;
574 width: 100%; 574 width: 100%;
575 .title { 575 .title {
576 display: flex; 576 display: flex;
577 flex-direction: row; 577 flex-direction: row;
578 align-items: center; 578 align-items: center;
579 justify-content: space-between; 579 justify-content: space-between;
580 padding: 20rpx 40rpx; 580 padding: 20rpx 40rpx;
581 .line { 581 .line {
582 width: 264rpx; 582 width: 264rpx;
583 height: 1rpx; 583 height: 1rpx;
584 border-bottom: 1px solid #eaeaea; 584 border-bottom: 1px solid #eaeaea;
585 } 585 }
586 .text { 586 .text {
587 font-family: PingFangSC-Medium; 587 font-family: PingFangSC-Medium;
588 font-size: 14px; 588 font-size: 14px;
589 color: #333333; 589 color: #333333;
590 letter-spacing: -0.26px; 590 letter-spacing: -0.26px;
591 text-align: justify; 591 text-align: justify;
592 line-height: 24px; 592 line-height: 24px;
593 } 593 }
594 } 594 }
595 .goods-list { 595 .goods-list {
596 .loading-text { 596 .loading-text {
597 width: 100%; 597 width: 100%;
598 display: flex; 598 display: flex;
599 justify-content: center; 599 justify-content: center;
600 align-items: center; 600 align-items: center;
601 height: 30px; 601 height: 30px;
602 color: #979797; 602 color: #979797;
603 font-size: 12px; 603 font-size: 12px;
604 } 604 }
605 .product-list { 605 .product-list {
606 width: 92%; 606 width: 92%;
607 padding: 0 4% 3vw 4%; 607 padding: 0 4% 3vw 4%;
608 display: flex; 608 display: flex;
609 justify-content: space-between; 609 justify-content: space-between;
610 flex-wrap: wrap; 610 flex-wrap: wrap;
611 .product { 611 .product {
612 width: 48%; 612 width: 48%;
613 margin: 0 0 20rpx 0; 613 margin: 0 0 20rpx 0;
614 background: #ffffff; 614 background: #ffffff;
615 border: 1px solid #f2f2f2; 615 border: 1px solid #f2f2f2;
616 } 616 }
617 } 617 }
618 } 618 }
619 } 619 }
620 .auth { 620 .auth {
621 height: 100vh; 621 height: 100vh;
622 display: flex; 622 display: flex;
623 flex-direction: column; 623 flex-direction: column;
624 align-items: center; 624 align-items: center;
625 .icon { 625 .icon {
626 width: 140rpx; 626 width: 140rpx;
627 height: 140rpx; 627 height: 140rpx;
628 border-radius: 50%; 628 border-radius: 50%;
629 margin-top: 100rpx; 629 margin-top: 100rpx;
630 background-color: grey; 630 background-color: grey;
631 } 631 }
632 .divider { 632 .divider {
633 height: 1rpx; 633 height: 1rpx;
634 width: 600rpx; 634 width: 600rpx;
635 margin-top: 80rpx; 635 margin-top: 80rpx;
636 background-color: #e6e3e3; 636 background-color: #e6e3e3;
637 } 637 }
638 .title { 638 .title {
639 width: 600rpx; 639 width: 600rpx;
640 margin-top: 50rpx; 640 margin-top: 50rpx;
641 text-align: left; 641 text-align: left;
642 } 642 }
643 .text { 643 .text {
644 width: 600rpx; 644 width: 600rpx;
645 margin-top: 30rpx; 645 margin-top: 30rpx;
646 text-align: left; 646 text-align: left;
647 color: #e6e3e3; 647 color: #e6e3e3;
648 } 648 }
649 button { 649 button {
650 width: 450rpx; 650 width: 450rpx;
651 height: 80rpx; 651 height: 80rpx;
652 line-height: 80rpx; 652 line-height: 80rpx;
653 margin-top: 80rpx; 653 margin-top: 80rpx;
654 border-radius: 30rpx; 654 border-radius: 30rpx;
655 } 655 }
656 } 656 }
657 .closeBtn { 657 .closeBtn {
658 height: 28rpx; 658 height: 28rpx;
659 width: 28rpx; 659 width: 28rpx;
660 // border: 1px solid red; 660 // border: 1px solid red;
661 position: absolute; 661 position: absolute;
662 top: 20rpx; 662 top: 20rpx;
663 right: 10rpx; 663 right: 10rpx;
664 } 664 }
665 </style> 665 </style>
666 666
src/store/modules/address.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 { editAddress, addressList, getAddress, getDefaultAddress } = urlAlias 4 const { editAddress, addressList, getAddress, getDefaultAddress } = urlAlias
5 5
6 const state = { list: [], detail: {}, defaultInfo: {} } 6 const state = { list: [], detail: {}, defaultInfo: {} }
7 7
8 const mutations = { 8 const mutations = {
9 LIST: (state, list) => { 9 LIST: (state, list) => {
10 state.list = list 10 state.list = list
11 }, 11 },
12 DETAILS: (state, details) => { 12 DETAILS: (state, details) => {
13 state.details = details 13 state.details = details
14 }, 14 },
15 DEFAULT: (state, data) => { 15 DEFAULT: (state, data) => {
16 state.defaultInfo = data 16 state.defaultInfo = data
17 }, 17 },
18 } 18 }
19 19
20 const actions = { 20 const actions = {
21 edit(mutations, param, success) { 21 edit(mutations, param, success) {
22 return new Promise((resolve) => request({ 22 return new Promise((resolve) => request({
23 url: editAddress, 23 url: editAddress,
24 data: param, 24 data: param,
25 success: () => { 25 success: () => {
26 resolve() 26 resolve()
27 }, 27 },
28 fail: () => { 28 fail: () => {
29 uni.showModal({ 29 uni.showModal({
30 content: '编辑失败', 30 content: '编辑失败',
31 showCancel: false, 31 showCancel: false,
32 }) 32 })
33 }, 33 },
34 complete: (res) => { 34 complete: (res) => {
35 console.log('complete status === > ', res) 35 console.log('complete status === > ', res)
36 }, 36 },
37 })) 37 }))
38 }, 38 },
39 list({ commit }) { 39 list({ commit },param) {
40 request({ 40 request({
41 url: addressList, 41 url: addressList,
42 data: param,
42 success: (res) => { 43 success: (res) => {
43 commit('LIST', res.data.data) 44 commit('LIST', res.data.data.list)
44 }, 45 },
45 fail: () => { 46 fail: () => {
46 uni.showModal({ 47 uni.showModal({
47 content: '获取地址列表失败', 48 content: '获取地址列表失败',
48 showCancel: false, 49 showCancel: false,
49 }) 50 })
50 }, 51 },
51 }) 52 })
52 }, 53 },
53 details({ commit }, param) { 54 details({ commit }, param) {
54 return new Promise((resolve, reject) => request({ 55 return new Promise((resolve, reject) => request({
55 url: getAddress, 56 url: getAddress,
56 data: param, 57 data: param,
57 success: (res) => { 58 success: (res) => {
58 commit('DETAILS', res.data.data) 59 commit('DETAILS', res.data.data)
59 resolve({ 60 resolve({
60 code: res.data.code, 61 code: res.data.code,
61 data: res.data.data, 62 data: res.data.data,
62 }) 63 })
63 }, 64 },
64 fail: () => { 65 fail: () => {
65 uni.showModal({ 66 uni.showModal({
66 content: '获取地址信息失败', 67 content: '获取地址信息失败',
67 showCancel: false, 68 showCancel: false,
68 }) 69 })
69 }, 70 },
70 })) 71 }))
71 }, 72 },
72 default({ commit }, param) { 73 default({ commit }, param) {
73 return new Promise((resolve, reject) => request({ 74 return new Promise((resolve, reject) => request({
74 url: getDefaultAddress, 75 url: getDefaultAddress,
75 data: param, 76 data: param,
76 success: (res) => { 77 success: (res) => {
77 resolve({ 78 resolve({
78 code: res.data.code, 79 code: res.data.code,
79 data: res.data.data, 80 data: res.data.data,
80 }) 81 })
81 }, 82 },
82 fail: () => { 83 fail: () => {
83 uni.showModal({ 84 uni.showModal({
84 content: '获取默认地址信息失败', 85 content: '获取默认地址信息失败',
85 showCancel: false, 86 showCancel: false,
86 }) 87 })
87 }, 88 },
88 })) 89 }))
89 }, 90 },
90 } 91 }
91 92
92 export default { 93 export default {
93 namespaced: true, 94 namespaced: true,
94 state, 95 state,
95 mutations, 96 mutations,
96 actions, 97 actions,
97 } 98 }
98 99
src/store/modules/cart.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 { cartList, cartModi, cartDel, cartAdd } = urlAlias 4 const { cartList, cartModi, cartDel, cartAdd } = urlAlias
5 5
6 const state = { 6 const state = {
7 cartList: [], 7 cartList: [],
8 checkedCartLst:[], 8 checkedCartLst:[],
9 buyItem:Object 9 buyItem:Object
10 } 10 }
11 11
12 const mutations = { 12 const mutations = {
13 INIT: (state, cartList) => { 13 INIT: (state, cartList) => {
14 state.cartList = cartList 14 state.cartList = cartList
15 }, 15 },
16 DEL: (state, index) => { 16 DEL: (state, index) => {
17 state.cartList.splice(index, 1) 17 state.cartList.splice(index, 1)
18 }, 18 },
19 MODI: (state, args) => { 19 MODI: (state, args) => {
20 state.cartList[args.index].num = args.num 20 state.cartList[args.index].num = args.num
21 }, 21 },
22 22
23 } 23 }
24 24
25 const actions = { 25 const actions = {
26 // 获取购物车列表 26 // 获取购物车列表
27 getCartList({ commit }, param) { 27 getCartList({ commit }, param) {
28 return new Promise((resolve) => request({ 28 return new Promise((resolve) => request({
29 url: cartList, 29 url: cartList,
30 data: param, 30 data: param,
31 success: (res) => { 31 success: (res) => {
32 let test = { 32 let test = {
33 isChecked: false, 33 isChecked: false,
34 itemNum:1, 34 num:1,
35 price:0 35 price:0
36 } 36 }
37 commit('INIT', res.data.data) 37 commit('INIT', res.data.data.list)
38 resolve(res.data.data) 38 resolve(res.data.data)
39 }, 39 },
40 })) 40 }))
41 }, 41 },
42 // 修改购物车数量 42 // 修改购物车数量
43 modiCart({ commit }, param) { 43 modiCart({ commit }, param) {
44 const arg = Object.assign({ num: param.num }, param.args) 44 const arg = Object.assign({ num: param.num }, param.args)
45 delete param.args 45 delete param.args
46 return new Promise((resolve) => request({ 46 return new Promise((resolve) => request({
47 url: cartModi, 47 url: cartModi,
48 data: param, 48 data: param,
49 success: (res) => { 49 success: (res) => {
50 commit('MODI', arg) 50 commit('MODI', arg)
51 }, 51 },
52 fail: (res) => { 52 fail: (res) => {
53 }, 53 },
54 complete: (res) => { 54 complete: (res) => {
55 }, 55 },
56 })) 56 }))
57 }, 57 },
58 // 删除购物车商品 58 // 删除购物车商品
59 delCart({ commit }, param) { 59 delCart({ commit }, param) {
60 const arg = param.arg 60 const arg = param.arg
61 delete param.arg 61 delete param.arg
62 request({ 62 request({
63 url: cartDel, 63 url: cartDel,
64 data: param, 64 data: param,
65 success: (res) => { 65 success: (res) => {
66 commit('DEL', arg) 66 commit('DEL', arg)
67 }, 67 },
68 fail: (res) => { 68 fail: (res) => {
69 }, 69 },
70 complete: (res) => { 70 complete: (res) => {
71 }, 71 },
72 }) 72 })
73 }, 73 },
74 // 添加到购物车 74 // 添加到购物车
75 addCart({ commit }, param) { 75 addCart({ commit }, param) {
76 console.log('请求接口开始') 76 console.log('请求接口开始')
77 return new Promise((resolve) => request({ 77 return new Promise((resolve) => request({
78 url: cartAdd, 78 url: cartAdd,
79 data: param, 79 data: param,
80 success: (res) => { 80 success: (res) => {
81 console.log('add-parm', param) 81 console.log('add-parm', param)
82 console.log('addcart===>res.data===>', res.data) 82 console.log('addcart===>res.data===>', res.data)
83 // commit('INIT', res.data.data) 83 // commit('INIT', res.data.data)
84 resolve(res.data) 84 resolve(res.data)
85 }, 85 },
86 fail: (res) => { 86 fail: (res) => {
87 console.log('添加购物车失败 === > ', res) 87 console.log('添加购物车失败 === > ', res)
88 }, 88 },
89 complete: (res) => { 89 complete: (res) => {
90 console.log('添加购物车完成 === > ', res) 90 console.log('添加购物车完成 === > ', res)
91 }, 91 },
92 })) 92 }))
93 }, 93 },
94 } 94 }
95 95
96 export default { 96 export default {
97 namespaced: true, 97 namespaced: true,
98 state, 98 state,
99 mutations, 99 mutations,
100 actions, 100 actions,
101 } 101 }
102 102
src/store/modules/details.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 read, 5 read,
6 cartList, 6 cartList,
7 makePost, 7 makePost,
8 } = urlAlias 8 } = urlAlias
9 9
10 const state = { 10 const state = {
11 // 为配合参数选择框 11 // 为配合参数选择框
12 goodInfo: {}, 12 goodInfo: {},
13 // 轮播图 13 // 轮播图
14 carousel: [ 14 carousel: [
15 '/static/img/detail/d9.png', 15 '/static/img/detail/d9.png',
16 ], 16 ],
17 // 商品基本信息 17 // 商品基本信息
18 goodsInfo: { 18 goodsInfo: {
19 name: '暂无名称', 19 name: '暂无名称',
20 price: '暂无价格', 20 price: '暂无价格',
21 discountPrice: undefined, 21 discountPrice: undefined,
22 tradeNumber: undefined, 22 tradeNumber: undefined,
23 }, 23 },
24 // 商品介绍 24 // 商品介绍
25 tag: { 25 // tag: {
26 prod_tag_style: [{ 26 // prod_tag_style: [{
27 label: '青春学子风', 27 // label: '青春学子风',
28 value: '54', 28 // value: '54',
29 }], 29 // }],
30 }, 30 // },
31 // 规格参数 31 // 规格参数
32 specification: [ 32 specification: [{
33 { key: 'frame_width', img: '/static/img/detail/d2.png', standard: '框架宽', slength: '139mm' }, 33 key: 'frame_width',
34 { key: 'glass_width', img: '/static/img/detail/d3.png', standard: '镜片宽', slength: '51mm' }, 34 img: '/static/img/detail/d2.png',
35 { key: 'glass_height', img: '/static/img/detail/d4.png', standard: '镜片高', slength: '45mm' }, 35 standard: '框架宽',
36 { key: 'nose_width', img: '/static/img/detail/d5.png', standard: '鼻架宽', slength: '19mm' }, 36 slength: '139mm'
37 { key: 'leg_long', img: '/static/img/detail/d6.png', standard: '框架耳长', slength: '138mm' }, 37 },
38 { key: 'weight', img: '/static/img/detail/d7.png', standard: '框架重', slength: '19克(grams)' }, 38 {
39 ], 39 key: 'glass_width',
40 // 评价 40 img: '/static/img/detail/d3.png',
41 evaluate: { 41 standard: '镜片宽',
42 rate: '100%', 42 slength: '51mm'
43 star: 5, 43 },
44 tag: [{ name: '价格实惠' }], 44 {
45 }, 45 key: 'glass_height',
46 // 商品详情 46 img: '/static/img/detail/d4.png',
47 more: '', 47 standard: '镜片高',
48 // 购物车数目 48 slength: '45mm'
49 cartNumber: 0, 49 },
50 // skuList 50 {
51 skuList: [], 51 key: 'nose_width',
52 postUrl: 'https://api.glass.xiuyetang.com/adv_pic/428_0_7.png', 52 img: '/static/img/detail/d5.png',
53 } 53 standard: '鼻架宽',
54 54 slength: '19mm'
55 const mutations = { 55 },
56 INIT: (state, { goodInfo, carousel, goodsInfo, tag, specification, evaluate, more, skuList }) => { 56 {
57 state.goodInfo = goodInfo 57 key: 'leg_long',
58 state.carousel = carousel 58 img: '/static/img/detail/d6.png',
59 state.goodsInfo = goodsInfo 59 standard: '框架耳长',
60 state.tag = tag 60 slength: '138mm'
61 state.specification = specification 61 },
62 state.evaluate = evaluate 62 {
63 state.more = more 63 key: 'weight',
64 state.skuList = skuList 64 img: '/static/img/detail/d7.png',
65 // state.current = 1 65 standard: '框架重',
66 }, 66 slength: '19克(grams)'
67 CART: (state, number) => { 67 },
68 state.cartNumber = number 68 ],
69 }, 69 Tag: {
70 POST: (state, url) => { 70 Age: [],
71 state.postUrl = url 71 Colour: [],
72 }, 72 Eyeglasses: [],
73 } 73 Gender: [],
74 74 Hinge: [],
75 const actions = { 75 Material: [],
76 // 获取详情 76 Rim: [],
77 details({ commit, rootState }, param) { 77 Shape: [],
78 // console.log('paramparamparamparamparam', param); 78 Style: [],
79 return new Promise((resolve, reject) => request({ 79 },
80 url: read, 80 // 评价
81 data: param, 81 evaluate: {
82 success: ({ data: { data } }) => { 82 rate: '100%',
83 // console.log('details.details.details.details.details.data.tag', data) 83 star: 5,
84 console.log('this.statethis.statethis.statethis.state', this.state) 84 tag: [{
85 // return; 85 name: '价格实惠'
86 // 规格参数设置 86 }],
87 const specification=[]; 87 },
88 // specification[0].slength=1; 88 // 商品详情
89 const parameter = { 89 more: '',
90 frame_weight: data.frame_weight, 90 // 购物车数目
91 frame_width: data.frame_width, 91 cartNumber: 0,
92 glass_height: data.glass_height, 92 // skuList
93 nose_width: data.nose_bridge, 93 skuList: [],
94 lens_width:data.lens_width, 94 postUrl: 'https://api.glass.xiuyetang.com/adv_pic/428_0_7.png',
95 leg_long: data.leg_temple, 95 }
96 weight: data.weight, 96
97 } 97 const mutations = {
98 for (let index = 0; index < specification.length; index++) { 98 INIT: (state, {
99 if (specification[index].key !== 'weight') { 99 goodInfo,
100 specification[index].slength = `${parameter[specification[index].key]}mm` 100 carousel,
101 } else { 101 goodsInfo,
102 specification[index].slength = `${parameter[specification[index].key]}克(grams)` 102 Tag,
103 } 103 specification,
104 } 104 evaluate,
105 105 more,
106 commit('INIT', { 106 skuList
107 goodInfo: data, 107 }) => {
108 skuList: data.sku, 108 state.goodInfo = goodInfo
109 carousel: data.sku[0].sku_pic_arr_http, 109 state.carousel = carousel
110 goodsInfo: { 110 state.goodsInfo = goodsInfo
111 name: data.shop_wood_name, 111 state.Tag = Tag
112 price: data.sales_price, 112 state.specification = specification
113 discountPrice: data.sales_price - Number(0), 113 state.evaluate = evaluate
114 tradeNumber: data.sales_num, 114 state.more = more
115 }, 115 state.skuList = skuList
116 tag: data.tag_defined, 116 // state.current = 1
117 specification:[ 117 },
118 { key: 'frame_width', img: '/static/img/detail/d2.png', standard: '框架宽', slength: '139mm' }, 118 CART: (state, number) => {
119 { key: 'glass_width', img: '/static/img/detail/d3.png', standard: '镜片宽', slength: '51mm' }, 119 state.cartNumber = number
120 { key: 'glass_height', img: '/static/img/detail/d4.png', standard: '镜片高', slength: '45mm' }, 120 },
121 { key: 'nose_width', img: '/static/img/detail/d5.png', standard: '鼻架宽', slength: '19mm' }, 121 POST: (state, url) => {
122 { key: 'leg_long', img: '/static/img/detail/d6.png', standard: '框架耳长', slength: '138mm' }, 122 state.postUrl = url
123 { key: 'weight', img: '/static/img/detail/d7.png', standard: '框架重', slength: '19克(grams)' }, 123 },
124 ], 124 }
125 evaluate: { 125
126 rate: 5, 126 const actions = {
127 tag: data.judge.list, 127 // 获取详情
128 // star: parseInt(5 * Number(data.judgeInfo.good.slice(0, -1)) / 100), 128 details({
129 star: 5, 129 commit,
130 }, 130 rootState
131 // eslint-disable-next-line 131 }, param) {
132 // more: data.prodIntro1.replace(/\<img/gi, '<img style="max-width:100%;height:auto"'), 132 // console.log('paramparamparamparamparam', param);
133 more: data.shop_wood_desc_rich_text, 133 return new Promise((resolve, reject) => request({
134 // current:1 134 url: read,
135 }) 135 data: param,
136 resolve(data) 136 success: ({
137 }, 137 data: {
138 fail: (res) => { 138 data
139 console.log('fail status ===>', res) 139 }
140 }, 140 }) => {
141 })) 141 // console.log('======>>>>>>>>>>>>>>>>datadatadatadatadatadatadata<<<<<<<<<<<<<<<<<<<<<======', data)
142 }, 142 // console.log('rootStaterootStaterootStaterootState', rootState.details)
143 // 获取购物车列表 143 const specification = rootState.details.specification == undefined ? [] : rootState
144 getCartNumber({ commit }, param) { 144 .details.specification;
145 return new Promise((resolve) => request({ 145 specification[0].key = "frame_width";
146 url: cartList, 146 specification[0].slength = data.frame_width;
147 data: param, 147 specification[1].key = "lens_width";
148 success: ({ data: { data } }) => { 148 specification[1].slength = data.lens_width;
149 let number = 0 149 specification[2].key = "glass_height";
150 for (let index = 0; index < data.length; index++) { 150 specification[2].slength = data.glass_height;
151 number += Number(data[index].num) 151 specification[3].key = "nose_width";
152 } 152 specification[3].slength = data.nose_bridge;
153 commit('CART', number) 153 specification[4].key = "leg_long";
154 }, 154 specification[4].slength = data.leg_temple;
155 })) 155 specification[5].key = "weight";
156 }, 156 specification[5].slength = data.frame_weight;
157 // 生成分享海报 157
158 post({ commit }, param) { 158 const parameter = {
159 return new Promise((resolve) => request({ 159 frame_weight: data.frame_weight,
160 url: makePost, 160 frame_width: data.frame_width,
161 data: param, 161 glass_height: data.glass_height,
162 success: ({ data }) => { 162 nose_width: data.nose_bridge,
163 commit('POST', data.data) 163 lens_width: data.lens_width,
164 resolve() 164 leg_long: data.leg_temple,
165 }, 165 weight: data.frame_weight,
166 })) 166 }
167 }, 167 for (let index = 0; index < specification.length; index++) {
168 } 168 if (specification[index].key !== 'weight') {
169 169 specification[index].slength = `${parameter[specification[index].key]}mm`
170 export default { 170 } else {
171 namespaced: true, 171 if (parameter[specification[index].key] == 0) {
172 state, 172 specification[index].slength = '未知重量'
173 mutations, 173 } else {
174 actions, 174 specification[index].slength = `${parameter[specification[index].key]}克`
175 }
176
177 }
178 }
179
180 const Tag = data.tag_defined
181 if (Tag.Age == undefined || Tag.Age == null) {
182 Tag.Age = []
183 }
184 console.log('TagTagTagTagTagTagTag=======', Tag);
185 commit('INIT', {
186 goodInfo: data,
187 skuList: data.sku,
188 carousel: data.sku[0].sku_pic_arr_http,
189 goodsInfo: {
190 name: data.shop_wood_name,
191 price: data.sales_price,
192 discountPrice: data.sales_price - Number(0),
193 tradeNumber: data.sales_num,
194 },
195 Tag:Tag,
196 specification,
197 evaluate: {
198 rate: 5,
199 tag: data.judge.list,
200 // star: parseInt(5 * Number(data.judgeInfo.good.slice(0, -1)) / 100),
201 star: 5,
202 },
203 // eslint-disable-next-line
204 // more: data.prodIntro1.replace(/\<img/gi, '<img style="max-width:100%;height:auto"'),
205 more: data.shop_wood_desc_rich_text,
206 // current:1
207 })
208 resolve(data)
209 },
210 fail: (res) => {
211 console.log('fail status ===>', res)
212 },
213 }))
214 },
215 // 获取购物车列表
216 getCartNumber({
217 commit
218 }, param) {
219 return new Promise((resolve) => request({
220 url: cartList,
221 data: param,
222 success: ({
223 data: {
224 data
225 }
226 }) => {
227 let number = 0
228 for (let index = 0; index < data.length; index++) {
229 number += Number(data[index].num)
230 }
231 commit('CART', number)
232 },
233 }))
234 },
235 // 生成分享海报
236 post({
237 commit
238 }, param) {
239 return new Promise((resolve) => request({
240 url: makePost,
241 data: param,
242 success: ({
243 data
244 }) => {
245 commit('POST', data.data)
246 resolve()
247 },
248 }))
249 },
250 }
251
252 export default {
253 namespaced: true,
254 state,
255 mutations,
256 actions,
175 } 257 }
176 258
src/store/modules/myLoveList.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 mylovelist, 5 mylovelist,
6 myloveadd, 6 myloveadd,
7 myloveupdate, 7 myloveupdate,
8 } = urlAlias 8 } = urlAlias
9 9
10 const state = { 10 const state = {
11 loveList: [], 11 loveList: [],
12 } 12 }
13 13
14 const mutations = { 14 const mutations = {
15 INIT: (state, data) => { 15 INIT: (state, data) => {
16 state.loveList = data 16 state.loveList = data
17 }, 17 },
18 // 更新关心人验光单 18 // 更新关心人验光单
19 UPDATE: (state, data) => { 19 UPDATE: (state, data) => {
20 // state.loveList.push(data) 20 // state.loveList.push(data)
21 // console.log('UPDATA=====>',data) 21 // console.log('UPDATA=====>',data)
22 }, 22 },
23 } 23 }
24 24
25 const actions = { 25 const actions = {
26 getLoveList({ commit }, param) { 26 getLoveList({ commit }, param) {
27 request({ 27 request({
28 url: mylovelist, 28 url: mylovelist,
29 data: param, 29 data: param,
30 success: (res) => { 30 success: (res) => {
31 // console.log(res.data); 31 // console.log(res.data);
32 commit('INIT', res.data.data) 32 commit('INIT', res.data.data.list)
33 }, 33 },
34 }) 34 })
35 }, 35 },
36 addMylove({ commit }, param) { 36 addMylove({ commit }, param) {
37 console.log('myloveupdate-parm====>', param) 37 // console.log('myloveupdate-parm====>', param)
38 return new Promise((resolve) => request({ 38 return new Promise((resolve) => request({
39 url: myloveadd, 39 url: myloveadd,
40 data: param, 40 data: param,
41 success: (res) => { 41 success: (res) => {
42 console.log('addMylove-parm====>', param) 42 console.log('addMylove-parm====>', param)
43 console.log(res.data) 43 // console.log(res.data)
44 resolve(res.data) 44 resolve(res.data)
45 // commit("ADD", args); 45 // commit("ADD", args);
46 }, 46 },
47 })) 47 }))
48 }, 48 },
49 updateMylove({ commit }, param) { 49 updateMylove({ commit }, param) {
50 request({ 50 request({
51 url: myloveupdate, 51 url: myloveupdate,
52 data: param, 52 data: param,
53 success: (res) => { 53 success: (res) => {
54 console.log('myloveupdate-parm====>', param) 54 console.log('myloveupdate-parm====>', param)
55 console.log(res) 55 // console.log(res)
56 // commit("UPDATE", param); 56 // commit("UPDATE", param);
57 }, 57 },
58 }) 58 })
59 }, 59 },
60 60
61 } 61 }
62 62
63 export default { 63 export default {
64 namespaced: true, 64 namespaced: true,
65 state, 65 state,
66 mutations, 66 mutations,
67 actions, 67 actions,
68 } 68 }
69 69
src/store/modules/myOrder.js
1 import urlAlias from '../url'; 1 import urlAlias from '../url';
2 import request from '../request'; 2 import request from '../request';
3
4 const {
5 myOrderList
6 } = urlAlias
3 7
4 const { 8 /*
5 myOrderList 9 const data = {
6 } = urlAlias 10 data: [
7 11 {
8 // const data = { 12 finished_time: null,
9 // data: [ 13 is_refound: "0",
10 // { 14 mch_id: "1436019502",
11 // finished_time: null, 15 money_of_dcw: "0",
12 // is_refound: "0", 16 money_of_partner: "0",
13 // mch_id: "1436019502", 17 money_of_shop: "0",
14 // money_of_dcw: "0", 18 orderJudge: false,
15 // money_of_partner: "0", 19 order_info: {
16 // money_of_shop: "0", 20 address:{
17 // orderJudge: false, 21 cityName: "镇江市",
18 // order_info: { 22 countyName: "丹阳市",
19 // address:{ 23 detailInfo: "延陵镇柳茹村卫生室附近秀野堂农业发展有限公司",
20 // cityName: "镇江市", 24 errMsg: "chooseAddress:ok",
21 // countyName: "丹阳市", 25 nationalCode: "321181",
22 // detailInfo: "延陵镇柳茹村卫生室附近秀野堂农业发展有限公司", 26 postalCode: "212300",
23 // errMsg: "chooseAddress:ok", 27 provinceName: "江苏省",
24 // nationalCode: "321181", 28 telNumber: "15896379277",
25 // postalCode: "212300", 29 userName: "点餐汪客服",
26 // provinceName: "江苏省", 30 },
27 // telNumber: "15896379277", 31 cartinfo:['11', '12'],
28 // userName: "点餐汪客服", 32 keyname: "1_1587129366",
29 // }, 33 lefttime: 179995,
30 // cartinfo:['11', '12'], 34 list:[
31 // keyname: "1_1587129366", 35 {
32 // lefttime: 179995, 36 cart_id: "11",
33 // list:[ 37 imgUrl: "https://glass.xiuyetang.com//upload_jk/4/4_0_3FDA03.jpg",
34 // { 38 img_index_url: null,
35 // cart_id: "11", 39 memo: "志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流,01-8701",
36 // imgUrl: "https://glass.xiuyetang.com//upload_jk/4/4_0_3FDA03.jpg", 40 mp_id: "1",
37 // img_index_url: null, 41 nowPrice: 100,
38 // memo: "志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流,01-8701", 42 num: "2",
39 // mp_id: "1", 43 oldPrice: "0",
40 // nowPrice: 100, 44 p_discount: "1",
41 // num: "2", 45 p_name: "01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流",
42 // oldPrice: "0", 46 p_root_index: "1",
43 // p_discount: "1", 47 p_sale_price: "0",
44 // p_name: "01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流", 48 peopleName: "me",
45 // p_root_index: "1", 49 pics: '',
46 // p_sale_price: "0", 50 pid: "4",
47 // peopleName: "me", 51 sk_id: "38",
48 // pics: '', 52 },
49 // pid: "4", 53 ],
50 // sk_id: "38", 54 orderDesc: "总共包括有:01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流在内的1件商品",
51 // }, 55 total_fee: 100
52 // ], 56 },
53 // orderDesc: "总共包括有:01-8701志平防蓝光-防辐射电脑网课眼镜,TR90弹性漆,近视镜,青春潮流在内的1件商品", 57 partner_uid: "0",
54 // total_fee: 100 58 pay_cate: "2020",
55 // }, 59 pay_id: "3",
56 // partner_uid: "0", 60 pay_time: "2020-04-17 21:16:12",
57 // pay_cate: "2020", 61 pay_wood_desc: "在【非常戴镜】的微信付款凭证",
58 // pay_id: "3", 62 pay_wood_id: "fcdj-1-1_1587129366",
59 // pay_time: "2020-04-17 21:16:12", 63 prepay_id: "wx172116124528226bf1a8adad1662456500",
60 // pay_wood_desc: "在【非常戴镜】的微信付款凭证", 64 re_check_staus: "0",
61 // pay_wood_id: "fcdj-1-1_1587129366", 65 shopid: "0",
62 // prepay_id: "wx172116124528226bf1a8adad1662456500", 66 split_userid: "0",
63 // re_check_staus: "0", 67 status: "1",
64 // shopid: "0", 68 total_fee: "100",
65 // split_userid: "0", 69 uid: "1",
66 // status: "1", 70 }
67 // total_fee: "100", 71 ],
68 // uid: "1", 72 msg: "订单列表",
69 // } 73 status: 0,
70 // ], 74 }
71 // msg: "订单列表", 75 */
72 // status: 0, 76
73 // } 77 const state = {
74 78 orderList: [],
75 const state = { 79 };
76 orderList: [], 80
77 }; 81 const mutations = {
78 82 INIT: (state, data) => {
79 const mutations = { 83 state.orderList = data;
80 INIT: (state, data) => { 84 },
81 state.orderList = data; 85 };
82 }, 86
83 }; 87 const actions = {
84 88 getList({
85 const actions = { 89 commit
86 getList({ 90 }, param) {
87 commit 91 request({
88 }, param) { 92 url: myOrderList,
89 request({ 93 data: {
90 url: myOrderList, 94 uid: 76,
91 data: param, 95 order_status:200000
92 success: (res) => { 96 },
93 console.log('myOrderList', res.data); 97 success: (res) => {
94 commit("INIT", res.data.data); 98 // console.log('myOrderList', res.data);
95 }, 99 commit("INIT", res.data.data);
96 }) 100 // commit(/"INIT", data);
97 } 101 },
102 })
103 }
104 }
105
106 export default {
107 namespaced: true,
108 state,
109 mutations,
110 actions,
98 } 111 }
99
1 const urlAlias = { 1 const urlAlias = {
2 // 详情 2 // 详情
3 read: '/api/frontend/wood/detail', // 获取商品信息 3 read: '/api/frontend/wood/detail', // 获取商品信息
4 4
5 // 首页 5 // 首页
6 shopList: '/api/frontend/wood/list', // 获取首页商品列表 6 shopList: '/api/frontend/wood/list', // 获取首页商品列表
7 // category: '/app/prod/category2', 7 // category: '/app/prod/category2',
8 category: '/api/frontend/wood/category',// 获取首页商品分类 8 category: '/api/frontend/wood/category',// 获取首页商品分类
9 search: '/app/prod/search', // 首页搜索商品 9 search: '/app/prod/search', // 首页搜索商品
10 10
11 // 登陆 11 // 登陆
12 login: '/app/glass/getOpenId', // 登陆 12 login: '/api/frontend/glass/getOpenId', // 登陆
13 getUserInfo: '/app/glass/userinfo', // 获取用户信息 13 getUserInfo: '/api/frontend/glass/userinfo', // 获取用户信息
14 14
15 // 我的订单 15 // 我的订单
16 orderList: '/app/order/list', // 获取订单列表 16 orderList: '/api/frontend/order/list', // 获取订单列表
17 myOrderList: '/app/order/list3', // 获取订单列表 17 myOrderList: '/api/frontend/order/list', // 获取订单列表
18 orderRead: '/app/order/read', // 获取订单详情 18 orderRead: '/api/frontend/order/read', // 获取订单详情
19 cancelOrder: '/app/order/wait/del', // 取消订单 19 cancelOrder: '/api/frontend/order/wait/del', // 取消订单
20 statusConfirm: '/app/order/statusConfirm', // 订单操作 20 statusConfirm: '/api/frontend/order/statusConfirm', // 订单操作
21 payLog: '/app/pay/log', // 调起支付 21 payLog: '/api/frontend/pay/log', // 调起支付
22 orderBuild: '/app/order/build', // 加购后生成订单 22 orderBuild: '/api/frontend/order/build', // 加购后生成订单
23 buyNow: '/app/order/buynow', // 立即购买生成订单 23 buyNow: '/api/frontend/order/buynow', // 立即购买生成订单
24 pay: '/app/pay/log', // 支付接口 24 pay: '/api/frontend/pay/log', // 支付接口
25 25
26 // 购物车 26 // 购物车
27 cartList: '/api/frontend/cart/list', // 获取购物车列表 27 cartList: '/api/frontend/cart/list', // 获取购物车列表
28 cartModi: '/api/frontend/cart/modi', // 修改购物车 28 cartModi: '/api/frontend/cart/modi', // 修改购物车
29 cartDel: '/api/frontend/cart/del', // 删除购物车 29 cartDel: '/api/frontend/cart/del', // 删除购物车
30 cartAdd: '/api/frontend/cart/add', // 添加购物车 30 cartAdd: '/api/frontend/cart/add', // 添加购物车
31 31
32 // 我的 32 // 我的
33 recommandList: '/app/prod/recommand', // 获取用户个性化推荐商品 33 recommandList: '/api/frontend/wood/recommand', // 获取用户个性化推荐商品
34 34
35 // 镜框选购页 35 // 镜框选购页
36 detailStandardList: '/app/prod/read', // 获取商品的详细信息 36 detailStandardList: '/api/frontend/prod/read', // 获取商品的详细信息
37 // 选购页 37 // 选购页
38 detailStandardUrl: '/app/prod/read', // 获取商品的详细信息 38 detailStandardUrl: '/api/frontend/prod/read', // 获取商品的详细信息
39 makePost: '/app/glass/makeProdAdvPic', // 生成分享海报 39 makePost: '/api/frontend/glass/makeProdAdvPic', // 生成分享海报
40 40
41 // 地址管理 41 // 地址管理
42 editAddress: '/app/address/edit_address', // 编辑地址 42 editAddress: '/api/frontend/user/address/modi', // 编辑地址
43 addressList: '/app/address/get_address_list', // 获取用户地址列表 43 addAddress: '/api/frontend/user/address/add', // 添加地址
44 getAddress: '/app/address/get_address_by_id', // 获取用户某一地址信息 44 addressList: '/api/frontend/user/address/list', // 获取用户地址列表
45 getDefaultAddress: '/app/address/get_default_address', // 获取用户默认地址信息 45 getAddress: '/api/frontend/user/address/get', // 获取用户某一地址信息
46 getDefaultAddress: '/api/frontend/user/address/get', // 获取用户默认地址信息
46 47
47 // 用户数据 48 // 用户数据
48 mylovelist: '/app/user/mylovelist', // 关心的人的数据 49 mylovelist: '/api/frontend/user/mylovelist', // 关心的人的数据
49 myloveadd: '/app/user/myloveadd', // 添加关心的人 50 myloveadd: '/api/frontend/user/myloveadd', // 添加关心的人
50 myloveupdate: '/app/user/myloveupdate', // 更新关心人的数据 51 myloveupdate: '/api/frontend/user/myloveupdate', // 更新关心人的数据
51 } 52 }
52 53
53 export default urlAlias 54 export default urlAlias
54 55