Commit eed6c3ca9b53ee18cc16870e4d22da46b33bbd01

Authored by BigBoss
1 parent 1a4cad7196
Exists in master

订单列表添加支付和取消功能,修改订单详情报错的bug

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}" @touchmove.stop.prevent="moveHandle" @click="closeSheet()">
4 <scroll-view scroll-y="true" class="sheetView" :class="{sheetView_active:isShowBottom}" @click.stop="stopEvent()" > 4 <scroll-view scroll-y="true" class="sheetView" :class="{sheetView_active:isShowBottom}" @click.stop="stopEvent()" >
5 <view class="BottomSheetContent"> 5 <view class="BottomSheetContent">
6 <view class="goodInfo"> 6 <view class="goodInfo">
7 <view class="imageWrap"> 7 <view class="imageWrap">
8 <image 8 <image
9 :src="skuItem.pic" 9 :src="skuItem.pic"
10 mode="aspectFill" 10 mode="aspectFill"
11 style="width: 188rpx;height: 168rpx;" 11 style="width: 188rpx;height: 168rpx;"
12 12
13 ></image> 13 ></image>
14 14
15 </view> 15 </view>
16 <view class="infoRight"> 16 <view class="infoRight">
17 <text class="goodName">{{goodInfo.p_name}}</text> 17 <text class="goodName">{{goodInfo.p_name}}</text>
18 <text class="remarks">支持7天无理由退货 顺丰发货</text> 18 <text class="remarks">支持7天无理由退货 顺丰发货</text>
19 <view class="priceBox"> 19 <view class="priceBox">
20 <view class="price">¥{{skuItem.real_price || '暂无'}}</view> 20 <view class="price">¥{{skuItem.real_price || '暂无'}}</view>
21 <text>(限购{{maxCount}}副)</text> 21 <text>(限购{{maxCount}}副)</text>
22 <view class="counter"> 22 <view class="counter">
23 <view 23 <view
24 class="btn" 24 class="btn"
25 disabled="this.addDisabled" 25 disabled="this.addDisabled"
26 type="default" 26 type="default"
27 @click="counter(false)" 27 @click="counter(false)"
28 >-</view> 28 >-</view>
29 <text>{{count}}</text> 29 <text>{{count}}</text>
30 <view 30 <view
31 class="btn" 31 class="btn"
32 disabled="this.desDisabled" 32 disabled="this.desDisabled"
33 type="default" 33 type="default"
34 @click="counter(true)" 34 @click="counter(true)"
35 >+</view> 35 >+</view>
36 </view> 36 </view>
37 </view> 37 </view>
38 </view> 38 </view>
39 </view> 39 </view>
40 <view class="peopleChoose"> 40 <view class="peopleChoose">
41 <view class="title">选择使用人</view> 41 <view class="title">选择使用人</view>
42 <view class="loveList"> 42 <view class="loveList">
43 <view class="peopleName" v-for="(item,index) in loveList" :key='index' :class="{ active2: loveCurrent === index }" 43 <view class="peopleName" v-for="(item,index) in loveList" :key='index' :class="{ active2: loveCurrent === index }"
44 @click="onClickLoveItem(index,item.name)"> 44 @click="onClickLoveItem(index,item.name)">
45 {{item.name}} 45 {{item.name}}
46 </view> 46 </view>
47 </view> 47 </view>
48 </view> 48 </view>
49 <view class="goods-data" v-if="isCart !== 3"> 49 <view class="goods-data" v-if="isCart !== 3">
50 <view class="opCollapse"> 50 <view class="opCollapse">
51 <view class="body"> 51 <view class="body">
52 <template v-if="opIsOpen"> 52 <template v-if="opIsOpen">
53 <view class="goods-form"> 53 <view class="goods-form">
54 <view class="p1"> 54 <view class="p1">
55 <image class="image2" src="../../static/img/myOpticsData/dataWrite.png" mode="aspectFit"></image> 55 <image class="image2" src="../../static/img/myOpticsData/dataWrite.png" mode="aspectFit"></image>
56 填写验光数据 56 填写验光数据
57 </view> 57 </view>
58 <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text> 58 <text class="p2">没有验光数据?请到线下眼镜店验光哦~</text>
59 <view class="picker"> 59 <view class="picker">
60 <view class="picker-choice"> 60 <view class="picker-choice">
61 <view class="choice-left"> 61 <view class="choice-left">
62 <text class="pd">验光单取名:</text> 62 <text class="pd">验光单取名:</text>
63 </view> 63 </view>
64 <input type="text" @blur="handleInput" class="input" 64 <input type="text" @blur="handleInput" class="input"
65 placeholder="请输入名称" maxlength="20" :value="name" /> 65 placeholder="请输入名称" maxlength="20" :value="name" />
66 </view> 66 </view>
67 </view> 67 </view>
68 <view class="picker" > 68 <view class="picker" >
69 <view class="picker-choice"> 69 <view class="picker-choice">
70 <view class="choice-left"> 70 <view class="choice-left">
71 <text class="p11">{{pickerInfoList[0].nameC}}</text> 71 <text class="p11">{{pickerInfoList[0].nameC}}</text>
72 <text class="p12">{{pickerInfoList[0].nameE}}</text> 72 <text class="p12">{{pickerInfoList[0].nameE}}</text>
73 </view> 73 </view>
74 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text> 74 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text>
75 <!-- <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> --> 75 <!-- <text class="p14">{{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}</text> -->
76 <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1"> 76 <picker @change="bindPickerChange01" :value="pickerInfoList[0].nameIndex1" :range="pickerInfoList[0].nameArray1">
77 <view class="p14"> 77 <view class="p14">
78 {{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}} 78 {{pickerInfoList[0].nameArray1[pickerInfoList[0].nameIndex1]}}
79 <image src="../../static/detail-tabicon.png" ></image> 79 <image src="../../static/detail-tabicon.png" ></image>
80 </view> 80 </view>
81 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 81 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
82 </picker> 82 </picker>
83 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text> 83 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text>
84 <!-- <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> --> 84 <!-- <text class="p14">{{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}</text> -->
85 <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2"> 85 <picker @change="bindPickerChange02" :value="pickerInfoList[0].nameIndex2" :range="pickerInfoList[0].nameArray2">
86 <view class="p14"> 86 <view class="p14">
87 {{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}} 87 {{pickerInfoList[0].nameArray2[pickerInfoList[0].nameIndex2]}}
88 <image src="../../static/detail-tabicon.png" ></image> 88 <image src="../../static/detail-tabicon.png" ></image>
89 </view> 89 </view>
90 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 90 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
91 </picker> 91 </picker>
92 </view> 92 </view>
93 </view> 93 </view>
94 <view class="picker" > 94 <view class="picker" >
95 <view class="picker-choice"> 95 <view class="picker-choice">
96 <view class="choice-left"> 96 <view class="choice-left">
97 <text class="p11">{{pickerInfoList[1].nameC}}</text> 97 <text class="p11">{{pickerInfoList[1].nameC}}</text>
98 <text class="p12">{{pickerInfoList[1].nameE}}</text> 98 <text class="p12">{{pickerInfoList[1].nameE}}</text>
99 </view> 99 </view>
100 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text> 100 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text>
101 <!-- <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> --> 101 <!-- <text class="p14">{{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}</text> -->
102 <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1"> 102 <picker @change="bindPickerChange11" :value="pickerInfoList[1].nameIndex1" :range="pickerInfoList[1].nameArray1">
103 <view class="p14"> 103 <view class="p14">
104 {{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}} 104 {{pickerInfoList[1].nameArray1[pickerInfoList[1].nameIndex1]}}
105 <image src="../../static/detail-tabicon.png" ></image> 105 <image src="../../static/detail-tabicon.png" ></image>
106 </view> 106 </view>
107 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 107 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
108 </picker> 108 </picker>
109 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text> 109 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text>
110 <!-- <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> --> 110 <!-- <text class="p14">{{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}</text> -->
111 <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2"> 111 <picker @change="bindPickerChange12" :value="pickerInfoList[1].nameIndex2" :range="pickerInfoList[1].nameArray2">
112 <view class="p14"> 112 <view class="p14">
113 {{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}} 113 {{pickerInfoList[1].nameArray2[pickerInfoList[1].nameIndex2]}}
114 <image src="../../static/detail-tabicon.png" ></image> 114 <image src="../../static/detail-tabicon.png" ></image>
115 </view> 115 </view>
116 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 116 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
117 </picker> 117 </picker>
118 </view> 118 </view>
119 </view> 119 </view>
120 <view class="picker" > 120 <view class="picker" >
121 <view class="picker-choice"> 121 <view class="picker-choice">
122 <view class="choice-left"> 122 <view class="choice-left">
123 <text class="p11">{{pickerInfoList[2].nameC}}</text> 123 <text class="p11">{{pickerInfoList[2].nameC}}</text>
124 <text class="p12">{{pickerInfoList[2].nameE}}</text> 124 <text class="p12">{{pickerInfoList[2].nameE}}</text>
125 </view> 125 </view>
126 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text> 126 <text class="p13">左&nbsp;&nbsp;&nbsp;(OD)</text>
127 <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1"> 127 <picker @change="bindPickerChange21" :value="pickerInfoList[2].nameIndex1" :range="pickerInfoList[2].nameArray1">
128 <view class="p14"> 128 <view class="p14">
129 {{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}} 129 {{pickerInfoList[2].nameArray1[pickerInfoList[2].nameIndex1]}}
130 <image src="../../static/detail-tabicon.png" ></image> 130 <image src="../../static/detail-tabicon.png" ></image>
131 </view> 131 </view>
132 </picker> 132 </picker>
133 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text> 133 <text class="p13">右&nbsp;&nbsp;&nbsp;(OS)</text>
134 <!-- <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> --> 134 <!-- <text class="p14">{{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}</text> -->
135 <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2"> 135 <picker @change="bindPickerChange22" :value="pickerInfoList[2].nameIndex2" :range="pickerInfoList[2].nameArray2">
136 <view class="p14"> 136 <view class="p14">
137 {{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}} 137 {{pickerInfoList[2].nameArray2[pickerInfoList[2].nameIndex2]}}
138 <image src="../../static/detail-tabicon.png" ></image> 138 <image src="../../static/detail-tabicon.png" ></image>
139 </view> 139 </view>
140 <!-- <image src="../../static/detail-tabicon.png" ></image> --> 140 <!-- <image src="../../static/detail-tabicon.png" ></image> -->
141 </picker> 141 </picker>
142 </view> 142 </view>
143 </view> 143 </view>
144 <view class="picker"> 144 <view class="picker">
145 <view class="picker-choice"> 145 <view class="picker-choice">
146 <view class="choice-left"> 146 <view class="choice-left">
147 <text class="pd">瞳距:</text> 147 <text class="pd">瞳距:</text>
148 </view> 148 </view>
149 <input type="digit" @change="handleInputPd" class="input" 149 <input type="digit" @change="handleInputPd" class="input"
150 placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" /> 150 placeholder="请输入瞳距,单位cm" maxlength="20" :value="pd" />
151 </view> 151 </view>
152 </view> 152 </view>
153 <view class="picker" > 153 <view class="picker" >
154 <view class="picker-choice"> 154 <view class="picker-choice">
155 <view class="choice-left"> 155 <view class="choice-left">
156 <text class="p11">{{pickerInfoList[3].nameC}}</text> 156 <text class="p11">{{pickerInfoList[3].nameC}}</text>
157 </view> 157 </view>
158 <text class="p13-date">年&nbsp;&nbsp;&nbsp;(Y)</text> 158 <text class="p13-date">年&nbsp;&nbsp;&nbsp;(Y)</text>
159 <picker @change="bindPickerChange41" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1"> 159 <picker @change="bindPickerChange41" :value="pickerInfoList[3].nameIndex1" :range="pickerInfoList[3].nameArray1">
160 <view class="p14" style="width: 30px;"> 160 <view class="p14" style="width: 30px;">
161 {{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}} 161 {{pickerInfoList[3].nameArray1[pickerInfoList[3].nameIndex1]}}
162 <image src="../../static/detail-tabicon.png" ></image> 162 <image src="../../static/detail-tabicon.png" ></image>
163 </view> 163 </view>
164 </picker> 164 </picker>
165 <text class="p13-date">月&nbsp;&nbsp;&nbsp;(M)</text> 165 <text class="p13-date">月&nbsp;&nbsp;&nbsp;(M)</text>
166 <picker @change="bindPickerChange42" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2"> 166 <picker @change="bindPickerChange42" :value="pickerInfoList[3].nameIndex2" :range="pickerInfoList[3].nameArray2">
167 <view class="p14" style="width: 30px;"> 167 <view class="p14" style="width: 30px;">
168 {{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}} 168 {{pickerInfoList[3].nameArray2[pickerInfoList[3].nameIndex2]}}
169 <image src="../../static/detail-tabicon.png" ></image> 169 <image src="../../static/detail-tabicon.png" ></image>
170 </view> 170 </view>
171 </picker> 171 </picker>
172 <text class="p13-date">日&nbsp;&nbsp;&nbsp;(D)</text> 172 <text class="p13-date">日&nbsp;&nbsp;&nbsp;(D)</text>
173 <picker @change="bindPickerChange43" :value="pickerInfoList[3].nameIndex3" :range="pickerInfoList[3].nameArray3"> 173 <picker @change="bindPickerChange43" :value="pickerInfoList[3].nameIndex3" :range="pickerInfoList[3].nameArray3">
174 <view class="p14" style="width: 30px;"> 174 <view class="p14" style="width: 30px;">
175 {{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}} 175 {{pickerInfoList[3].nameArray3[pickerInfoList[3].nameIndex3]}}
176 <image src="../../static/detail-tabicon.png" ></image> 176 <image src="../../static/detail-tabicon.png" ></image>
177 </view> 177 </view>
178 </picker> 178 </picker>
179 </view> 179 </view>
180 </view> 180 </view>
181 <view class="ipts"> 181 <view class="ipts">
182 <view class="inputItem"> 182 <view class="inputItem">
183 <text class="text">镜片宽度</text> 183 <text class="text">镜片宽度</text>
184 <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth!=='0'?glassInfo.glassWidth:''" placeholder="请输入镜片宽度"/> 184 <input class="input" @input="glassInfoInput($event,0)" type="text" :value="glassInfo.glassWidth!=='0'?glassInfo.glassWidth:''" placeholder="请输入镜片宽度"/>
185 </view> 185 </view>
186 <view class="inputItem"> 186 <view class="inputItem">
187 <text class="text">鼻梁宽度</text> 187 <text class="text">鼻梁宽度</text>
188 <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth!=='0'?glassInfo.norseWidth:''" placeholder="请输入鼻梁宽度"/> 188 <input class="input" @input="glassInfoInput($event,1)" type="text" :value="glassInfo.norseWidth!=='0'?glassInfo.norseWidth:''" placeholder="请输入鼻梁宽度"/>
189 </view> 189 </view>
190 <view class="inputItem"> 190 <view class="inputItem">
191 <text class="text">镜腿长度</text> 191 <text class="text">镜腿长度</text>
192 <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth!=='0'?glassInfo.legWidth:''" placeholder="请输入镜腿长度"/> 192 <input class="input" @input="glassInfoInput($event,2)" type="text" :value="glassInfo.legWidth!=='0'?glassInfo.legWidth:''" placeholder="请输入镜腿长度"/>
193 </view> 193 </view>
194 194
195 </view> 195 </view>
196 <!-- <view class="confirm"> 196 <!-- <view class="confirm">
197 <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image> 197 <image class="image1" :src="confirm ? tabicon[0] : tabicon[1]" @tap="changeConfirm"></image>
198 <text>确认以上输入信息来源于我的验光数据!</text> 198 <text>确认以上输入信息来源于我的验光数据!</text>
199 </view> --> 199 </view> -->
200 </view> 200 </view>
201 </template> 201 </template>
202 <template v-else> 202 <template v-else>
203 <view 203 <view
204 v-for="item in pickerInfoList" 204 v-for="item in pickerInfoList"
205 :key="item.key" 205 :key="item.key"
206 class="bodyBox" 206 class="bodyBox"
207 > 207 >
208 <template v-if="item.nameC==='验光日期'"> 208 <template v-if="item.nameC==='验光日期'">
209 <text class="names">{{item.nameC}}</text> 209 <text class="names">{{item.nameC}}</text>
210 <text style="margin-right: 5px;">{{item.nameArray1[item.nameIndex1]}}年</text> 210 <text style="margin-right: 5px;">{{item.nameArray1[item.nameIndex1]}}年</text>
211 <text style="margin-right: 5px;">{{item.nameArray2[item.nameIndex2]}}月</text> 211 <text style="margin-right: 5px;">{{item.nameArray2[item.nameIndex2]}}月</text>
212 <text>{{item.nameArray3[item.nameIndex2]}}日</text> 212 <text>{{item.nameArray3[item.nameIndex2]}}日</text>
213 </template> 213 </template>
214 <template v-else> 214 <template v-else>
215 <template v-if="item.nameC==='度数'"> 215 <template v-if="item.nameC==='度数'">
216 <text style="display: inline;">*</text> 216 <text style="display: inline;">*</text>
217 </template> 217 </template>
218 218
219 <text class="names">{{item.nameC}}</text> 219 <text class="names">{{item.nameC}}</text>
220 <text style="margin-right: 10px;">左&nbsp;{{item.nameArray1[item.nameIndex1]}}</text> 220 <text style="margin-right: 10px;">左&nbsp;{{item.nameArray1[item.nameIndex1]}}</text>
221 <text>右&nbsp;{{item.nameArray2[item.nameIndex2]}}</text> 221 <text>右&nbsp;{{item.nameArray2[item.nameIndex2]}}</text>
222 </template> 222 </template>
223 </view> 223 </view>
224 </template> 224 </template>
225 </view> 225 </view>
226 </view> 226 </view>
227 </view> 227 </view>
228 <view class="choose"> 228 <view class="choose">
229 <view 229 <view
230 class="chooseItem_1_content" 230 class="chooseItem_1_content"
231 v-for="(item,index) in attrList" 231 v-for="(item,index) in attrList"
232 :key="index" 232 :key="index"
233 > 233 >
234 <UniCollapse @change="changeShow(index)"> 234 <UniCollapse @change="changeShow(index)">
235 <UniCollapseItem 235 <UniCollapseItem
236 :open="show[index]" 236 :open="show[index]"
237 :title="item.meta_name" 237 :title="item.meta_name"
238 showAnimation=false 238 showAnimation=false
239 > 239 >
240 <view class="chooseItem_1_content"> 240 <view class="chooseItem_1_content">
241 <view class="itemsWrap" v-if="isCart ==3"> 241 <view class="itemsWrap" v-if="isCart ==3">
242 <view 242 <view
243 class="item2" 243 class="item2"
244 v-for="(one,i) in item.attr" 244 v-for="(one,i) in item.attr"
245 :key="i" 245 :key="i"
246 :class="{ active2: current[index] === i}" 246 :class="{ active2: current[index] === i}"
247 @click="cartOnClickItem(index, i,one.aid)" 247 @click="cartOnClickItem(index, i,one.aid)"
248 >{{one.name}}</view> 248 >{{one.name}}</view>
249 </view> 249 </view>
250 <view class="itemsWrap" v-else> 250 <view class="itemsWrap" v-else>
251 <view 251 <view
252 class="item2" 252 class="item2"
253 v-for="(one,i) in item.attr" 253 v-for="(one,i) in item.attr"
254 :key="i" 254 :key="i"
255 :class="{ active2: current[index] === i }" 255 :class="{ active2: current[index] === i }"
256 @click="cartOnClickItem(index, i,one.aid)" 256 @click="cartOnClickItem(index, i,one.aid)"
257 >{{one.name}}</view> 257 >{{one.name}}</view>
258 </view> 258 </view>
259 </view> 259 </view>
260 </UniCollapseItem> 260 </UniCollapseItem>
261 </UniCollapse> 261 </UniCollapse>
262 <view 262 <view
263 class="chooseRes" 263 class="chooseRes"
264 v-show="!show[index]" 264 v-show="!show[index]"
265 >* {{attrList[index].attr[current[index]].name}}</view> 265 >* {{attrList[index].attr[current[index]].name}}</view>
266 </view> 266 </view>
267 </view> 267 </view>
268 <view 268 <view
269 class="button" 269 class="button"
270 @click.native="addCart" 270 @click.native="addCart"
271 v-if="isCart == 1" 271 v-if="isCart == 1"
272 > 272 >
273 加入购物车 273 加入购物车
274 </view> 274 </view>
275 <view 275 <view
276 class="button" 276 class="button"
277 @click="toComfirmOrder" 277 @click="toComfirmOrder"
278 v-if="isCart == 2" 278 v-if="isCart == 2"
279 > 279 >
280 立即结算 280 立即结算
281 </view> 281 </view>
282 <view 282 <view
283 class="button" 283 class="button"
284 @click="comfirmChoose" 284 @click="comfirmChoose"
285 v-if="isCart == 3" 285 v-if="isCart == 3"
286 > 286 >
287 确定 287 确定
288 </view> 288 </view>
289 </view> 289 </view>
290 </scroll-view> 290 </scroll-view>
291 </view> 291 </view>
292 </view> 292 </view>
293 </template> 293 </template>
294 <script> 294 <script>
295 import UniCollapse from '@/components/UniCollapse/UniCollapse.vue' 295 import UniCollapse from '@/components/UniCollapse/UniCollapse.vue'
296 import UniCollapseItem from '@/components/UniCollapseItem/UniCollapseItem.vue' 296 import UniCollapseItem from '@/components/UniCollapseItem/UniCollapseItem.vue'
297 import store from '@/store' 297 import store from '@/store'
298 export default { 298 export default {
299 components: { 299 components: {
300 UniCollapse, 300 UniCollapse,
301 UniCollapseItem, 301 UniCollapseItem,
302 }, 302 },
303 props: { 303 props: {
304 isShowBottom : Boolean, 304 isShowBottom : Boolean,
305 pid: Number, 305 pid: Number,
306 sk_id:String, 306 sk_id:String,
307 propMpId:String, 307 propMpId:String,
308 goodInfo:Object, 308 goodInfo:Object,
309 isCart:Number, 309 isCart:Number,
310 cart_id:Number, 310 cart_id:Number,
311 index:Number 311 index:Number
312 }, 312 },
313 data() { 313 data() {
314 return { 314 return {
315 loveCurrent:Number, 315 loveCurrent:Number,
316 count: 1, 316 count: 1,
317 // pid: 0, 317 // pid: 0,
318 maxCount: 20, 318 maxCount: 20,
319 dataName: '', // 验光数据人员名称 319 dataName: '', // 验光数据人员名称
320 isDataName: false, // 是否是已存在的人员数据 320 isDataName: false, // 是否是已存在的人员数据
321 dataConfirm: false, // 已确认所输入验光数据 321 dataConfirm: false, // 已确认所输入验光数据
322 opIsOpen: true, 322 opIsOpen: true,
323 addDisabled: false, 323 addDisabled: false,
324 desDisabled: false, 324 desDisabled: false,
325 current: [], 325 current: [],
326 show: [true,true], 326 show: [true,true],
327 checkedData: {}, 327 checkedData: {},
328 // 度数相关数据 328 // 度数相关数据
329 pickerInfoList: [ 329 pickerInfoList: [
330 { nameC: '度数', nameE: '(SPH)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 0 }, 330 { nameC: '度数', nameE: '(SPH)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 0 },
331 { nameC: '散光', nameE: '(CYL)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 1 }, 331 { nameC: '散光', nameE: '(CYL)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 1 },
332 { nameC: '散光轴位', nameE: '(AXI)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 2 }, 332 { nameC: '散光轴位', nameE: '(AXI)', nameArray1: [''], nameIndex1: 0, nameArray2: [''], nameIndex2: 0, key: 2 },
333 { nameC: '验光日期', nameE: '', nameArray1: [''], nameIndex1: 0, nameArray2: ['', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], nameIndex2: 0, nameArray3: [''], nameIndex3: 0 }, 333 { nameC: '验光日期', nameE: '', nameArray1: [''], nameIndex1: 0, nameArray2: ['', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], nameIndex2: 0, nameArray3: [''], nameIndex3: 0 },
334 ], 334 ],
335 // confirm: false, // 用户是否确认 335 // confirm: false, // 用户是否确认
336 // tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'], 336 // tabicon: ['/static/detail-button.png', '/static/detail-button-unselected.png'],
337 name: '', 337 name: '',
338 oldname: '', // 用于判读用户是否改变名字 338 oldname: '', // 用于判读用户是否改变名字
339 pickerInfoChioce: { 339 pickerInfoChioce: {
340 leftSph: '', 340 leftSph: '',
341 rightSph: '', 341 rightSph: '',
342 leftCyl: '', 342 leftCyl: '',
343 rightCyl: '', 343 rightCyl: '',
344 leftAxi: '', 344 leftAxi: '',
345 rightAxi: '', 345 rightAxi: '',
346 time: { 346 time: {
347 year: 0, 347 year: 0,
348 month: 0, 348 month: 0,
349 day: 0, 349 day: 0,
350 }, 350 },
351 }, 351 },
352 glassInfo:{ 352 glassInfo:{
353 glassWidth:Number,//镜片宽度 353 glassWidth:Number,//镜片宽度
354 norseWidth:Number,//鼻宽 354 norseWidth:Number,//鼻宽
355 legWidth:Number//镜腿长度 355 legWidth:Number//镜腿长度
356 }, 356 },
357 pd: '', // 瞳距 357 pd: '', // 瞳距
358 oldpd: '', // 用于判断用户是否改变瞳距 358 oldpd: '', // 用于判断用户是否改变瞳距
359 kinds: 1, // kinds=1,提交为新增验光,2为修改 359 kinds: 1, // kinds=1,提交为新增验光,2为修改
360 mp_id: Number, 360 mp_id: Number,
361 skuValueArray:[], 361 skuValueArray:[],
362 skId:String 362 skId:String
363 } 363 }
364 }, 364 },
365 computed: { 365 computed: {
366 //进购物车选择的人的index 366 //进购物车选择的人的index
367 p_current(){ 367 p_current(){
368 const getLoveItemIndex = (item) => item.mp_id == this.propMpId 368 const getLoveItemIndex = (item) => item.mp_id == this.propMpId
369 const p_current = this.$store.state.myLoveList.loveList.findIndex(getLoveItemIndex ) 369 const p_current = this.$store.state.myLoveList.loveList.findIndex(getLoveItemIndex )
370 if(this.isCart == 3){ 370 if(this.isCart == 3){
371 this.loveCurrent = p_current 371 this.loveCurrent = p_current
372 } 372 }
373 return p_current 373 return p_current
374 }, 374 },
375 arr_current(){ 375 arr_current(){
376 if(this.isCart == 3){ 376 if(this.isCart == 3){
377 const skId = this.sk_id 377 const skId = this.sk_id
378 const skuValue = this.skuItem.sku_value 378 const skuValue = this.skuItem.sku_value
379 const skuValueArray = skuValue.split('_') 379 const skuValueArray = skuValue.split('_')
380 this.skuValueArray = skuValueArray 380 this.skuValueArray = skuValueArray
381 const attrList = this.$store.state.read.goodInfo.attrList 381 const attrList = this.$store.state.read.goodInfo.attrList
382 for (let i = 0;i<attrList.length;i++) { 382 for (let i = 0;i<attrList.length;i++) {
383 const getArrIndex = (item) => item.aid == skuValueArray[i] 383 const getArrIndex = (item) => item.aid == skuValueArray[i]
384 const arr_current = this.$store.state.read.goodInfo.attrList[i].attr.findIndex(getArrIndex ) 384 const arr_current = this.$store.state.read.goodInfo.attrList[i].attr.findIndex(getArrIndex )
385 // console.log('arr_current',arr_current) 385 // console.log('arr_current',arr_current)
386 this.current.push(arr_current) 386 this.current.push(arr_current)
387 } 387 }
388 }else{ 388 }else{
389 return null 389 return null
390 } 390 }
391 }, 391 },
392 loveList() { 392 loveList() {
393 return this.$store.state.myLoveList.loveList || [] 393 return this.$store.state.myLoveList.loveList || []
394 }, 394 },
395 attrList() { 395 attrList() {
396 // console.log('attrList',this.$store.state.read.goodInfo.attrList) 396 // console.log('attrList',this.$store.state.read.goodInfo.attrList)
397 let attrList = this.$store.state.read.goodInfo.attrList 397 let attrList = this.$store.state.read.goodInfo.attrList
398 if(attrList !== undefined){ 398 if(attrList !== undefined){
399 return attrList 399 return attrList
400 }else{ 400 }else{
401 return [] 401 return []
402 } 402 }
403 }, 403 },
404 skuList() { 404 skuList() {
405 // console.log('skuList',this.$store.state.read.goodInfo.skuList) 405 // console.log('skuList',this.$store.state.read.goodInfo.skuList)
406 return this.$store.state.read.goodInfo.skuList 406 return this.$store.state.read.goodInfo.skuList
407 }, 407 },
408 skuItem(){ 408 skuItem(){
409 // if(this.isCart == 3){ 409 // if(this.isCart == 3){
410 const skuList = this.$store.state.read.goodInfo.skuList 410 const skuList = this.$store.state.read.goodInfo.skuList
411 const skuItem = skuList.filter(item => item.sk_id === this.skId)[0] 411 const skuItem = skuList.filter(item => item.sk_id === this.skId)[0]
412 return skuItem 412 return skuItem
413 // }else{ 413 // }else{
414 // const skuList = this.$store.state.read.goodInfo.skuList 414 // const skuList = this.$store.state.read.goodInfo.skuList
415 // const skuItem = skuList[0] 415 // const skuItem = skuList[0]
416 // return skuItem 416 // return skuItem
417 // } 417 // }
418 }, 418 },
419 mpList() { 419 mpList() {
420 420
421 return this.$store.state.myLoveList.loveList 421 return this.$store.state.myLoveList.loveList
422 }, 422 },
423 glassInfoRight(){ 423 glassInfoRight(){
424 const glassInfoArr = Object.values(this.glassInfo) 424 const glassInfoArr = Object.values(this.glassInfo)
425 // console.log('glassInfoArr',glassInfoArr.find(item => item == '0')) 425 // console.log('glassInfoArr',glassInfoArr.find(item => item == '0'))
426 return glassInfoArr.find(item => item == '0') ==undefined 426 return glassInfoArr.find(item => item == '0') ==undefined
427 } 427 }
428 }, 428 },
429 // beforeDestroy() {
430 // //获取关心的人列表
431 // store.dispatch('myLoveList/getLoveList', {
432 // uid: this.$store.state.user.userInfo.uid,
433 // });
434 // },
435 created() { 429 created() {
436 this.skuValueArray = this.skuList[0].sku_value.split("_") 430 this.skuValueArray = this.skuList[0].sku_value.split("_")
437 // console.log(this.sk_id) 431 // console.log(this.sk_id)
438 this.mp_id = this.propMpId 432 this.mp_id = this.propMpId
439 const pid = this.pid 433 const pid = this.pid
440 if(this.isCart!==3){ 434 if(this.isCart!==3){
441 this.skId = this.skuList[0].sk_id 435 this.skId = this.skuList[0].sk_id
442 const current = [] 436 const current = []
443 const show = [] 437 const show = []
444 for (let index = 0; index < this.attrList.length; index++) { 438 for (let index = 0; index < this.attrList.length; index++) {
445 current.push(0) 439 current.push(0)
446 show.push(true) 440 show.push(true)
447 } 441 }
448 this.current = current 442 this.current = current
449 this.show = show 443 this.show = show
450 }else{ 444 }else{
451 this.skId = this.sk_id 445 this.skId = this.sk_id
452 } 446 }
453 //获取关心的人列表 447 //获取关心的人列表
454 store.dispatch('myLoveList/getLoveList', { 448 store.dispatch('myLoveList/getLoveList', {
455 uid: this.$store.state.user.userInfo.uid, 449 uid: this.$store.state.user.userInfo.uid,
456 }); 450 });
457 // 初始化SPL、CYL、AXI的值 451 // 初始化SPL、CYL、AXI的值
458 for (let j = 0; j < 3; j++) { 452 for (let j = 0; j < 3; j++) {
459 for (let i = -12; i < 6; i++) { 453 for (let i = -12; i < 6; i++) {
460 this.pickerInfoList[j].nameArray1.push(i) 454 this.pickerInfoList[j].nameArray1.push(i)
461 this.pickerInfoList[j].nameArray1.push(i + 0.5) 455 this.pickerInfoList[j].nameArray1.push(i + 0.5)
462 this.pickerInfoList[j].nameArray2.push(i) 456 this.pickerInfoList[j].nameArray2.push(i)
463 this.pickerInfoList[j].nameArray2.push(i + 0.5) 457 this.pickerInfoList[j].nameArray2.push(i + 0.5)
464 if (i >= -6) { 458 if (i >= -6) {
465 this.pickerInfoList[j].nameArray1.push(i + 0.25) 459 this.pickerInfoList[j].nameArray1.push(i + 0.25)
466 this.pickerInfoList[j].nameArray1.push(i + 0.75) 460 this.pickerInfoList[j].nameArray1.push(i + 0.75)
467 this.pickerInfoList[j].nameArray2.push(i + 0.25) 461 this.pickerInfoList[j].nameArray2.push(i + 0.25)
468 this.pickerInfoList[j].nameArray2.push(i + 0.75) 462 this.pickerInfoList[j].nameArray2.push(i + 0.75)
469 } 463 }
470 if (i === 5) { 464 if (i === 5) {
471 this.pickerInfoList[j].nameArray1.push(i + 1) 465 this.pickerInfoList[j].nameArray1.push(i + 1)
472 this.pickerInfoList[j].nameArray2.push(i + 1) 466 this.pickerInfoList[j].nameArray2.push(i + 1)
473 } 467 }
474 } 468 }
475 } 469 }
476 // 初始化日期值 470 // 初始化日期值
477 for (let i = 1; i < 32; i++) { 471 for (let i = 1; i < 32; i++) {
478 this.pickerInfoList[3].nameArray3.push(i) 472 this.pickerInfoList[3].nameArray3.push(i)
479 } 473 }
480 // 初始化年份前后五年 474 // 初始化年份前后五年
481 const myDate = new Date() 475 const myDate = new Date()
482 const nowYear = myDate.getFullYear() 476 const nowYear = myDate.getFullYear()
483 for (let i = 0; i < 5; i++) { 477 for (let i = 0; i < 5; i++) {
484 this.pickerInfoList[3].nameArray1.push(nowYear - i) 478 this.pickerInfoList[3].nameArray1.push(nowYear - i)
485 } 479 }
486 }, 480 },
487 name : "bottomSheet", 481 name : "bottomSheet",
488 methods: { 482 methods: {
489 //判断眼镜数据是否为0 483 //判断眼镜数据是否为0
490 checkGlassInfo(){ 484 checkGlassInfo(){
491 // const glassInfoArr = Object.values(this.glassInfo) 485 // const glassInfoArr = Object.values(this.glassInfo)
492 // console.log(this.glassInfoRight) 486 // console.log(this.glassInfoRight)
493 if(!this.glassInfoRight){ 487 if(!this.glassInfoRight){
494 uni.showToast({ 488 uni.showToast({
495 title:'请完善镜框数据~', 489 title:'请完善镜框数据~',
496 icon:'none' 490 icon:'none'
497 }) 491 })
498 } 492 }
499 }, 493 },
500 updateMylove(){ 494 updateMylove(){
501 const loveItem = this.loveList[this.loveCurrent] 495 const loveItem = this.loveList[this.loveCurrent]
502 const glassWidth = this.glassInfo.glassWidth 496 const glassWidth = this.glassInfo.glassWidth
503 const norseWidth = this.glassInfo.norseWidth 497 const norseWidth = this.glassInfo.norseWidth
504 const legWidth = this.glassInfo.legWidth 498 const legWidth = this.glassInfo.legWidth
505 if(loveItem.glassWidth !== glassWidth){ 499 if(loveItem.glassWidth !== glassWidth){
506 store.dispatch('myLoveList/updateMylove', { 500 store.dispatch('myLoveList/updateMylove', {
507 uid: this.$store.state.user.userInfo.uid, 501 uid: this.$store.state.user.userInfo.uid,
508 openid: this.$store.state.user.userInfo.openid, 502 openid: this.$store.state.user.userInfo.openid,
509 mp_id: this.mp_id, 503 mp_id: this.mp_id,
510 keyname: 'glassWidth', 504 keyname: 'glassWidth',
511 keyvalue: glassWidth 505 keyvalue: glassWidth
512 }); 506 });
513 } 507 }
514 if(loveItem.norseWidth !== norseWidth){ 508 if(loveItem.norseWidth !== norseWidth){
515 store.dispatch('myLoveList/updateMylove', { 509 store.dispatch('myLoveList/updateMylove', {
516 uid: this.$store.state.user.userInfo.uid, 510 uid: this.$store.state.user.userInfo.uid,
517 openid: this.$store.state.user.userInfo.openid, 511 openid: this.$store.state.user.userInfo.openid,
518 mp_id: this.mp_id, 512 mp_id: this.mp_id,
519 keyname: 'norseWidth', 513 keyname: 'norseWidth',
520 keyvalue: norseWidth 514 keyvalue: norseWidth
521 }); 515 });
522 } 516 }
523 if(loveItem.legWidth !== legWidth){ 517 if(loveItem.legWidth !== legWidth){
524 store.dispatch('myLoveList/updateMylove', { 518 store.dispatch('myLoveList/updateMylove', {
525 uid: this.$store.state.user.userInfo.uid, 519 uid: this.$store.state.user.userInfo.uid,
526 openid: this.$store.state.user.userInfo.openid, 520 openid: this.$store.state.user.userInfo.openid,
527 mp_id: this.mp_id, 521 mp_id: this.mp_id,
528 keyname: 'legWidth', 522 keyname: 'legWidth',
529 keyvalue: legWidth 523 keyvalue: legWidth
530 }); 524 });
531 } 525 }
532 }, 526 },
533 glassInfoInput(e,type){ 527 glassInfoInput(e,type){
534 switch(type){ 528 switch(type){
535 case 0: 529 case 0:
536 this.glassInfo.glassWidth = e.detail.value 530 this.glassInfo.glassWidth = e.detail.value
537 break; 531 break;
538 case 1: 532 case 1:
539 this.glassInfo.norseWidth = e.detail.value 533 this.glassInfo.norseWidth = e.detail.value
540 break; 534 break;
541 case 2: 535 case 2:
542 this.glassInfo.legWidth = e.detail.value 536 this.glassInfo.legWidth = e.detail.value
543 break; 537 break;
544 default: 538 default:
545 break; 539 break;
546 } 540 }
547 }, 541 },
548 //参数点击事件==》改变对应图片 542 //参数点击事件==》改变对应图片
549 cartOnClickItem(index, i,aid) { 543 cartOnClickItem(index, i,aid) {
550 //根据aid拼接skuValue 544 //根据aid拼接skuValue
551 this.skuValueArray[index] = aid 545 this.skuValueArray[index] = aid
552 const sku_value = this.skuValueArray.join('_') 546 const sku_value = this.skuValueArray.join('_')
553 //根据sku_value获取对应的sk_id 547 //根据sku_value获取对应的sk_id
554 const itemSk_id = this.skuList.filter(item=>item.sku_value == sku_value)[0].sk_id 548 const itemSk_id = this.skuList.filter(item=>item.sku_value == sku_value)[0].sk_id
555 //修改sk_id 549 //修改sk_id
556 this.skId = itemSk_id 550 this.skId = itemSk_id
557 if (this.current[index] !== i) { 551 if (this.current[index] !== i) {
558 this.current[index] = i 552 this.current[index] = i
559 } 553 }
560 this.$forceUpdate() 554 this.$forceUpdate()
561 }, 555 },
562 comfirmChoose(){ 556 comfirmChoose(){
563 this.checkGlassInfo() 557 this.checkGlassInfo()
564 if(this.glassInfoRight){ 558 if(this.glassInfoRight){
565 this.updateMylove() 559 this.updateMylove()
566 const price = this.skuList.filter(item=>item.sk_id == this.skId)[0].real_price 560 const price = this.skuList.filter(item=>item.sk_id == this.skId)[0].real_price
567 this.$emit("chooseCartModi",this.mp_id,this.skId,price,this.pid,this.count,this.cart_id,this.index)//添加购物车 561 this.$emit("chooseCartModi",this.mp_id,this.skId,price,this.pid,this.count,this.cart_id,this.index)//添加购物车
568 this.$emit("closeBottom") 562 this.$emit("closeBottom")
569 } 563 }
570 }, 564 },
571 addCart(){ 565 addCart(){
572 this.checkGlassInfo() 566 this.checkGlassInfo()
573 if(this.glassInfoRight){ 567 if(this.glassInfoRight){
574 this.updateMylove() 568 this.updateMylove()
575 const that = this 569 const that = this
576 const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name] 570 const checkedSKUName = [that.goodInfo.attrList[0].meta_name,that.goodInfo.attrList[1].meta_name]
577 const checkedSKU = [] 571 const checkedSKU = []
578 let j; 572 let j;
579 for (let i = 0;i<that.current.length;i++) { 573 for (let i = 0;i<that.current.length;i++) {
580 checkedSKU.push(that.goodInfo.attrList[i].attr[that.current[i]]) 574 checkedSKU.push(that.goodInfo.attrList[i].attr[that.current[i]])
581 // console.log('i', i, j, i !== this.current.length - 1) 575 // console.log('i', i, j, i !== this.current.length - 1)
582 if (i !== this.current.length - 1) { 576 if (i !== this.current.length - 1) {
583 // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应 577 // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应
584 j = this.current[i] * this.attrList[1].attr.length 578 j = this.current[i] * this.attrList[1].attr.length
585 } else { 579 } else {
586 j += this.current[i] 580 j += this.current[i]
587 } 581 }
588 } 582 }
589 const price = this.skuList.filter(item=>item.sk_id == this.skuList[j].sk_id)[0].real_price 583 const price = this.skuList.filter(item=>item.sk_id == this.skuList[j].sk_id)[0].real_price
590 let sk_id = this.skuList[j].sk_id 584 let sk_id = this.skuList[j].sk_id
591 // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU) 585 // console.log('选择的商品sk_id',sk_id,'选择的商品参数',checkedSKU)
592 // console.log('mp_id',this.mp_id,'数量',this.count) 586 // console.log('mp_id',this.mp_id,'数量',this.count)
593 this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车 587 this.$emit("addCart",this.mp_id,this.count,checkedSKU,sk_id,price)//添加购物车
594 this.$emit("closeBottom")//关闭弹窗 588 this.$emit("closeBottom")//关闭弹窗
595 } 589 }
596 }, 590 },
597 onClickLoveItem(index,name){ 591 onClickLoveItem(index,name){
598 const loveList = this.loveList 592 const loveList = this.loveList
599 this.glassInfo.glassWidth = loveList[index].glassWidth 593 this.glassInfo.glassWidth = loveList[index].glassWidth
600 this.glassInfo.norseWidth = loveList[index].norseWidth 594 this.glassInfo.norseWidth = loveList[index].norseWidth
601 this.glassInfo.legWidth = loveList[index].legWidth 595 this.glassInfo.legWidth = loveList[index].legWidth
602 for (let index = 0; index < loveList.length; index++) { 596 for (let index = 0; index < loveList.length; index++) {
603 if (name === loveList[index].name && name!==this.name) { 597 if (name === loveList[index].name && name!==this.name) {
604 this.isDataName = true 598 this.isDataName = true
605 this.kinds = 2 599 this.kinds = 2
606 this.name = loveList[index].name 600 this.name = loveList[index].name
607 this.pd = loveList[index].pd 601 this.pd = loveList[index].pd
608 this.mp_id = loveList[index].mp_id 602 this.mp_id = loveList[index].mp_id
609 this.oldname = loveList[index].name 603 this.oldname = loveList[index].name
610 this.oldpd = loveList[index].pd 604 this.oldpd = loveList[index].pd
611 this.pickerInfoList[0].nameArray1.unshift(loveList[index].leftSph) 605 this.pickerInfoList[0].nameArray1.unshift(loveList[index].leftSph)
612 this.pickerInfoList[0].nameArray2.unshift(loveList[index].rightSph) 606 this.pickerInfoList[0].nameArray2.unshift(loveList[index].rightSph)
613 this.pickerInfoList[1].nameArray1.unshift(loveList[index].leftCyl) 607 this.pickerInfoList[1].nameArray1.unshift(loveList[index].leftCyl)
614 this.pickerInfoList[1].nameArray2.unshift(loveList[index].rightCyl) 608 this.pickerInfoList[1].nameArray2.unshift(loveList[index].rightCyl)
615 this.pickerInfoList[2].nameArray1.unshift(loveList[index].leftAxi) 609 this.pickerInfoList[2].nameArray1.unshift(loveList[index].leftAxi)
616 this.pickerInfoList[2].nameArray2.unshift(loveList[index].rightAxi) 610 this.pickerInfoList[2].nameArray2.unshift(loveList[index].rightAxi)
617 this.pickerInfoList[3].nameArray1.unshift(loveList[index].in_time.toString().slice(0, 4)) 611 this.pickerInfoList[3].nameArray1.unshift(loveList[index].in_time.toString().slice(0, 4))
618 if (loveList[index].in_time.toString().slice(5, 6) === 0) { 612 if (loveList[index].in_time.toString().slice(5, 6) === 0) {
619 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(6, 7)) 613 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(6, 7))
620 } else { 614 } else {
621 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(5, 7)) 615 this.pickerInfoList[3].nameArray2.unshift(loveList[index].in_time.toString().slice(5, 7))
622 } 616 }
623 if (loveList[index].in_time.toString().slice(8, 9) === 0) { 617 if (loveList[index].in_time.toString().slice(8, 9) === 0) {
624 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(9, 10)) 618 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(9, 10))
625 } else { 619 } else {
626 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(8, 10)) 620 this.pickerInfoList[3].nameArray3.unshift(loveList[index].in_time.toString().slice(8, 10))
627 } 621 }
628 } 622 }
629 } 623 }
630 this.name = name; 624 this.name = name;
631 this.loveCurrent = index; 625 this.loveCurrent = index;
632 }, 626 },
633 closeSheet(){ 627 closeSheet(){
634 this.$emit('closeBottom'); 628 this.$emit('closeBottom');
635 }, 629 },
636 stopEvent(){ //@click.stop防止事件冒泡 630 stopEvent(){ //@click.stop防止事件冒泡
637 631
638 }, 632 },
639 moveHandle(){ //不让页面滚动 633 moveHandle(){ //不让页面滚动
640 634
641 }, 635 },
642 // picker相关功能 636 // picker相关功能
643 handleInput(e) { 637 handleInput(e) {
644 this.name = e.target.value 638 this.name = e.target.value
645 this.isDataName = false 639 this.isDataName = false
646 const mpList = this.mpList 640 const mpList = this.mpList
647 // console.log('mpList===>', mpList) 641 // console.log('mpList===>', mpList)
648 for (let index = 0; index < mpList.length; index++) { 642 for (let index = 0; index < mpList.length; index++) {
649 if (e.detail.value === mpList[index].name) { 643 if (e.detail.value === mpList[index].name) {
650 this.isDataName = true 644 this.isDataName = true
651 uni.showModal({ 645 uni.showModal({
652 title: '提示', 646 title: '提示',
653 content: `是否填充已有的"${e.detail.value}"的数据`, 647 content: `是否填充已有的"${e.detail.value}"的数据`,
654 success: (res) => { 648 success: (res) => {
655 if (res.confirm) { 649 if (res.confirm) {
656 this.kinds = 2 650 this.kinds = 2
657 // console.log('args===>', index) 651 // console.log('args===>', index)
658 // const mpList=Object.assign({},this.$store.state.mympList.mpList) 652 // const mpList=Object.assign({},this.$store.state.mympList.mpList)
659 this.name = mpList[index].name 653 this.name = mpList[index].name
660 this.pd = mpList[index].pd 654 this.pd = mpList[index].pd
661 this.mp_id = mpList[index].mp_id 655 this.mp_id = mpList[index].mp_id
662 this.oldname = mpList[index].name 656 this.oldname = mpList[index].name
663 this.oldpd = mpList[index].pd 657 this.oldpd = mpList[index].pd
664 // 将kinds =2时的值传到该页面 658 // 将kinds =2时的值传到该页面
665 this.pickerInfoList[0].nameArray1.unshift(mpList[index].leftSph) 659 this.pickerInfoList[0].nameArray1.unshift(mpList[index].leftSph)
666 this.pickerInfoList[0].nameArray2.unshift(mpList[index].rightSph) 660 this.pickerInfoList[0].nameArray2.unshift(mpList[index].rightSph)
667 this.pickerInfoList[1].nameArray1.unshift(mpList[index].leftCyl) 661 this.pickerInfoList[1].nameArray1.unshift(mpList[index].leftCyl)
668 this.pickerInfoList[1].nameArray2.unshift(mpList[index].rightCyl) 662 this.pickerInfoList[1].nameArray2.unshift(mpList[index].rightCyl)
669 this.pickerInfoList[2].nameArray1.unshift(mpList[index].leftAxi) 663 this.pickerInfoList[2].nameArray1.unshift(mpList[index].leftAxi)
670 this.pickerInfoList[2].nameArray2.unshift(mpList[index].rightAxi) 664 this.pickerInfoList[2].nameArray2.unshift(mpList[index].rightAxi)
671 this.pickerInfoList[3].nameArray1.unshift(mpList[index].in_time.toString().slice(0, 4)) 665 this.pickerInfoList[3].nameArray1.unshift(mpList[index].in_time.toString().slice(0, 4))
672 if (mpList[index].in_time.toString().slice(5, 6) === 0) { 666 if (mpList[index].in_time.toString().slice(5, 6) === 0) {
673 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(6, 7)) 667 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(6, 7))
674 } else { 668 } else {
675 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(5, 7)) 669 this.pickerInfoList[3].nameArray2.unshift(mpList[index].in_time.toString().slice(5, 7))
676 } 670 }
677 if (mpList[index].in_time.toString().slice(8, 9) === 0) { 671 if (mpList[index].in_time.toString().slice(8, 9) === 0) {
678 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(9, 10)) 672 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(9, 10))
679 } else { 673 } else {
680 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(8, 10)) 674 this.pickerInfoList[3].nameArray3.unshift(mpList[index].in_time.toString().slice(8, 10))
681 } 675 }
682 // this.checkedData = mpList[index] 676 // this.checkedData = mpList[index]
683 // console.log('checkedData', this.checkedData) 677 // console.log('checkedData', this.checkedData)
684 } else if (res.cancel) { 678 } else if (res.cancel) {
685 this.kinds = 2 679 this.kinds = 2
686 } 680 }
687 }, 681 },
688 }) 682 })
689 } 683 }
690 } 684 }
691 }, 685 },
692 handleInputPd(e) { 686 handleInputPd(e) {
693 // 只能输入正浮点数或正数 687 // 只能输入正浮点数或正数
694 if (/^\d+(\.\d+)?$/.test(e.target.value)) { 688 if (/^\d+(\.\d+)?$/.test(e.target.value)) {
695 this.pd = e.target.value 689 this.pd = e.target.value
696 } else { 690 } else {
697 uni.showToast({ 691 uni.showToast({
698 title: '请输入有效数据;示例:89', 692 title: '请输入有效数据;示例:89',
699 icon: 'none', 693 icon: 'none',
700 duration: 2000, 694 duration: 2000,
701 }) 695 })
702 this.pd = '' 696 this.pd = ''
703 } 697 }
704 }, 698 },
705 // changeConfirm() { 699 // changeConfirm() {
706 // this.confirm = !this.confirm 700 // this.confirm = !this.confirm
707 // }, 701 // },
708 bindPickerChange01: function(e) { 702 bindPickerChange01: function(e) {
709 this.pickerInfoList[0].nameIndex1 = e.target.value 703 this.pickerInfoList[0].nameIndex1 = e.target.value
710 this.pickerInfoChioce.leftSph = this.pickerInfoList[0].nameArray1[e.target.value] 704 this.pickerInfoChioce.leftSph = this.pickerInfoList[0].nameArray1[e.target.value]
711 }, 705 },
712 bindPickerChange02: function(e) { 706 bindPickerChange02: function(e) {
713 this.pickerInfoList[0].nameIndex2 = e.target.value 707 this.pickerInfoList[0].nameIndex2 = e.target.value
714 this.pickerInfoChioce.rightSph = this.pickerInfoList[0].nameArray2[e.target.value] 708 this.pickerInfoChioce.rightSph = this.pickerInfoList[0].nameArray2[e.target.value]
715 }, 709 },
716 710
717 bindPickerChange11: function(e) { 711 bindPickerChange11: function(e) {
718 this.pickerInfoList[1].nameIndex1 = e.target.value 712 this.pickerInfoList[1].nameIndex1 = e.target.value
719 this.pickerInfoChioce.leftCyl = this.pickerInfoList[1].nameArray1[e.target.value] 713 this.pickerInfoChioce.leftCyl = this.pickerInfoList[1].nameArray1[e.target.value]
720 }, 714 },
721 bindPickerChange12: function(e) { 715 bindPickerChange12: function(e) {
722 this.pickerInfoList[1].nameIndex2 = e.target.value 716 this.pickerInfoList[1].nameIndex2 = e.target.value
723 this.pickerInfoChioce.rightCyl = this.pickerInfoList[1].nameArray2[e.target.value] 717 this.pickerInfoChioce.rightCyl = this.pickerInfoList[1].nameArray2[e.target.value]
724 }, 718 },
725 719
726 bindPickerChange21: function(e) { 720 bindPickerChange21: function(e) {
727 this.pickerInfoList[2].nameIndex1 = e.target.value 721 this.pickerInfoList[2].nameIndex1 = e.target.value
728 this.pickerInfoChioce.leftAxi = this.pickerInfoList[2].nameArray1[e.target.value] 722 this.pickerInfoChioce.leftAxi = this.pickerInfoList[2].nameArray1[e.target.value]
729 }, 723 },
730 bindPickerChange22: function(e) { 724 bindPickerChange22: function(e) {
731 this.pickerInfoList[2].nameIndex2 = e.target.value 725 this.pickerInfoList[2].nameIndex2 = e.target.value
732 this.pickerInfoChioce.rightAxi = this.pickerInfoList[2].nameArray2[e.target.value] 726 this.pickerInfoChioce.rightAxi = this.pickerInfoList[2].nameArray2[e.target.value]
733 }, 727 },
734 728
735 bindPickerChange41: function(e) { 729 bindPickerChange41: function(e) {
736 this.pickerInfoList[3].nameIndex1 = e.target.value 730 this.pickerInfoList[3].nameIndex1 = e.target.value
737 this.pickerInfoChioce.time.year = this.pickerInfoList[3].nameArray1[e.target.value] 731 this.pickerInfoChioce.time.year = this.pickerInfoList[3].nameArray1[e.target.value]
738 }, 732 },
739 bindPickerChange42: function(e) { 733 bindPickerChange42: function(e) {
740 this.pickerInfoList[3].nameIndex2 = e.target.value 734 this.pickerInfoList[3].nameIndex2 = e.target.value
741 this.pickerInfoChioce.time.month = this.pickerInfoList[3].nameArray2[e.target.value] 735 this.pickerInfoChioce.time.month = this.pickerInfoList[3].nameArray2[e.target.value]
742 }, 736 },
743 bindPickerChange43: function(e) { 737 bindPickerChange43: function(e) {
744 this.pickerInfoList[3].nameIndex3 = e.target.value 738 this.pickerInfoList[3].nameIndex3 = e.target.value
745 this.pickerInfoChioce.time.day = this.pickerInfoList[3].nameArray3[e.target.value] 739 this.pickerInfoChioce.time.day = this.pickerInfoList[3].nameArray3[e.target.value]
746 }, 740 },
747 changeShow(num) { 741 changeShow(num) {
748 this.show[num] = !this.show[num] 742 this.show[num] = !this.show[num]
749 this.$forceUpdate() 743 this.$forceUpdate()
750 }, 744 },
751 counter(isadd) { 745 counter(isadd) {
752 if (isadd) { 746 if (isadd) {
753 this.count >= this.maxCount ? this.addDisabled = true : this.count++ 747 this.count >= this.maxCount ? this.addDisabled = true : this.count++
754 } else { 748 } else {
755 this.count <= 1 ? this.desDisabled = true : this.count-- 749 this.count <= 1 ? this.desDisabled = true : this.count--
756 } 750 }
757 }, 751 },
758 toComfirmOrder() { 752 toComfirmOrder() {
759 this.checkGlassInfo() 753 this.checkGlassInfo()
760 this.updateMylove() 754 this.updateMylove()
761 // 先处理验光部分的逻辑,如果ok在跳转 755 // 先处理验光部分的逻辑,如果ok在跳转
762 let flag = 0 756 let flag = 0
763 if (this.name === '') { 757 if (this.name === '') {
764 uni.showToast({ 758 uni.showToast({
765 title: '请输入验光单取名', 759 title: '请输入验光单取名',
766 icon: 'none', 760 icon: 'none',
767 duration: 2000, 761 duration: 2000,
768 }) 762 })
769 } else { 763 } else {
770 if (this.pd === '') { 764 if (this.pd === '') {
771 uni.showToast({ 765 uni.showToast({
772 title: '请输入瞳距', 766 title: '请输入瞳距',
773 icon: 'none', 767 icon: 'none',
774 duration: 2000, 768 duration: 2000,
775 }) 769 })
776 } else { 770 } else {
777 if (this.kinds === 1) { 771 if (this.kinds === 1) {
778 // 添加用户验光单 772 // 添加用户验光单
779 if (this.pickerInfoChioce.rightSph === '' || this.pickerInfoChioce.leftSph === '' || 773 if (this.pickerInfoChioce.rightSph === '' || this.pickerInfoChioce.leftSph === '' ||
780 this.pickerInfoChioce.leftCyl === '' || this.pickerInfoChioce.rightCyl === '' || 774 this.pickerInfoChioce.leftCyl === '' || this.pickerInfoChioce.rightCyl === '' ||
781 this.pickerInfoChioce.leftAxi === '' || this.pickerInfoChioce.rightAxi === '' 775 this.pickerInfoChioce.leftAxi === '' || this.pickerInfoChioce.rightAxi === ''
782 ) { 776 ) {
783 uni.showToast({ 777 uni.showToast({
784 title: '请输入您的验光数据', 778 title: '请输入您的验光数据',
785 icon: 'none', 779 icon: 'none',
786 duration: 2000, 780 duration: 2000,
787 }) 781 })
788 } else { 782 } else {
789 // if (this.confirm) { 783 // if (this.confirm) {
790 store.dispatch('myLoveList/addMylove', { 784 store.dispatch('myLoveList/addMylove', {
791 uid: this.$store.state.user.userInfo.uid, 785 uid: this.$store.state.user.userInfo.uid,
792 openid: this.$store.state.user.userInfo.openid, 786 openid: this.$store.state.user.userInfo.openid,
793 // mp_name: this.$store.state.user.userInfo.mp_name, 787 // mp_name: this.$store.state.user.userInfo.mp_name,
794 leftSph: this.pickerInfoChioce.leftSph, 788 leftSph: this.pickerInfoChioce.leftSph,
795 rightSph: this.pickerInfoChioce.rightSph, 789 rightSph: this.pickerInfoChioce.rightSph,
796 leftCyl: this.pickerInfoChioce.leftCyl, 790 leftCyl: this.pickerInfoChioce.leftCyl,
797 rightCyl: this.pickerInfoChioce.rightCyl, 791 rightCyl: this.pickerInfoChioce.rightCyl,
798 leftAxi: this.pickerInfoChioce.leftAxi, 792 leftAxi: this.pickerInfoChioce.leftAxi,
799 rightAxi: this.pickerInfoChioce.rightAxi, 793 rightAxi: this.pickerInfoChioce.rightAxi,
800 pd: this.pd, // 瞳距 794 pd: this.pd, // 瞳距
801 mp_name: this.name, 795 mp_name: this.name,
802 // time: this.pickerInfoChioce.time, 796 // time: this.pickerInfoChioce.time,
803 // img_url2: "http://localhost:8087/images/shop_1/1/", 797 // img_url2: "http://localhost:8087/images/shop_1/1/",
804 }).then(({ mp_id: mpId }) => { 798 }).then(({ mp_id: mpId }) => {
805 this.mp_id = mpId 799 this.mp_id = mpId
806 }) 800 })
807 flag = 1 801 flag = 1
808 } 802 }
809 } 803 }
810 if (this.kinds === 2) { 804 if (this.kinds === 2) {
811 // if (this.confirm) { 805 // if (this.confirm) {
812 const leftList = ['leftSph', 'leftCyl', 'leftAxi'] 806 const leftList = ['leftSph', 'leftCyl', 'leftAxi']
813 const rightList = ['rightSph', 'rightCyl', 'rightAxi'] 807 const rightList = ['rightSph', 'rightCyl', 'rightAxi']
814 // let flag=0; 808 // let flag=0;
815 if (this.name !== this.oldname) { 809 if (this.name !== this.oldname) {
816 store.dispatch('myLoveList/updateMylove', { 810 store.dispatch('myLoveList/updateMylove', {
817 uid: this.$store.state.user.userInfo.uid, 811 uid: this.$store.state.user.userInfo.uid,
818 openid: this.$store.state.user.userInfo.openid, 812 openid: this.$store.state.user.userInfo.openid,
819 mp_id: this.mp_id, 813 mp_id: this.mp_id,
820 keyname: 'name', 814 keyname: 'name',
821 keyvalue: this.name, 815 keyvalue: this.name,
822 }) 816 })
823 flag = 1 817 flag = 1
824 } 818 }
825 if (this.pd !== this.oldpd) { 819 if (this.pd !== this.oldpd) {
826 store.dispatch('myLoveList/updateMylove', { 820 store.dispatch('myLoveList/updateMylove', {
827 uid: this.$store.state.user.userInfo.uid, 821 uid: this.$store.state.user.userInfo.uid,
828 openid: this.$store.state.user.userInfo.openid, 822 openid: this.$store.state.user.userInfo.openid,
829 mp_id: this.mp_id, 823 mp_id: this.mp_id,
830 keyname: 'pd', 824 keyname: 'pd',
831 keyvalue: this.pd, 825 keyvalue: this.pd,
832 }) 826 })
833 flag = 1 827 flag = 1
834 } 828 }
835 // 先验证是否输入有无空 829 // 先验证是否输入有无空
836 let q = true 830 let q = true
837 for (let k = 0; k < 3; k++) { 831 for (let k = 0; k < 3; k++) {
838 q = q && (this.pickerInfoList[k].nameArray1[this.pickerInfoList[k].nameIndex1] !== '' && 832 q = q && (this.pickerInfoList[k].nameArray1[this.pickerInfoList[k].nameIndex1] !== '' &&
839 this.pickerInfoList[k].nameArray2[this.pickerInfoList[k].nameIndex2] !== '') 833 this.pickerInfoList[k].nameArray2[this.pickerInfoList[k].nameIndex2] !== '')
840 } 834 }
841 if (q) { 835 if (q) {
842 for (let j = 0; j < 3; j++) { 836 for (let j = 0; j < 3; j++) {
843 if (this.pickerInfoList[j].nameIndex1 !== 0) { 837 if (this.pickerInfoList[j].nameIndex1 !== 0) {
844 store.dispatch('myLoveList/updateMylove', { 838 store.dispatch('myLoveList/updateMylove', {
845 uid: this.$store.state.user.userInfo.uid, 839 uid: this.$store.state.user.userInfo.uid,
846 openid: this.$store.state.user.userInfo.openid, 840 openid: this.$store.state.user.userInfo.openid,
847 mp_id: this.mp_id, 841 mp_id: this.mp_id,
848 keyname: leftList[j], 842 keyname: leftList[j],
849 keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j].nameIndex1], 843 keyvalue: this.pickerInfoList[j].nameArray1[this.pickerInfoList[j].nameIndex1],
850 }) 844 })
851 } 845 }
852 if (this.pickerInfoList[j].nameIndex2 !== 0) { 846 if (this.pickerInfoList[j].nameIndex2 !== 0) {
853 store.dispatch('myLoveList/updateMylove', { 847 store.dispatch('myLoveList/updateMylove', {
854 uid: this.$store.state.user.userInfo.uid, 848 uid: this.$store.state.user.userInfo.uid,
855 openid: this.$store.state.user.userInfo.openid, 849 openid: this.$store.state.user.userInfo.openid,
856 mp_id: this.mp_id, 850 mp_id: this.mp_id,
857 keyname: rightList[j], 851 keyname: rightList[j],
858 keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j].nameIndex2], 852 keyvalue: this.pickerInfoList[j].nameArray2[this.pickerInfoList[j].nameIndex2],
859 }) 853 })
860 } 854 }
861 flag = 1 855 flag = 1
862 } 856 }
863 } else { 857 } else {
864 flag = 0 858 flag = 0
865 uni.showToast({ 859 uni.showToast({
866 title: '请输入您的验光数据', 860 title: '请输入您的验光数据',
867 icon: 'none', 861 icon: 'none',
868 duration: 2000, 862 duration: 2000,
869 }) 863 })
870 } 864 }
871 865
872 // } else { 866 // } else {
873 // uni.showToast({ 867 // uni.showToast({
874 // title: '请确认您的验光数据', 868 // title: '请确认您的验光数据',
875 // icon: 'none', 869 // icon: 'none',
876 // duration: 3000, 870 // duration: 3000,
877 // }) 871 // })
878 // } 872 // }
879 } 873 }
880 } 874 }
881 } 875 }
882 if (flag !== 0) { 876 if (flag !== 0) {
883 // 如果数据验证无误,那么更新验光单的数据 877 // 如果数据验证无误,那么更新验光单的数据
884 store.dispatch('myLoveList/getLoveList', { 878 store.dispatch('myLoveList/getLoveList', {
885 uid: this.$store.state.user.userInfo.uid, 879 uid: this.$store.state.user.userInfo.uid,
886 }) 880 })
887 let i = 0 881 let i = 0
888 // 判断出是哪一个sku被选中 882 // 判断出是哪一个sku被选中
889 for (let index = 0; index < this.current.length; index++) { 883 for (let index = 0; index < this.current.length; index++) {
890 // console.log('index', index, i, index !== this.current.length - 1) 884 // console.log('index', index, i, index !== this.current.length - 1)
891 if (index !== this.current.length - 1) { 885 if (index !== this.current.length - 1) {
892 // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应 886 // 后续需修改算法:目前暂定只有两个参数选择,后续若有多个参数需要修改实现自适应
893 i = this.current[index] * this.attrList[1].attr.length 887 i = this.current[index] * this.attrList[1].attr.length
894 } else { 888 } else {
895 i += this.current[index] 889 i += this.current[index]
896 } 890 }
897 } 891 }
898 // 判断是否其输入的人员数据是否已存在 892 // 判断是否其输入的人员数据是否已存在
899 store.dispatch('order/saveParams', { 893 store.dispatch('order/saveParams', {
900 sk_id_arr: this.skuList[i], 894 sk_id_arr: this.skuList[i],
901 current: this.current, 895 current: this.current,
902 mp_id: this.mp_id, 896 mp_id: this.mp_id,
903 attrList: this.attrList, 897 attrList: this.attrList,
904 }) 898 })
905 this.$store.state.cart.buyItem = this.skuItem 899 this.$store.state.cart.buyItem = this.skuItem
906 // 跳转到确认订单页面 900 // 跳转到确认订单页面
907 uni.navigateTo({ 901 uni.navigateTo({
908 url: `../confirmOrder/confirmOrder?pid=${this.pid}&count=${this.count}&name=${this.name}&isCart=false`, 902 url: `../confirmOrder/confirmOrder?pid=${this.pid}&count=${this.count}&name=${this.name}&isCart=false`,
909 }) 903 })
910 } 904 }
911 }, 905 },
912 } 906 }
913 } 907 }
914 </script> 908 </script>
915 909
916 <style lang="scss"> 910 <style lang="scss">
917 .BottomSheetContent { 911 .BottomSheetContent {
918 min-height: 100vh; 912 min-height: 100vh;
919 background-color: #f2f2f2; 913 background-color: #f2f2f2;
920 // padding-top: 20rpx; 914 // padding-top: 20rpx;
921 .goodInfo { 915 .goodInfo {
922 width: 100%; 916 width: 100%;
923 height: 272rpx; 917 height: 272rpx;
924 border-radius: 16rpx; 918 border-radius: 16rpx;
925 background-color: #ffffff; 919 background-color: #ffffff;
926 box-sizing: border-box; 920 box-sizing: border-box;
927 padding: 36rpx; 921 padding: 36rpx;
928 display: flex; 922 display: flex;
929 flex-direction: row; 923 flex-direction: row;
930 justify-content: flex-start; 924 justify-content: flex-start;
931 position: sticky; 925 position: sticky;
932 top: 0rpx; 926 top: 0rpx;
933 left: 0rpx; 927 left: 0rpx;
934 z-index: 99999; 928 z-index: 99999;
935 .imageWrap { 929 .imageWrap {
936 height: 188rpx; 930 height: 188rpx;
937 width: 188rpx; 931 width: 188rpx;
938 margin-right: 28rpx; 932 margin-right: 28rpx;
939 image { 933 image {
940 height: 188rpx; 934 height: 188rpx;
941 width: 188rpx; 935 width: 188rpx;
942 } 936 }
943 } 937 }
944 .infoRight { 938 .infoRight {
945 display: flex; 939 display: flex;
946 flex-direction: column; 940 flex-direction: column;
947 align-items: flex-start; 941 align-items: flex-start;
948 justify-content: space-between; 942 justify-content: space-between;
949 width: 100%; 943 width: 100%;
950 .goodName { 944 .goodName {
951 font-size: 28rpx; 945 font-size: 28rpx;
952 color: #333333; 946 color: #333333;
953 } 947 }
954 .remarks { 948 .remarks {
955 font-size: 20rpx; 949 font-size: 20rpx;
956 color: #999999; 950 color: #999999;
957 } 951 }
958 .priceBox { 952 .priceBox {
959 display: flex; 953 display: flex;
960 justify-content: space-between; 954 justify-content: space-between;
961 align-items: center; 955 align-items: center;
962 width: 100%; 956 width: 100%;
963 font-size: 14px; 957 font-size: 14px;
964 color: #999999; 958 color: #999999;
965 .price { 959 .price {
966 color: #ff6b4a; 960 color: #ff6b4a;
967 font-size: 28rpx; 961 font-size: 28rpx;
968 } 962 }
969 .counter { 963 .counter {
970 display: flex; 964 display: flex;
971 flex-direction: row; 965 flex-direction: row;
972 justify-content: space-between; 966 justify-content: space-between;
973 align-items: center; 967 align-items: center;
974 font-size: 28rpx; 968 font-size: 28rpx;
975 color: #333333; 969 color: #333333;
976 width: 122rpx; 970 width: 122rpx;
977 .btn { 971 .btn {
978 display: flex; 972 display: flex;
979 justify-content: center; 973 justify-content: center;
980 line-height: 32rpx; 974 line-height: 32rpx;
981 height: 32rpx; 975 height: 32rpx;
982 width: 32rpx; 976 width: 32rpx;
983 background-color: #f2f2f2; 977 background-color: #f2f2f2;
984 color: #cfcfcf; 978 color: #cfcfcf;
985 } 979 }
986 } 980 }
987 } 981 }
988 } 982 }
989 } 983 }
990 .peopleChoose{ 984 .peopleChoose{
991 width: 100%; 985 width: 100%;
992 min-height: 200rpx; 986 min-height: 200rpx;
993 border-radius: 16rpx; 987 border-radius: 16rpx;
994 background-color: #ffffff; 988 background-color: #ffffff;
995 box-sizing: border-box; 989 box-sizing: border-box;
996 padding: 36rpx; 990 padding: 36rpx;
997 margin: 10px 0; 991 margin: 10px 0;
998 display: flex; 992 display: flex;
999 flex-direction: column; 993 flex-direction: column;
1000 justify-content: flex-start; 994 justify-content: flex-start;
1001 align-items: center; 995 align-items: center;
1002 .title{ 996 .title{
1003 font-size: 16px; 997 font-size: 16px;
1004 color: #333333; 998 color: #333333;
1005 letter-spacing: -0.3px; 999 letter-spacing: -0.3px;
1006 text-align: justify; 1000 text-align: justify;
1007 line-height: 24px; 1001 line-height: 24px;
1008 margin: 4px 0; 1002 margin: 4px 0;
1009 } 1003 }
1010 .loveList{ 1004 .loveList{
1011 display: flex; 1005 display: flex;
1012 flex-direction: row; 1006 flex-direction: row;
1013 flex-wrap: wrap; 1007 flex-wrap: wrap;
1014 justify-content: flex-start; 1008 justify-content: flex-start;
1015 align-items: center; 1009 align-items: center;
1016 padding-top: 24rpx; 1010 padding-top: 24rpx;
1017 width: 100%; 1011 width: 100%;
1018 .peopleName { 1012 .peopleName {
1019 padding: 0 30rpx; 1013 padding: 0 30rpx;
1020 height: 60rpx; 1014 height: 60rpx;
1021 margin: 0 20rpx 20rpx 0; 1015 margin: 0 20rpx 20rpx 0;
1022 transition: all 0.3s; 1016 transition: all 0.3s;
1023 background: #f2f2f2; 1017 background: #f2f2f2;
1024 border-radius: 2px; 1018 border-radius: 2px;
1025 border-radius: 2px; 1019 border-radius: 2px;
1026 line-height: 60rpx; 1020 line-height: 60rpx;
1027 text-align: center; 1021 text-align: center;
1028 color: #666666; 1022 color: #666666;
1029 font-size: 12px; 1023 font-size: 12px;
1030 } 1024 }
1031 .active2 { 1025 .active2 {
1032 background: rgba(255, 107, 74, 0.15); 1026 background: rgba(255, 107, 74, 0.15);
1033 color: #ff6b4a; 1027 color: #ff6b4a;
1034 } 1028 }
1035 } 1029 }
1036 } 1030 }
1037 .goods-data { 1031 .goods-data {
1038 width: 100%; 1032 width: 100%;
1039 box-sizing: border-box; 1033 box-sizing: border-box;
1040 padding: 37rpx 40rpx 0 40rpx; 1034 padding: 37rpx 40rpx 0 40rpx;
1041 background: #ffffff; 1035 background: #ffffff;
1042 border-radius: 12rpx; 1036 border-radius: 12rpx;
1043 .opCollapse { 1037 .opCollapse {
1044 width: 100%; 1038 width: 100%;
1045 padding-bottom: 28rpx; 1039 padding-bottom: 28rpx;
1046 margin-top: 7px; 1040 margin-top: 7px;
1047 border-bottom: 1px solid #e9e9e9; 1041 border-bottom: 1px solid #e9e9e9;
1048 .head { 1042 .head {
1049 display: flex; 1043 display: flex;
1050 justify-content: space-between; 1044 justify-content: space-between;
1051 height: 24px; 1045 height: 24px;
1052 // font-family: PingFangSC-Medium; 1046 // font-family: PingFangSC-Medium;
1053 font-size: 16px; 1047 font-size: 16px;
1054 color: #333333; 1048 color: #333333;
1055 letter-spacing: -0.3px; 1049 letter-spacing: -0.3px;
1056 text-align: justify; 1050 text-align: justify;
1057 line-height: 24px; 1051 line-height: 24px;
1058 margin-bottom: 18rpx; 1052 margin-bottom: 18rpx;
1059 .headRighted { 1053 .headRighted {
1060 width: 0; 1054 width: 0;
1061 height: 0; 1055 height: 0;
1062 border-left: 4px solid transparent; 1056 border-left: 4px solid transparent;
1063 border-right: 4px solid transparent; 1057 border-right: 4px solid transparent;
1064 border-bottom: 4px solid #cfcfcf; 1058 border-bottom: 4px solid #cfcfcf;
1065 transform: scaleY(-1); 1059 transform: scaleY(-1);
1066 margin-top: 10px; 1060 margin-top: 10px;
1067 } 1061 }
1068 .headMid { 1062 .headMid {
1069 font-size: 10px; 1063 font-size: 10px;
1070 color: #999999; 1064 color: #999999;
1071 letter-spacing: -0.19px; 1065 letter-spacing: -0.19px;
1072 margin-left: -120rpx; 1066 margin-left: -120rpx;
1073 } 1067 }
1074 .headRight { 1068 .headRight {
1075 width: 0; 1069 width: 0;
1076 height: 0; 1070 height: 0;
1077 border-left: 4px solid transparent; 1071 border-left: 4px solid transparent;
1078 border-right: 4px solid transparent; 1072 border-right: 4px solid transparent;
1079 border-bottom: 4px solid #cfcfcf; 1073 border-bottom: 4px solid #cfcfcf;
1080 margin-top: 10px; 1074 margin-top: 10px;
1081 } 1075 }
1082 } 1076 }
1083 .body { 1077 .body {
1084 font-size: 12px; 1078 font-size: 12px;
1085 color: #666666; 1079 color: #666666;
1086 letter-spacing: 0; 1080 letter-spacing: 0;
1087 .bodyBox { 1081 .bodyBox {
1088 margin-top: 15px; 1082 margin-top: 15px;
1089 .names { 1083 .names {
1090 font-size: 12px; 1084 font-size: 12px;
1091 color: #151515; 1085 color: #151515;
1092 letter-spacing: 0; 1086 letter-spacing: 0;
1093 text-align: justify; 1087 text-align: justify;
1094 line-height: 17px; 1088 line-height: 17px;
1095 margin-left: 5px; 1089 margin-left: 5px;
1096 margin-right: 10px; 1090 margin-right: 10px;
1097 } 1091 }
1098 text { 1092 text {
1099 font-size: 12px; 1093 font-size: 12px;
1100 color: #666666; 1094 color: #666666;
1101 letter-spacing: 0; 1095 letter-spacing: 0;
1102 text-align: justify; 1096 text-align: justify;
1103 } 1097 }
1104 } 1098 }
1105 } 1099 }
1106 .goods-form { 1100 .goods-form {
1107 display: flex; 1101 display: flex;
1108 flex-direction: column; 1102 flex-direction: column;
1109 align-items: center; 1103 align-items: center;
1110 justify-content: center; 1104 justify-content: center;
1111 background-color: #fff; 1105 background-color: #fff;
1112 width: 100%; 1106 width: 100%;
1113 padding: 40rpx 0; 1107 padding: 40rpx 0;
1114 .p1 { 1108 .p1 {
1115 font-size: 16px; 1109 font-size: 16px;
1116 color: #333333; 1110 color: #333333;
1117 letter-spacing: -0.3px; 1111 letter-spacing: -0.3px;
1118 text-align: justify; 1112 text-align: justify;
1119 line-height: 24px; 1113 line-height: 24px;
1120 margin: 4px 0; 1114 margin: 4px 0;
1121 1115
1122 } 1116 }
1123 .p2 { 1117 .p2 {
1124 font-size: 12px; 1118 font-size: 12px;
1125 color: #999999; 1119 color: #999999;
1126 letter-spacing: -0.23px; 1120 letter-spacing: -0.23px;
1127 margin-bottom: 32rpx; 1121 margin-bottom: 32rpx;
1128 } 1122 }
1129 .image2{ 1123 .image2{
1130 width: 42rpx; 1124 width: 42rpx;
1131 height: 34rpx; 1125 height: 34rpx;
1132 margin-right: 12rpx; 1126 margin-right: 12rpx;
1133 } 1127 }
1134 .confirm { 1128 .confirm {
1135 display: flex; 1129 display: flex;
1136 align-items: center; 1130 align-items: center;
1137 font-size: 12px; 1131 font-size: 12px;
1138 color: #666666; 1132 color: #666666;
1139 letter-spacing: -0.23px; 1133 letter-spacing: -0.23px;
1140 width: 684rpx; 1134 width: 684rpx;
1141 .image1{ 1135 .image1{
1142 margin-right:25rpx; 1136 margin-right:25rpx;
1143 width: 42rpx; 1137 width: 42rpx;
1144 height: 38rpx; 1138 height: 38rpx;
1145 } 1139 }
1146 } 1140 }
1147 .picker{ 1141 .picker{
1148 display: flex; 1142 display: flex;
1149 flex-direction: column; 1143 flex-direction: column;
1150 justify-content: center; 1144 justify-content: center;
1151 align-items: center; 1145 align-items: center;
1152 width: 100%; 1146 width: 100%;
1153 1147
1154 .picker-choice{ 1148 .picker-choice{
1155 display: flex; 1149 display: flex;
1156 width: 684rpx; 1150 width: 684rpx;
1157 align-items: center; 1151 align-items: center;
1158 margin-bottom: 40rpx; 1152 margin-bottom: 40rpx;
1159 .input{ 1153 .input{
1160 border-bottom: 1px solid #CFCFCF; 1154 border-bottom: 1px solid #CFCFCF;
1161 height: 40rpx; 1155 height: 40rpx;
1162 } 1156 }
1163 .choice-left{ 1157 .choice-left{
1164 width: 210rpx; 1158 width: 210rpx;
1165 .pd{ 1159 .pd{
1166 font-size: 14px; 1160 font-size: 14px;
1167 color: #333333; 1161 color: #333333;
1168 letter-spacing: -0.26px; 1162 letter-spacing: -0.26px;
1169 text-align: justify; 1163 text-align: justify;
1170 line-height: 24px; 1164 line-height: 24px;
1171 margin-right: 44rpx; 1165 margin-right: 44rpx;
1172 } 1166 }
1173 .p11 { 1167 .p11 {
1174 font-size: 14px; 1168 font-size: 14px;
1175 color: #333333; 1169 color: #333333;
1176 letter-spacing: -0.26px; 1170 letter-spacing: -0.26px;
1177 text-align: justify; 1171 text-align: justify;
1178 line-height: 24px; 1172 line-height: 24px;
1179 // margin-right: 10px; 1173 // margin-right: 10px;
1180 } 1174 }
1181 .p12 { 1175 .p12 {
1182 font-size: 10px; 1176 font-size: 10px;
1183 color: #3F3F3F; 1177 color: #3F3F3F;
1184 letter-spacing: -0.19px; 1178 letter-spacing: -0.19px;
1185 text-align: justify; 1179 text-align: justify;
1186 line-height: 24px; 1180 line-height: 24px;
1187 } 1181 }
1188 1182
1189 } 1183 }
1190 .p13 { 1184 .p13 {
1191 font-size: 10px; 1185 font-size: 10px;
1192 color: #999999; 1186 color: #999999;
1193 letter-spacing: -0.19px; 1187 letter-spacing: -0.19px;
1194 margin-right: 10px; 1188 margin-right: 10px;
1195 } 1189 }
1196 .p13-date { 1190 .p13-date {
1197 font-size: 10px; 1191 font-size: 10px;
1198 color: #999999; 1192 color: #999999;
1199 letter-spacing: -0.19px; 1193 letter-spacing: -0.19px;
1200 margin-right: 5px; 1194 margin-right: 5px;
1201 } 1195 }
1202 picker{ 1196 picker{
1203 width: 144rpx; 1197 width: 144rpx;
1204 height: 40rpx; 1198 height: 40rpx;
1205 display: flex; 1199 display: flex;
1206 position: relative; 1200 position: relative;
1207 .p14 { 1201 .p14 {
1208 font-size: 14px; 1202 font-size: 14px;
1209 color: #666666; 1203 color: #666666;
1210 letter-spacing: -0.26px; 1204 letter-spacing: -0.26px;
1211 text-align: center; 1205 text-align: center;
1212 width: 124rpx; 1206 width: 124rpx;
1213 border-bottom: 1px solid #CFCFCF; 1207 border-bottom: 1px solid #CFCFCF;
1214 height: 38rpx; 1208 height: 38rpx;
1215 } 1209 }
1216 image{ 1210 image{
1217 width: 20rpx; 1211 width: 20rpx;
1218 height: 20rpx; 1212 height: 20rpx;
1219 position: absolute; 1213 position: absolute;
1220 right: 20rpx; 1214 right: 20rpx;
1221 top: 8rpx; 1215 top: 8rpx;
1222 } 1216 }
1223 } 1217 }
1224 1218
1225 } 1219 }
1226 } 1220 }
1227 1221
1228 .ipts{ 1222 .ipts{
1229 width: 100%; 1223 width: 100%;
1230 display: flex; 1224 display: flex;
1231 flex-direction: column; 1225 flex-direction: column;
1232 justify-content: center; 1226 justify-content: center;
1233 align-items: flex-start; 1227 align-items: flex-start;
1234 // padding: 20rpx 36rpx; 1228 // padding: 20rpx 36rpx;
1235 box-sizing: border-box; 1229 box-sizing: border-box;
1236 .inputItem{ 1230 .inputItem{
1237 display: flex; 1231 display: flex;
1238 flex-direction: row; 1232 flex-direction: row;
1239 justify-content: center; 1233 justify-content: center;
1240 align-items: center; 1234 align-items: center;
1241 margin-bottom: 36rpx; 1235 margin-bottom: 36rpx;
1242 .text{ 1236 .text{
1243 margin-right: 100rpx; 1237 margin-right: 100rpx;
1244 } 1238 }
1245 .input{ 1239 .input{
1246 border-bottom: 1px solid #CFCFCF; 1240 border-bottom: 1px solid #CFCFCF;
1247 } 1241 }
1248 } 1242 }
1249 1243
1250 } 1244 }
1251 } 1245 }
1252 } 1246 }
1253 } 1247 }
1254 .choose { 1248 .choose {
1255 width: 100%; 1249 width: 100%;
1256 background: #ffffff; 1250 background: #ffffff;
1257 border-radius: 12rpx; 1251 border-radius: 12rpx;
1258 margin-top: 20rpx; 1252 margin-top: 20rpx;
1259 padding: 40rpx 40rpx 112rpx 40rpx; 1253 padding: 40rpx 40rpx 112rpx 40rpx;
1260 box-sizing: border-box; 1254 box-sizing: border-box;
1261 .chooseItem { 1255 .chooseItem {
1262 width: 100%; 1256 width: 100%;
1263 padding-bottom: 32rpx; 1257 padding-bottom: 32rpx;
1264 border-bottom: 1px solid #e9e9e9; 1258 border-bottom: 1px solid #e9e9e9;
1265 margin-bottom: 28rpx; 1259 margin-bottom: 28rpx;
1266 } 1260 }
1267 .chooseRes { 1261 .chooseRes {
1268 font-size: 12px; 1262 font-size: 12px;
1269 color: #666666; 1263 color: #666666;
1270 } 1264 }
1271 .itemsWrap { 1265 .itemsWrap {
1272 display: flex; 1266 display: flex;
1273 flex-direction: row; 1267 flex-direction: row;
1274 flex-wrap: wrap; 1268 flex-wrap: wrap;
1275 justify-content: flex-start; 1269 justify-content: flex-start;
1276 align-items: center; 1270 align-items: center;
1277 padding-top: 24rpx; 1271 padding-top: 24rpx;
1278 .item1 { 1272 .item1 {
1279 width: 64rpx; 1273 width: 64rpx;
1280 height: 64rpx; 1274 height: 64rpx;
1281 border-radius: 32rpx; 1275 border-radius: 32rpx;
1282 margin: 0 36rpx 24rpx 0; 1276 margin: 0 36rpx 24rpx 0;
1283 transition: all 0.3s; 1277 transition: all 0.3s;
1284 border: 1px solid #ffffff; 1278 border: 1px solid #ffffff;
1285 } 1279 }
1286 .item2 { 1280 .item2 {
1287 // width: 100rpx; 1281 // width: 100rpx;
1288 padding: 0 30rpx; 1282 padding: 0 30rpx;
1289 height: 60rpx; 1283 height: 60rpx;
1290 margin: 0 20rpx 20rpx 0; 1284 margin: 0 20rpx 20rpx 0;
1291 transition: all 0.3s; 1285 transition: all 0.3s;
1292 background: #f2f2f2; 1286 background: #f2f2f2;
1293 border-radius: 2px; 1287 border-radius: 2px;
1294 border-radius: 2px; 1288 border-radius: 2px;
1295 line-height: 60rpx; 1289 line-height: 60rpx;
1296 text-align: center; 1290 text-align: center;
1297 color: #666666; 1291 color: #666666;
1298 font-size: 12px; 1292 font-size: 12px;
1299 } 1293 }
1300 .active1 { 1294 .active1 {
1301 opacity: 0.7; 1295 opacity: 0.7;
1302 border: 1px solid #ff6b4a; 1296 border: 1px solid #ff6b4a;
1303 } 1297 }
1304 .active2 { 1298 .active2 {
1305 background: rgba(255, 107, 74, 0.15); 1299 background: rgba(255, 107, 74, 0.15);
1306 color: #ff6b4a; 1300 color: #ff6b4a;
1307 } 1301 }
1308 } 1302 }
1309 } 1303 }
1310 .button { 1304 .button {
1311 width: 100%; 1305 width: 100%;
1312 height: 112rpx; 1306 height: 112rpx;
1313 background-color: #ff6b4a; 1307 background-color: #ff6b4a;
1314 font-size: 16px; 1308 font-size: 16px;
1315 color: #ffffff; 1309 color: #ffffff;
1316 line-height: 112rpx; 1310 line-height: 112rpx;
1317 text-align: center; 1311 text-align: center;
1318 position: sticky; 1312 position: sticky;
1319 bottom: 0rpx; 1313 bottom: 0rpx;
1320 left: 0rpx; 1314 left: 0rpx;
1321 z-index: 9999; 1315 z-index: 9999;
1322 } 1316 }
1323 } 1317 }
1324 /* sheet弹窗 */ 1318 /* sheet弹窗 */
1325 .sheet{ 1319 .sheet{
1326 width: 100%; 1320 width: 100%;
1327 height: 100%; 1321 height: 100%;
1328 position: fixed; 1322 position: fixed;
1329 top: 150%; 1323 top: 150%;
1330 left: 0upx; 1324 left: 0upx;
1331 bottom: 0upx; 1325 bottom: 0upx;
1332 right: 0upx; 1326 right: 0upx;
1333 background:rgba(0,0,0,0.3); 1327 background:rgba(0,0,0,0.3);
1334 z-index: 10000; 1328 z-index: 10000;
1335 } 1329 }
1336 1330
1337 /* 显示时候的动画默认0.5s */ 1331 /* 显示时候的动画默认0.5s */
1338 .sheetView{ 1332 .sheetView{
1339 width: 100%; 1333 width: 100%;
1340 height: 0upx; 1334 height: 0upx;
1341 position: absolute; 1335 position: absolute;
1342 bottom: 0upx; 1336 bottom: 0upx;
1343 background: white; 1337 background: white;
1344 z-index: 10001; 1338 z-index: 10001;
1345 transition: all 0.5s; 1339 transition: all 0.5s;
1346 } 1340 }
1347 .sheetShow{ 1341 .sheetShow{
1348 top:0upx !important; 1342 top:0upx !important;
1349 } 1343 }
1350 /* 关闭时的动画,时间自己可以设置0.5s*/ 1344 /* 关闭时的动画,时间自己可以设置0.5s*/
1351 .sheeHide{ 1345 .sheeHide{
1352 top:120% !important; 1346 top:120% !important;
1353 transition: all 0.5s; 1347 transition: all 0.5s;
1354 } 1348 }
1355 1349
1356 /* 项目需求根据设计稿要展示的高度,超出这个高度就自动滚动*/ 1350 /* 项目需求根据设计稿要展示的高度,超出这个高度就自动滚动*/
1357 .sheetView_active{ 1351 .sheetView_active{
1358 height: 1042upx; 1352 height: 1042upx;
1359 } 1353 }
1360 1354
1361 </style> 1355 </style>
1362 1356
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" 123 v-for="(item, index) in evaluate.tag"
124 :key="index" 124 :key="index"
125 >{{item.name}}</view> 125 >{{item.name}}</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 :pid="pid"
176 :goodInfo="goodInfo" 176 :goodInfo="goodInfo"
177 :isShowBottom="isShowBottom" 177 :isShowBottom="isShowBottom"
178 @closeBottom="closeBottom" 178 @closeBottom="closeBottom"
179 ></BottomSheet> 179 ></BottomSheet>
180 </template> 180 </template>
181 <!-- 分享 --> 181 <!-- 分享 -->
182 <template> 182 <template>
183 <uni-popup 183 <uni-popup
184 ref="popupShare" 184 ref="popupShare"
185 type="share" 185 type="share"
186 > 186 >
187 <uni-popup-share @select="selectShare"></uni-popup-share> 187 <uni-popup-share @select="selectShare"></uni-popup-share>
188 </uni-popup> 188 </uni-popup>
189 </template> 189 </template>
190 <!-- 分享海报 --> 190 <!-- 分享海报 -->
191 <template> 191 <template>
192 <uni-popup 192 <uni-popup
193 ref="uniPopupPost" 193 ref="uniPopupPost"
194 type="center" 194 type="center"
195 > 195 >
196 <uni-popup-post :postUrl="postUrl"></uni-popup-post> 196 <uni-popup-post :postUrl="postUrl"></uni-popup-post>
197 </uni-popup> 197 </uni-popup>
198 </template> 198 </template>
199 </view> 199 </view>
200 </template> 200 </template>
201 201
202 <script> 202 <script>
203 import store from '@/store' 203 import store from '@/store'
204 import Introduce from './components/Introduce' // 商品介绍基本信息组件 204 import Introduce from './components/Introduce' // 商品介绍基本信息组件
205 import AfterSails from './components/AfterSails' // 售后保障组件 205 import AfterSails from './components/AfterSails' // 售后保障组件
206 import uniPopupShare from '@/components/uni-popup/uni-popup-share.vue' // 分享组件 206 import uniPopupShare from '@/components/uni-popup/uni-popup-share.vue' // 分享组件
207 import uniPopupPost from '@/components/uni-popup/uni-popup-post.vue' // 分享组件 207 import uniPopupPost from '@/components/uni-popup/uni-popup-post.vue' // 分享组件
208 import BottomSheet from '@/components/BottomSheet/BottomSheet.vue' // 参数选择组件 208 import BottomSheet from '@/components/BottomSheet/BottomSheet.vue' // 参数选择组件
209 209
210 export default { 210 export default {
211 components: { 211 components: {
212 Introduce, 212 Introduce,
213 AfterSails, 213 AfterSails,
214 BottomSheet, 214 BottomSheet,
215 uniPopupShare, 215 uniPopupShare,
216 uniPopupPost, 216 uniPopupPost,
217 }, 217 },
218 data () { 218 data () {
219 return { 219 return {
220 pid: 7, // 产品ID 220 pid: 7, // 产品ID
221 skId: undefined, // skuId 221 skId: undefined, // skuId
222 // 详细信息菜单 222 // 详细信息菜单
223 item_current: 0, 223 item_current: 0,
224 screenItems: [ 224 screenItems: [
225 '商品介绍', 225 '商品介绍',
226 '规格参数', 226 '规格参数',
227 '售后保障', 227 '售后保障',
228 ], 228 ],
229 showPostImg: false, // 是否展示分享海报 229 showPostImg: false, // 是否展示分享海报
230 isShowBottom: false, // 是否展示参数选择 230 isShowBottom: false, // 是否展示参数选择
231 isCart: 1, // 参数选择 按钮判断 231 isCart: 1, // 参数选择 按钮判断
232 } 232 }
233 }, 233 },
234 onLoad({ pid = this.pid, sk_id: skId }) { 234 onLoad({ pid = this.pid, sk_id: skId }) {
235 // 根据页面传参请求页面数据 235 // 根据页面传参请求页面数据
236 this.pid = pid 236 this.pid = pid
237 this.skId = skId 237 this.skId = skId
238 238
239 // 获取产品详情 239 // 获取产品详情
240 this.getDetails({ pid, skId }) 240 this.getDetails({ pid, skId })
241 // 获取购物车数据 241 // 获取购物车数据
242 this.getCartNum() 242 this.getCartNum()
243 }, 243 },
244 computed: { 244 computed: {
245 // 获取轮播图数据 245 // 获取轮播图数据
246 goodInfo() { 246 goodInfo() {
247 return this.$store.state.details.goodInfo 247 return this.$store.state.details.goodInfo
248 }, 248 },
249 // 获取轮播图数据 249 // 获取轮播图数据
250 carousel() { 250 carousel() {
251 return this.$store.state.details.carousel 251 return this.$store.state.details.carousel
252 }, 252 },
253 // 商品基本信息 253 // 商品基本信息
254 goodsInfo() { 254 goodsInfo() {
255 return this.$store.state.details.goodsInfo 255 return this.$store.state.details.goodsInfo
256 }, 256 },
257 // 商品介绍商品标签 257 // 商品介绍商品标签
258 tag() { 258 tag() {
259 return this.$store.state.details.tag 259 return this.$store.state.details.tag
260 }, 260 },
261 // 规格参数 261 // 规格参数
262 specification() { 262 specification() {
263 return this.$store.state.details.specification 263 return this.$store.state.details.specification
264 }, 264 },
265 // 评价 265 // 评价
266 evaluate() { 266 evaluate() {
267 return this.$store.state.details.evaluate 267 return this.$store.state.details.evaluate
268 }, 268 },
269 // 商品详情 269 // 商品详情
270 more() { 270 more() {
271 return this.$store.state.details.more 271 return this.$store.state.details.more
272 }, 272 },
273 // 购物车数目 273 // 购物车数目
274 cartNumber() { 274 cartNumber() {
275 return this.$store.state.details.cartNumber 275 return this.$store.state.details.cartNumber
276 }, 276 },
277 // 购物车数目 277 // 购物车数目
278 skuList() { 278 skuList() {
279 return this.$store.state.details.skuList 279 return this.$store.state.details.skuList
280 }, 280 },
281 // 分享海报 281 // 分享海报
282 postUrl() { 282 postUrl() {
283 return this.$store.state.details.postUrl 283 return this.$store.state.details.postUrl
284 }, 284 },
285 }, 285 },
286 methods: { 286 methods: {
287 // 获取产品详情 287 // 获取产品详情
288 getDetails({ pid, skId }) { 288 getDetails({ pid, skId }) {
289 store.dispatch('details/details', { 289 store.dispatch('details/details', {
290 pid, 290 pid,
291 sk_id: skId, 291 sk_id: skId,
292 }) 292 })
293 store.dispatch('read/fetch', { 293 store.dispatch('read/fetch', {
294 pid, 294 pid,
295 sk_id: skId, 295 sk_id: skId,
296 }) 296 })
297 }, 297 },
298 // 获取购物车数目 298 // 获取购物车数目
299 getCartNum() { 299 getCartNum() {
300 store.dispatch('details/getCartNumber') 300 store.dispatch('details/getCartNumber')
301 }, 301 },
302 // 切换详细信息菜单 302 // 切换详细信息菜单
303 tabChange (e) { 303 tabChange (e) {
304 if (this.current !== e) { 304 if (this.current !== e) {
305 this.item_current = e 305 this.item_current = e
306 } 306 }
307 }, 307 },
308 // 打开分享界面 308 // 打开分享界面
309 confirmShare() { 309 confirmShare() {
310 this.$refs.popupShare.open() 310 this.$refs.popupShare.open()
311 }, 311 },
312 // 选择分享 312 // 选择分享
313 selectShare(e, done) { 313 selectShare(e, done) {
314 switch (e.item.name) { 314 switch (e.item.name) {
315 // 分享到好物圈 315 // 分享到好物圈
316 case 'recommend': 316 case 'recommend':
317 this.shareRecommend() 317 this.shareRecommend()
318 break 318 break
319 // 分享到朋友圈 319 // 分享到朋友圈
320 case 'friend': 320 case 'friend':
321 break 321 break
322 // 生成海报 322 // 生成海报
323 case 'poster': 323 case 'poster':
324 uni.showLoading({ 324 uni.showLoading({
325 title: '生成图片中', 325 title: '生成图片中',
326 }) 326 })
327 this.sharePost() 327 this.sharePost()
328 break 328 break
329 default: 329 default:
330 break 330 break
331 } 331 }
332 done() 332 done()
333 }, 333 },
334 // 分享到好物圈 334 // 分享到好物圈
335 shareRecommend() { 335 shareRecommend() {
336 if (wx.openBusinessView) { 336 if (wx.openBusinessView) {
337 wx.openBusinessView({ 337 wx.openBusinessView({
338 businessType: 'friendGoodsRecommend', 338 businessType: 'friendGoodsRecommend',
339 extraData: { 339 extraData: {
340 product: { 340 product: {
341 item_code: '58_68', 341 item_code: '58_68',
342 title: this.goodsInfo.name, 342 title: this.goodsInfo.name,
343 image_list: this.carousel, 343 image_list: this.carousel,
344 }, 344 },
345 }, 345 },
346 success: function (res) { 346 success: function (res) {
347 uni.showToast({ 347 uni.showToast({
348 title: '好物圈分享成功!', 348 title: '好物圈分享成功!',
349 icon: 'none', 349 icon: 'none',
350 duration: 2000, 350 duration: 2000,
351 }) 351 })
352 // 向服务器报告这个事情 352 // 向服务器报告这个事情
353 // TODO:::记录这个用户的推广过程。 353 // TODO:::记录这个用户的推广过程。
354 console.log('好物圈分享成功!', res) 354 console.log('好物圈分享成功!', res)
355 }, 355 },
356 fail: function (res) { 356 fail: function (res) {
357 console.log('好物圈分享失败!', res) 357 console.log('好物圈分享失败!', res)
358 }, 358 },
359 }) 359 })
360 } 360 }
361 }, 361 },
362 // 分享到朋友/圈 362 // 分享到朋友/圈
363 shareFriend() { 363 shareFriend() {
364 this.onShareAppMessage() 364 this.onShareAppMessage()
365 }, 365 },
366 // 朋友圈设置页面 366 // 朋友圈设置页面
367 onShareAppMessage() { 367 onShareAppMessage() {
368 let myName = this.$store.state.user.userInfo.nickName 368 let myName = this.$store.state.user.userInfo.nickName
369 if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') { 369 if (myName === '' || myName.length < 1 || myName === '匿名用户' || typeof myName === 'undefined') {
370 myName = '【神秘人】' 370 myName = '【神秘人】'
371 } else { 371 } else {
372 myName = '【' + myName + '】' 372 myName = '【' + myName + '】'
373 } 373 }
374 return { 374 return {
375 title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等) 375 title: 'Hi,' + myName + '送你300元来试戴最新潮流眼镜!', // 默认是小程序的名称(可以写slogan等)
376 path: '/pages/details/details?sid=0&pid=' + this.pid, 376 path: '/pages/details/details?sid=0&pid=' + this.pid,
377 imageUrl: this.skuList[0].pic, // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 377 imageUrl: this.skuList[0].pic, // 不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
378 success: function (res) { 378 success: function (res) {
379 if (res.errMsg === 'shareAppMessage:ok') { 379 if (res.errMsg === 'shareAppMessage:ok') {
380 console.log('分享成功!', res) 380 console.log('分享成功!', res)
381 } 381 }
382 }, 382 },
383 fail: function (res) { 383 fail: function (res) {
384 if (res.errMsg === 'shareAppMessage:fail cancel') { 384 if (res.errMsg === 'shareAppMessage:fail cancel') {
385 console.log('fail', '放弃分享') 385 console.log('fail', '放弃分享')
386 } else if (res.errMsg === 'shareAppMessage:fail') { 386 } else if (res.errMsg === 'shareAppMessage:fail') {
387 console.log('fail', '分享失败') 387 console.log('fail', '分享失败')
388 } 388 }
389 }, 389 },
390 } 390 }
391 }, 391 },
392 // 生成海报 392 // 生成海报
393 sharePost() { 393 sharePost() {
394 const fromsid = this.$store.state.user.fromInfo.fromsid || 'undefined' 394 const fromsid = this.$store.state.user.fromInfo.fromsid || 'undefined'
395 395
396 store.dispatch('details/post', { 396 store.dispatch('details/post', {
397 pid: this.pid, 397 pid: this.pid,
398 sid: fromsid === 'undefined' ? 0 : fromsid, 398 sid: fromsid === 'undefined' ? 0 : fromsid,
399 }).then((data) => { 399 }).then((data) => {
400 uni.hideLoading() 400 uni.hideLoading()
401 this.$refs.uniPopupPost.open() 401 this.$refs.uniPopupPost.open()
402 }) 402 })
403 }, 403 },
404 // 参数选择弹窗开关 404 // 参数选择弹窗开关
405 showBottom(isCart) { 405 showBottom(isCart) {
406 this.isCart = isCart 406 this.isCart = isCart
407 this.isShowBottom = true 407 this.isShowBottom = true
408 }, 408 },
409 closeBottom() { 409 closeBottom() {
410 this.isShowBottom = false 410 this.isShowBottom = false
411 }, 411 },
412 // 前往购物车 412 // 前往购物车
413 toCart() { 413 toCart() {
414 uni.switchTab({ 414 uni.switchTab({
415 url: '/pages/cart/cart', 415 url: '/pages/cart/cart',
416 success: res => {}, 416 success: res => {},
417 fail: (error) => { console.log('跳转购物车失败======>', error) }, 417 fail: (error) => { console.log('跳转购物车失败======>', error) },
418 complete: () => { console.log('toCart') }, 418 complete: () => { console.log('toCart') },
419 }) 419 })
420 }, 420 },
421 // 加入购物车 421 // 加入购物车
422 addCart (mpId, num, checkedSKU, skId, price) { 422 addCart (mpId, num, checkedSKU, skId, price) {
423 const addCartList = {} 423 const addCartList = {}
424 addCartList.mp_id = mpId 424 addCartList.mp_id = mpId
425 addCartList.sk_id = skId 425 addCartList.sk_id = skId
426 addCartList.num = num 426 addCartList.num = num
427 addCartList.checkedSKU = checkedSKU 427 // addCartList.checkedSKU = checkedSKU
428 addCartList.pid = this.pid 428 addCartList.pid = this.pid
429 addCartList.price = price 429 addCartList.price = price
430 console.log('添加购物车的参数', addCartList) 430 console.log('添加购物车的参数', addCartList)
431 store.dispatch('cart/addCart', addCartList).then((res) => { 431 store.dispatch('cart/addCart', addCartList).then((res) => {
432 if (res.code === 1) { 432 if (res.code === 1) {
433 uni.showToast({ 433 uni.showToast({
434 title: '添加成功~', 434 title: '添加成功~',
435 icon: 'success', 435 icon: 'success',
436 }) 436 })
437 } 437 }
438 // 再次请求购物车接口,实现实时更新 438 // 再次请求购物车接口,实现实时更新
439 store.dispatch('details/getCartNumber') 439 store.dispatch('details/getCartNumber')
440 }) 440 })
441 }, 441 },
442 }, 442 },
443 } 443 }
444 </script> 444 </script>
445 445
446 <style lang="scss"> 446 <style lang="scss">
447 .container { 447 .container {
448 background-color: #f8f8f8; 448 background-color: #f8f8f8;
449 font-family: "PingFangSC-Regular"; 449 font-family: "PingFangSC-Regular";
450 // 板块样式 450 // 板块样式
451 > view { 451 > view {
452 background: #ffffff; 452 background: #ffffff;
453 margin-bottom: 10px; 453 margin-bottom: 10px;
454 padding: 8px 20px 8px 20px; 454 padding: 8px 20px 8px 20px;
455 box-sizing: border-box; 455 box-sizing: border-box;
456 } 456 }
457 // 基础信息板块 457 // 基础信息板块
458 .basic_info { 458 .basic_info {
459 // 轮播图 459 // 轮播图
460 .swiperImage { 460 .swiperImage {
461 width: 684rpx; 461 width: 684rpx;
462 height: 480rpx; 462 height: 480rpx;
463 text-align: center; 463 text-align: center;
464 image { 464 image {
465 max-width: 100%; 465 max-width: 100%;
466 max-height: 100%; 466 max-height: 100%;
467 border-radius: 16rpx; 467 border-radius: 16rpx;
468 } 468 }
469 } 469 }
470 // 产品价格及购买人数 470 // 产品价格及购买人数
471 .info_pay { 471 .info_pay {
472 color: #eb5d3b; 472 color: #eb5d3b;
473 font-size: 18px; 473 font-size: 18px;
474 margin-top: 5px; 474 margin-top: 5px;
475 font-family: "PingFangSC-Semibold"; 475 font-family: "PingFangSC-Semibold";
476 display: flex; 476 display: flex;
477 justify-content: space-between; 477 justify-content: space-between;
478 .info_pay_discount { 478 .info_pay_discount {
479 text-decoration: line-through; 479 text-decoration: line-through;
480 margin-left: 8rpx; 480 margin-left: 8rpx;
481 color: #999; 481 color: #999;
482 font-size: 14px; 482 font-size: 14px;
483 } 483 }
484 .info_pay_number { 484 .info_pay_number {
485 color: #999; 485 color: #999;
486 font-size: 14px; 486 font-size: 14px;
487 font-family: PingFangSC-Regular; 487 font-family: PingFangSC-Regular;
488 } 488 }
489 } 489 }
490 // 产品名称 490 // 产品名称
491 .info_name { 491 .info_name {
492 margin-top: 5px; 492 margin-top: 5px;
493 display: flex; 493 display: flex;
494 justify-content: space-between; 494 justify-content: space-between;
495 .info_name_name { 495 .info_name_name {
496 margin-right: 10px; 496 margin-right: 10px;
497 font-size: 16px; 497 font-size: 16px;
498 font-family: "PingFangSC-Semibold"; 498 font-family: "PingFangSC-Semibold";
499 max-width: 592rpx; 499 max-width: 592rpx;
500 } 500 }
501 .info_name_share { 501 .info_name_share {
502 display: flex; 502 display: flex;
503 flex-direction: column; 503 flex-direction: column;
504 justify-content: space-between; 504 justify-content: space-between;
505 align-items: center; 505 align-items: center;
506 margin-top: 14rpx; 506 margin-top: 14rpx;
507 > image { 507 > image {
508 height: 40rpx; 508 height: 40rpx;
509 width: 40rpx; 509 width: 40rpx;
510 } 510 }
511 > text { 511 > text {
512 font-family: PingFangSC-Regular; 512 font-family: PingFangSC-Regular;
513 font-size: 12px; 513 font-size: 12px;
514 color: #999; 514 color: #999;
515 letter-spacing: -0.23px; 515 letter-spacing: -0.23px;
516 } 516 }
517 } 517 }
518 } 518 }
519 // 售后服务 519 // 售后服务
520 .info_after { 520 .info_after {
521 font-size: 10px; 521 font-size: 10px;
522 color: #999; 522 color: #999;
523 margin-top: 20rpx; 523 margin-top: 20rpx;
524 > span { 524 > span {
525 height: 14px; 525 height: 14px;
526 margin-right: 10px; 526 margin-right: 10px;
527 } 527 }
528 } 528 }
529 } 529 }
530 // 详细信息 530 // 详细信息
531 .detail_info { 531 .detail_info {
532 margin-bottom: 20rpx; 532 margin-bottom: 20rpx;
533 .screen_bar { 533 .screen_bar {
534 width: 670rpx; 534 width: 670rpx;
535 margin-top: 20rpx; 535 margin-top: 20rpx;
536 margin-bottom: 24rpx; 536 margin-bottom: 24rpx;
537 display: flex; 537 display: flex;
538 flex-direction: row; 538 flex-direction: row;
539 justify-content: space-between; 539 justify-content: space-between;
540 align-items: center; 540 align-items: center;
541 font-size: 14px; 541 font-size: 14px;
542 color: #333333; 542 color: #333333;
543 transition: all 0.2s; 543 transition: all 0.2s;
544 } 544 }
545 .item_active { 545 .item_active {
546 border-bottom: 4rpx solid #ff6b4a; 546 border-bottom: 4rpx solid #ff6b4a;
547 } 547 }
548 .screen_item { 548 .screen_item {
549 font-size: 32rpx; 549 font-size: 32rpx;
550 color: #333333; 550 color: #333333;
551 display: flex; 551 display: flex;
552 transition: all 0.2s; 552 transition: all 0.2s;
553 // 规格参数 553 // 规格参数
554 .specification { 554 .specification {
555 margin-bottom: 4px; 555 margin-bottom: 4px;
556 .spe_item { 556 .spe_item {
557 image { 557 image {
558 width: 50px; 558 width: 50px;
559 height: 25px; 559 height: 25px;
560 margin-right: 6px; 560 margin-right: 6px;
561 vertical-align: middle; 561 vertical-align: middle;
562 } 562 }
563 span { 563 span {
564 margin-left: 24rpx; 564 margin-left: 24rpx;
565 } 565 }
566 } 566 }
567 } 567 }
568 } 568 }
569 // 569 //
570 } 570 }
571 // 宝贝好评率 571 // 宝贝好评率
572 .evaluate { 572 .evaluate {
573 .evaluate_title { 573 .evaluate_title {
574 font-size: 14px; 574 font-size: 14px;
575 color: #333333; 575 color: #333333;
576 display: flex; 576 display: flex;
577 justify-content: space-between; 577 justify-content: space-between;
578 .title_rate { 578 .title_rate {
579 margin-left: 10rpx; 579 margin-left: 10rpx;
580 } 580 }
581 .evaluate_star { 581 .evaluate_star {
582 width: 90px; 582 width: 90px;
583 display: flex; 583 display: flex;
584 align-items: center; 584 align-items: center;
585 justify-content: space-between; 585 justify-content: space-between;
586 } 586 }
587 view { 587 view {
588 font-size: 14px; 588 font-size: 14px;
589 color: #333333; 589 color: #333333;
590 font-weight: bold; 590 font-weight: bold;
591 } 591 }
592 } 592 }
593 .evaluate_tag { 593 .evaluate_tag {
594 view { 594 view {
595 display: inline-block; 595 display: inline-block;
596 margin-right: 20rpx; 596 margin-right: 20rpx;
597 min-width: 180rpx; 597 min-width: 180rpx;
598 margin-top: 10px; 598 margin-top: 10px;
599 height: 48rpx; 599 height: 48rpx;
600 background: #f2f2f2; 600 background: #f2f2f2;
601 border-radius: 2px; 601 border-radius: 2px;
602 font-family: PingFangSC-Regular; 602 font-family: PingFangSC-Regular;
603 font-size: 12px; 603 font-size: 12px;
604 color: #666666; 604 color: #666666;
605 letter-spacing: -0.23px; 605 letter-spacing: -0.23px;
606 text-align: center; 606 text-align: center;
607 padding: 0 48rpx; 607 padding: 0 48rpx;
608 line-height: 48rpx; 608 line-height: 48rpx;
609 } 609 }
610 } 610 }
611 } 611 }
612 // 商品详情 612 // 商品详情
613 .more_info { 613 .more_info {
614 .more_fixed1 { 614 .more_fixed1 {
615 display: flex; 615 display: flex;
616 justify-content: space-between; 616 justify-content: space-between;
617 align-content: center; 617 align-content: center;
618 margin-bottom: 12px; 618 margin-bottom: 12px;
619 view { 619 view {
620 font-size: 14px; 620 font-size: 14px;
621 color: #333333; 621 color: #333333;
622 font-weight: bold; 622 font-weight: bold;
623 font-family: "PingFangSC-Medium"; 623 font-family: "PingFangSC-Medium";
624 line-height: 24px; 624 line-height: 24px;
625 } 625 }
626 image { 626 image {
627 width: 240rpx; 627 width: 240rpx;
628 height: 3px; 628 height: 3px;
629 margin-top: 10px; 629 margin-top: 10px;
630 } 630 }
631 } 631 }
632 .more_all { 632 .more_all {
633 width: 100%; 633 width: 100%;
634 margin-top: 30rpx; 634 margin-top: 30rpx;
635 margin-right: 30rpx; 635 margin-right: 30rpx;
636 margin-bottom: 180rpx; 636 margin-bottom: 180rpx;
637 font-family: "PingFangSC-Regular"; 637 font-family: "PingFangSC-Regular";
638 } 638 }
639 } 639 }
640 // 菜单 640 // 菜单
641 .menu { 641 .menu {
642 position: fixed; 642 position: fixed;
643 bottom: 0; 643 bottom: 0;
644 min-height: 74px; 644 min-height: 74px;
645 width: 100%; 645 width: 100%;
646 background: #ffffff; 646 background: #ffffff;
647 padding: 20px 20px 8px 20px; 647 padding: 20px 20px 8px 20px;
648 font-family: "PingFangSC-Regular"; 648 font-family: "PingFangSC-Regular";
649 box-sizing: border-box; 649 box-sizing: border-box;
650 display: flex; 650 display: flex;
651 justify-content: space-between; 651 justify-content: space-between;
652 align-content: center; 652 align-content: center;
653 margin: 0; 653 margin: 0;
654 /* iphonex 等安全区设置,底部安全区适配 */ 654 /* iphonex 等安全区设置,底部安全区适配 */
655 /* #ifndef APP-NVUE */ 655 /* #ifndef APP-NVUE */
656 padding-bottom: constant(safe-area-inset-bottom); 656 padding-bottom: constant(safe-area-inset-bottom);
657 padding-bottom: env(safe-area-inset-bottom); 657 padding-bottom: env(safe-area-inset-bottom);
658 .menu_1 { 658 .menu_1 {
659 width: 20%; 659 width: 20%;
660 height: 100%; 660 height: 100%;
661 text-align: center; 661 text-align: center;
662 color: #989898; 662 color: #989898;
663 .cart_icon { 663 .cart_icon {
664 position: relative; 664 position: relative;
665 text { 665 text {
666 position: absolute; 666 position: absolute;
667 color: white; 667 color: white;
668 font-size: 17px; 668 font-size: 17px;
669 background-color: red; 669 background-color: red;
670 min-height: 24px; 670 min-height: 24px;
671 min-width: 24px; 671 min-width: 24px;
672 line-height: 24px; 672 line-height: 24px;
673 right: -12%; 673 right: -12%;
674 top: -12px; 674 top: -12px;
675 text-align: center; 675 text-align: center;
676 border-radius: 24px; 676 border-radius: 24px;
677 padding: 2px; 677 padding: 2px;
678 } 678 }
679 } 679 }
680 } 680 }
681 image { 681 image {
682 width: 42%; 682 width: 42%;
683 height: 26px; 683 height: 26px;
684 } 684 }
685 .menu_image { 685 .menu_image {
686 font-size: 12px; 686 font-size: 12px;
687 text-align: center; 687 text-align: center;
688 } 688 }
689 .menu_2 { 689 .menu_2 {
690 width: 74%; 690 width: 74%;
691 height: 80rpx; 691 height: 80rpx;
692 display: grid; 692 display: grid;
693 grid-template-columns: 50% 50%; 693 grid-template-columns: 50% 50%;
694 } 694 }
695 .menu_input { 695 .menu_input {
696 display: inline-flex; 696 display: inline-flex;
697 align-items: center; 697 align-items: center;
698 justify-content: space-around; 698 justify-content: space-around;
699 background: #fff0ec; 699 background: #fff0ec;
700 font-size: 16px; 700 font-size: 16px;
701 color: #ff6b4a; 701 color: #ff6b4a;
702 border-radius: 20px 0 0 20px; 702 border-radius: 20px 0 0 20px;
703 } 703 }
704 .menu_now { 704 .menu_now {
705 display: inline-flex; 705 display: inline-flex;
706 align-items: center; 706 align-items: center;
707 justify-content: space-around; 707 justify-content: space-around;
708 background: #ff6b4a; 708 background: #ff6b4a;
709 font-size: 16px; 709 font-size: 16px;
710 color: #ffffff; 710 color: #ffffff;
711 border-radius: 0 20px 20px 0; 711 border-radius: 0 20px 20px 0;
712 } 712 }
713 } 713 }
714 } 714 }
715 </style> 715 </style>
716 716
src/pages/myOrder/components/OrderCard.vue
1 <template> 1 <template>
2 <view> 2 <view>
3 <view 3 <view
4 class="card" 4 class="card"
5 v-if="current == status" 5 v-if="current == status"
6 @click="toOrderInfo(status,order.pay_id)" 6
7 > 7 >
8 <view class="cardHeader"> 8 <view class="cardHeader">
9 <text 9 <text
10 class="orderId" 10 class="orderId"
11 v-if="status == '0'||status == '1'" 11 v-if="status == '0'||status == '1'"
12 >订单号:{{order.pay_id}}</text> 12 >订单号:{{order.pay_id}}</text>
13 <text 13 <text
14 class="orderId" 14 class="orderId"
15 v-if="status == '2'||status == '3'" 15 v-if="status == '2'||status == '3'"
16 >下单时间:{{order.pay_time}}</text> 16 >下单时间:{{order.pay_time}}</text>
17 <text 17 <text
18 class="orderType" 18 class="orderType"
19 v-if="status=='0'" 19 v-if="status=='0'"
20 >待付款</text> 20 >待付款</text>
21 <text 21 <text
22 class="orderType" 22 class="orderType"
23 v-if="status=='1'" 23 v-if="status=='1'"
24 >待收货</text> 24 >待收货</text>
25 <text 25 <text
26 class="orderType" 26 class="orderType"
27 v-if="status == '2'||status == '3'" 27 v-if="status == '2'||status == '3'"
28 >已完成</text> 28 >已完成</text>
29 <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> 29 <!-- <text class="orderType" v-if="status == '3'">已评价</text> -->
30 </view> 30 </view>
31 <view 31 <view
32 class="orderCardInfo" 32 class="orderCardInfo"
33 @click="toOrderInfo(status,order.pay_id)"
33 v-for="(orderInfo, index) in orderInfoList" 34 v-for="(orderInfo, index) in orderInfoList"
34 :key="index" 35 :key="index"
35 > 36 >
36 <image 37 <image
37 :src="orderInfo.imgUrl" 38 :src="orderInfo.imgUrl"
38 mode="aspectFill" 39 mode="aspectFill"
39 ></image> 40 ></image>
40 <view class="infoText"> 41 <view class="infoText">
41 <view class="orderName">{{orderInfo.p_name}}</view> 42 <view class="orderName">{{orderInfo.p_name}}</view>
42 <view class="orderDescrib">{{orderInfo.p_name}}</view> 43 <view class="orderDescrib">{{orderInfo.p_name}}</view>
43 <view class="infoText-bottom"> 44 <view class="infoText-bottom">
44 <view class="markPrice">{{orderInfo.nowPrice}}</view> 45 <view class="markPrice">{{orderInfo.nowPrice}}</view>
45 <view class="buy-num">X {{orderInfo.num}}</view> 46 <view class="buy-num">X {{orderInfo.num}}</view>
46 </view> 47 </view>
47 </view> 48 </view>
48 </view> 49 </view>
49 <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> 50 <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view>
50 <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 --> 51 <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 -->
51 <view 52 <view
52 class="btns" 53 class="btns"
53 v-if="status == '0'" 54 v-if="status == '0'"
54 > 55 >
55 <view class="btn-type1" @click="cancleOrder">取消订单</view> 56 <view class="btn-type1" @click="cancleOrder">取消订单</view>
56 <view class="btn-type2" @click="paylog">去支付</view> 57 <view class="btn-type2" @click="paylog">去支付</view>
57 </view> 58 </view>
58 <view 59 <view
59 class="btns" 60 class="btns"
60 v-if="status == '1'" 61 v-if="status == '1'"
61 > 62 >
62 <view class="btn-type2">确认收货</view> 63 <view class="btn-type2">确认收货</view>
63 </view> 64 </view>
64 <view 65 <view
65 class="btns" 66 class="btns"
66 v-if="status == '2'" 67 v-if="status == '2'"
67 > 68 >
68 <view class="btn-type2" @click="toDetail">再次购买</view> 69 <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view>
69 </view> 70 </view>
70 <!-- <view class="btns" v-if="status == '3'"> 71 <!-- <view class="btns" v-if="status == '3'">
71 <view class="btn-type2">再次购买</view> 72 <view class="btn-type2">再次购买</view>
72 </view> --> 73 </view> -->
73 </view> 74 </view>
74 <view class="card" v-if="current == '10'" @click="toOrderInfo(status,order.pay_id)"> 75 <view class="card" v-if="current == '10'" >
75 <view class="cardHeader"> 76 <view class="cardHeader">
76 <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.pay_id}}</text> 77 <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.pay_id}}</text>
77 <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> 78 <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text>
78 <text class="orderType" v-if="status=='0'">待付款</text> 79 <text class="orderType" v-if="status=='0'">待付款</text>
79 <text class="orderType" v-if="status=='1'">待收货</text> 80 <text class="orderType" v-if="status=='1'">待收货</text>
80 <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> 81 <text class="orderType" v-if="status == '2'||status == '3'">已完成</text>
81 <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> 82 <!-- <text class="orderType" v-if="status == '3'">已评价</text> -->
82 </view> 83 </view>
83 <view class="orderCardInfo" v-for="(orderInfo) in orderInfoList" :key="orderInfo"> 84 <view class="orderCardInfo" @click="toOrderInfo(status,order.pay_id)" v-for="(orderInfo) in orderInfoList" :key="orderInfo">
84 <image :src="orderInfo.imgUrl" mode="aspectFill"></image> 85 <image :src="orderInfo.imgUrl" mode="aspectFill"></image>
85 <view class="infoText"> 86 <view class="infoText">
86 <view class="orderName">{{orderInfo.p_name}}</view> 87 <view class="orderName">{{orderInfo.p_name}}</view>
87 <view class="orderDescrib">{{orderInfo.p_name}}</view> 88 <view class="orderDescrib">{{orderInfo.p_name}}</view>
88 <view class="infoText-bottom"> 89 <view class="infoText-bottom">
89 <view class="markPrice">{{orderInfo.nowPrice}}</view> 90 <view class="markPrice">{{orderInfo.nowPrice}}</view>
90 <view class="buy-num">X {{orderInfo.num}}</view> 91 <view class="buy-num">X {{orderInfo.num}}</view>
91 </view> 92 </view>
92 </view> 93 </view>
93 </view> 94 </view>
94 <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> 95 <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view>
95 <view class="btns" v-if="status == '0'"> 96 <view class="btns" v-if="status == '0'">
96 <view class="btn-type1" >取消订单</view> 97 <view class="btn-type1" @click="cancleOrder">取消订单</view>
97 <view class="btn-type2">去支付</view> 98 <view class="btn-type2" @click="paylog">去支付</view>
98 </view> 99 </view>
99 <view class="btns" v-if="status == '1'"> 100 <view class="btns" v-if="status == '1'">
100 <view class="btn-type2">确认收货</view> 101 <view class="btn-type2">确认收货</view>
101 </view> 102 </view>
102 <view class="btns" v-if="status == '2'||status == '3'"> 103 <view class="btns" v-if="status == '2'||status == '3'">
103 <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view> 104 <view class="btn-type2" @click="toDetail(order.order_info[0].pid)">再次购买</view>
104 </view> 105 </view>
105 <!-- <view class="btns" v-if="status == '3'">
106
107 <view class="btn-type2">再次购买</view>
108 </view> -->
109 </view> 106 </view>
110 </view> 107 </view>
111 </template> 108 </template>
112 109
113 <script> 110 <script>
111 import MD5Util from '../../../utils/md5'
112 import store from "@/store";
114 export default { 113 export default {
114 data() {
115 return {
116
117 };
118 },
115 props: { 119 props: {
116 /** 120 /**
117 * 订单数据 121 * 订单数据
118 */ 122 */
119 order: {}, 123 order: {},
120 /** 124 /**
121 * 当前选择 125 * 当前选择
122 */ 126 */
123 current:Number 127 current:Number
124 128
125 }, 129 },
126 created() { 130 created() {
127 console.log('order',this.order); 131 console.log('order',this.order);
128 // console.log(this.order.status ); 132 // console.log(this.order.status );
129 // console.log(this.current); 133 // console.log(this.current);
130 }, 134 },
131 computed:{ 135 computed:{
132 status(){ 136 status(){
133 return this.order.status 137 return this.order.status
134 }, 138 },
135 orderInfoList(){ 139 orderInfoList(){
136 return this.order.order_info 140 return this.order.order_info
137 } 141 }
138 }, 142 },
139 data() {
140 return {
141 };
142 },
143 methods:{ 143 methods:{
144 cancleOrder() { 144 async paylog() {
145 // const openid = uni.getStorageSync('openid') 145 const openid = uni.getStorageSync('openid')
146 // const uid = this.order.uid; 146 const uid = this.order.uid;
147 // const openid = openid; 147 //先拿订单详情
148 // const keyname = this.orderInfo.order_info.keyname 148 await store.dispatch('orderRead/getOrderInfo', {
149 // // console.log('keyname',this.orderInfo.keyname) 149 pay_id: this.order.pay_id,
150 // uni.showModal({ 150 uid: uid,
151 // title: "提示", 151 openid: openid
152 // content: "现在取消,订单不可恢复哦,确认取消吗?", 152 }).then((res)=>{
153 // success: function(res) { 153 // console.log(res)
154 // if (res.confirm) { 154 const { data, exKeyName: keyName } = res.order_info
155 // store.dispatch("cancelOrder/cancel", { 155 const timeStamp = new Date().getTime().toString()
156 // keyname: keyname, 156 const total_fee = res.total_fee
157 // uid: uid, 157 const payId = res.pay_id
158 // openid: openid 158 const nonceStr = 'asfafasfasfasfasf'
159 // }); 159 // 支付参数
160 // } else if (res.cancel) { 160 const fieldSet = {
161 // console.log("用户点击取消"); 161 openid: openid,
162 // } 162 uid: uid,
163 // } 163 shopid: 0,
164 // }); 164 payCate: 2020,
165 payMoney: total_fee,
166 payWoodId: `fcdj-${uid}-${keyName}`,
167 payWoodDesc: '在【非常戴镜】的微信付款凭证',
168 nonceStr,
169 signType: 'MD5',
170 app_uid: 2020,
171 timeStamp,
172 keyname: keyName,
173 billInfo: JSON.stringify(data),
174 }
175 // 请求后台支付接口
176 store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => {
177 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') {
178 const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}`
179 const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789'
180
181 // 微信支付接口
182 uni.requestPayment({
183 appId: data.appid,
184 timeStamp,
185 nonceStr,
186 total_fee: total_fee,
187 package: `prepay_id=${data.prepay_id}`,
188 signType: 'MD5',
189 paySign: MD5Util.MD5(stringSignTemp).toUpperCase(),
190 success: (res) => {
191 // 支付成功
192 uni.showModal({
193 content: '支付成功',
194 showCancel: false,
195 })
196 // //修改订单状态 待付款==>待收货
197 // store.dispatch("statusConfirm/confirm", {
198 // uid: this.uid,
199 // openid: this.openid,
200 // oldway: "0",
201 // way: "1",
202 // pay_id: payId,
203 // judgeContent: "",
204 // orderInfo: this.orderInfo.order_info
205 // })
206 },
207 fail: (res) => {
208 // 支付失败
209 uni.showModal({
210 content: '支付失败',
211 showCancel: false,
212 })
213 },
214 complete: () => {
215 uni.hideLoading()
216 },
217 })
218 } else {
219 uni.showModal({
220 content: '支付失败',
221 showCancel: false,
222 })
223 console.log('支付失败')
224 uni.hideLoading()
225 }
226 })
227 //修改订单状态 待付款==>待收货
228 // store.dispatch("statusConfirm/confirm", {
229 // uid: this.uid,
230 // openid: this.openid,
231 // oldway: "0",
232 // way: "1",
233 // pay_id: this.payId,
234 // judgeContent: "",
235 // orderInfo: this.orderInfo.order_info
236 // })
237 })
238 },
239
240 async cancleOrder(e) {
241 const openid = uni.getStorageSync('openid')
242 const uid = this.order.uid;
243 //先从订单详情中拿到keyname
244 await store.dispatch('orderRead/getOrderInfo', {
245 pay_id: this.order.pay_id,
246 uid: uid,
247 openid: openid
248 }).then((res)=>{
249 const keyname = res.order_info.keyname
250 uni.showModal({
251 title: "提示",
252 content: "现在取消,订单不可恢复哦,确认取消吗?",
253 success: function(res) {
254 if (res.confirm) {
255 store.dispatch("cancelOrder/cancel", {
256 keyname: keyname,
257 uid: uid,
258 openid: openid
259 }).then((res)=>{
260 console.log(res)
261 if(res.code == 1){
262 store.dispatch("myOrder/getList", {
263 way: ""
264 });
265 }else{
266 uni.showToast({
267 title:'取消失败,服务器错误!',
268 icon:'none'
269 })
270 }
271 });
272 } else if (res.cancel) {
273 console.log("用户点击取消");
274 }
275 }
276 });
277 });
278
165 }, 279 },
166 toDetail(pid){ 280 toDetail(pid){
167 console.log('pid',pid) 281 console.log('pid',pid)
168 uni.navigateTo({ 282 uni.navigateTo({
169 url: '../details/details?pid='+pid, 283 url: '../details/details?pid='+pid,
170 fail: (res) => {console.log(res)}, 284 fail: (res) => {console.log(res)},
171 }); 285 });
172 }, 286 },
173 toRefundment(){ 287 toRefundment(){
174 uni.navigateTo({ 288 uni.navigateTo({
175 url: '../refundment/refundment', 289 url: '../refundment/refundment',
176 success: res => {}, 290 success: res => {},
177 fail: () => {}, 291 fail: () => {},
178 complete: () => {} 292 complete: () => {}
179 }); 293 });
180 }, 294 },
181 toOrderInfo(status,payId){ 295 toOrderInfo(status,payId){
182 console.log(status,payId) 296 console.log(status,payId)
183 switch(status){ 297 switch(status){
184 // 0待付款 1待收货 2已收货 3 已评价 298 // 0待付款 1待收货 2已收货 3 已评价
185 case '0': 299 case '0':
186 uni.navigateTo({ 300 uni.navigateTo({
187 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, 301 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId,
188 fail(errMsg) { 302 fail(errMsg) {
189 console.log(errMsg) 303 console.log(errMsg)
190 } 304 }
191 }) 305 })
192 break; 306 break;
193 case '1': 307 case '1':
194 uni.navigateTo({ 308 uni.navigateTo({
195 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, 309 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId,
196 fail(errMsg) { 310 fail(errMsg) {
197 console.log(errMsg) 311 console.log(errMsg)
198 } 312 }
199 }) 313 })
200 314
201 break; 315 break;
202 case '2' || '3': 316 case '2' || '3':
203 uni.navigateTo({ 317 uni.navigateTo({
204 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, 318 url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId,
205 fail(errMsg) { 319 fail(errMsg) {
206 console.log(errMsg) 320 console.log(errMsg)
207 } 321 }
208 }) 322 })
209 break; 323 break;
210 default: 324 default:
211 break; 325 break;
212 326
213 } 327 }
214 } 328 }
215 } 329 }
216 } 330 }
217 331
218 </script> 332 </script>
219 333
220 <style lang="scss"> 334 <style lang="scss">
221 .card { 335 .card {
222 width: 670rpx; 336 width: 670rpx;
223 height: 478rpx; 337 // height: 478rpx;
224 background: #ffffff; 338 background: #ffffff;
225 box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06); 339 box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06);
226 border-radius: 8px; 340 border-radius: 8px;
227 border-radius: 8px; 341 border-radius: 8px;
228 margin-top: 20rpx; 342 margin-top: 20rpx;
229 padding: 40rpx; 343 padding: 40rpx;
230 box-sizing: border-box; 344 box-sizing: border-box;
231 .cardHeader { 345 .cardHeader {
232 width: 100%; 346 width: 100%;
233 height: 40rpx; 347 height: 40rpx;
234 display: flex; 348 display: flex;
235 justify-content: space-between; 349 justify-content: space-between;
236 align-items: center; 350 align-items: center;
237 .orderId { 351 .orderId {
238 font-size: 12px; 352 font-size: 12px;
239 color: #999999; 353 color: #999999;
240 } 354 }
241 .orderType { 355 .orderType {
242 font-size: 14px; 356 font-size: 14px;
243 color: #ff6b4a; 357 color: #ff6b4a;
244 } 358 }
245 } 359 }
246 .orderCardInfo { 360 .orderCardInfo {
247 width: 100%; 361 width: 100%;
248 height: 188rpx; 362 height: 188rpx;
249 display: flex; 363 display: flex;
250 flex-direction: row; 364 flex-direction: row;
251 justify-content: space-between; 365 justify-content: space-between;
252 align-items: center; 366 align-items: center;
253 margin-top: 40rpx; 367 margin-top: 40rpx;
254 image { 368 image {
255 height: 188rpx; 369 height: 188rpx;
256 width: 188rpx; 370 width: 188rpx;
257 margin-right: 24rpx; 371 margin-right: 24rpx;
258 } 372 }
259 .infoText { 373 .infoText {
260 display: flex; 374 display: flex;
261 flex-direction: column; 375 flex-direction: column;
262 justify-content: space-between; 376 justify-content: space-between;
263 align-items: flex-start; 377 align-items: flex-start;
264 height: 188rpx; 378 height: 188rpx;
265 width: 368rpx; 379 width: 368rpx;
266 } 380 }
267 .orderName { 381 .orderName {
268 font-size: 14px; 382 font-size: 14px;
269 color: #333333; 383 color: #333333;
270 display: -webkit-box; 384 display: -webkit-box;
271 overflow: hidden; 385 overflow: hidden;
272 -webkit-box-orient: vertical; 386 -webkit-box-orient: vertical;
273 -webkit-line-clamp: 2; 387 -webkit-line-clamp: 2;
274 } 388 }
275 .orderDescrib { 389 .orderDescrib {
276 font-size: 12px; 390 font-size: 12px;
277 color: #999999; 391 color: #999999;
278 display: -webkit-box; 392 display: -webkit-box;
279 overflow: hidden; 393 overflow: hidden;
280 -webkit-box-orient: vertical; 394 -webkit-box-orient: vertical;
281 -webkit-line-clamp: 2; 395 -webkit-line-clamp: 2;
282 } 396 }
283 .infoText-bottom { 397 .infoText-bottom {
284 display: flex; 398 display: flex;
285 flex-direction: row; 399 flex-direction: row;
286 justify-content: flex-start; 400 justify-content: flex-start;
287 align-items: center; 401 align-items: center;
288 width: 100%; 402 width: 100%;
289 .markPrice { 403 .markPrice {
290 font-size: 14px; 404 font-size: 14px;
291 color: #ff6b4a; 405 color: #ff6b4a;
292 margin-right: 20rpx; 406 margin-right: 20rpx;
293 } 407 }
294 .buy-num { 408 .buy-num {
295 font-size: 12px; 409 font-size: 12px;
296 color: #999999; 410 color: #999999;
297 } 411 }
298 } 412 }
299 } 413 }
300 .payPrice { 414 .payPrice {
301 text-align: right; 415 text-align: right;
302 margin: 20rpx 0; 416 margin: 20rpx 0;
303 font-size: 14px; 417 font-size: 14px;
304 color: #333333; 418 color: #333333;
305 .priceNum { 419 .priceNum {
306 font-size: 14px; 420 font-size: 14px;
307 color: #ff6b4a; 421 color: #ff6b4a;
308 } 422 }
309 } 423 }
310 .btns { 424 .btns {
311 display: flex; 425 display: flex;
312 justify-content: flex-end; 426 justify-content: flex-end;
313 align-items: center; 427 align-items: center;
314 .btn-type1 { 428 .btn-type1 {
315 height: 48rpx; 429 height: 48rpx;
316 width: 156rpx; 430 width: 156rpx;
317 border: 1px solid #ff6b4a; 431 border: 1px solid #ff6b4a;
318 border-radius: 12px; 432 border-radius: 12px;
319 border-radius: 12px; 433 border-radius: 12px;
320 text-align: center; 434 text-align: center;
321 line-height: 48rpx; 435 line-height: 48rpx;
322 font-size: 12px; 436 font-size: 12px;
323 color: #ff6b4a; 437 color: #ff6b4a;
324 } 438 }
325 .btn-type2 { 439 .btn-type2 {
326 height: 48rpx; 440 height: 48rpx;
327 width: 140rpx; 441 width: 140rpx;
328 background: #ff6b4a; 442 background: #ff6b4a;
329 border-radius: 12px; 443 border-radius: 12px;
330 border-radius: 12px; 444 border-radius: 12px;
331 text-align: center; 445 text-align: center;
332 line-height: 48rpx; 446 line-height: 48rpx;
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
11 v-for="item in screenItems" 11 v-for="item in screenItems"
12 :key="item.current" 12 :key="item.current"
13 @click="onClickItem(item.current)" 13 @click="onClickItem(item.current)"
14 > 14 >
15 <view 15 <view
16 class="screenItem" 16 class="screenItem"
17 v-bind:class="{ active: current === item.current }" 17 v-bind:class="{ active: current === item.current }"
18 >{{ item.text }}</view> 18 >{{ item.text }}</view>
19 </view> 19 </view>
20 </view> 20 </view>
21 </view> 21 </view>
22 <view class="orderList"> 22 <view class="orderList">
23 <view 23 <view
24 v-for="(order) in orderList" 24 v-for="(order) in orderList"
25 :key="order.pay_id" 25 :key="order.pay_id"
26 > 26 >
27 <OrderCard 27 <OrderCard
28 :order="order" 28 :order="order"
29 :current="current" 29 :current="current"
30 v-if="order.order_info !== null"
30 ></OrderCard> 31 ></OrderCard>
31 </view> 32 </view>
32 </view> 33 </view>
33 <view class="footer">没有更多订单了,去商城看看吧~</view> 34 <view class="footer">没有更多订单了,去商城看看吧~</view>
34 </view> 35 </view>
35 </template> 36 </template>
36 <script> 37 <script>
37 import OrderCard from "./components/OrderCard.vue"; 38 import OrderCard from "./components/OrderCard.vue";
38 import store from "@/store"; 39 import store from "@/store";
39 40
40 export default { 41 export default {
41 components: { 42 components: {
42 OrderCard: OrderCard 43 OrderCard: OrderCard
43 }, 44 },
44 data() { 45 data() {
45 return { 46 return {
46 // 顶部筛选项 47 // 顶部筛选项
47 screenItems: [ 48 screenItems: [
48 { current: "10", text: "全部" }, 49 { current: "10", text: "全部" },
49 { current: "0", text: "待付款" }, 50 { current: "0", text: "待付款" },
50 { current: "1", text: "待收货" }, 51 { current: "1", text: "待收货" },
51 { current: "2", text: "已完成" } 52 { current: "2", text: "已完成" }
52 // {current:"3",text:'已评价'}, 53 // {current:"3",text:'已评价'},
53 // {current:"4",text:'退款'}, 54 // {current:"4",text:'退款'},
54 ], 55 ],
55 // 当前所在item 默认10-->全部 56 // 当前所在item 默认10-->全部
56 current: "10" 57 current: "10"
57 }; 58 };
58 }, 59 },
59 60
60 onShow() { 61 onShow() {
61 store.dispatch("myOrder/getList", { 62 store.dispatch("myOrder/getList", {
62 way: "" 63 way: ""
63 }); 64 });
64 }, 65 },
65 onLoad: function(option) { 66 onLoad: function(option) {
66 // 获取订单列表 67 // 获取订单列表
67 // store.dispatch("myOrder/getList", { 68 // store.dispatch("myOrder/getList", {
68 // way: "" 69 // way: ""
69 // }); 70 // });
70 // 从user过来传的status,给current,以显示对应item 71 // 从user过来传的status,给current,以显示对应item
71 this.current = option.status; 72 this.current = option.status;
72 }, 73 },
73 computed: { 74 computed: {
74 orderList() { 75 orderList() {
75 console.log('orderList', this.$store.state.myOrder.orderList); 76 console.log('orderList', this.$store.state.myOrder.orderList);
76 return this.$store.state.myOrder.orderList; 77 return this.$store.state.myOrder.orderList;
77 } 78 }
78 }, 79 },
79 methods: { 80 methods: {
80 // tab点击事件 81 // tab点击事件
81 onClickItem(e) { 82 onClickItem(e) {
82 if (this.current !== e) { 83 if (this.current !== e) {
83 this.current = e; 84 this.current = e;
84 } 85 }
85 } 86 }
86 } 87 }
87 }; 88 };
88 </script> 89 </script>
89 90
90 <style lang="scss"> 91 <style lang="scss">
91 .content { 92 .content {
92 display: flex; 93 display: flex;
93 flex-direction: column; 94 flex-direction: column;
94 align-items: center; 95 align-items: center;
95 background-color: #f7f6f6; 96 background-color: #f7f6f6;
96 min-height: 100vh; 97 min-height: 100vh;
97 .header { 98 .header {
98 background-color: #ffffff; 99 background-color: #ffffff;
99 width: 100%; 100 width: 100%;
100 // height: 232rpx; 101 // height: 232rpx;
101 padding: 20rpx 40rpx 16rpx 40rpx; 102 padding: 20rpx 40rpx 16rpx 40rpx;
102 box-sizing: border-box; 103 box-sizing: border-box;
103 position: fixed; 104 position: fixed;
104 top: 0; 105 top: 0;
105 left: 0; 106 left: 0;
106 // .searchBar { 107 // .searchBar {
107 // width: 670rpx; 108 // width: 670rpx;
108 // display: flex; 109 // display: flex;
109 // justify-content: center; 110 // justify-content: center;
110 // align-items: center; 111 // align-items: center;
111 // box-sizing: border-box; 112 // box-sizing: border-box;
112 // padding: 0rpx 16rpx; 113 // padding: 0rpx 16rpx;
113 // border: 1px solid #ff6b4a; 114 // border: 1px solid #ff6b4a;
114 // border-radius: 8rpx; 115 // border-radius: 8rpx;
115 // background-color: #ffffff; 116 // background-color: #ffffff;
116 // } 117 // }
117 118
118 .screenBar { 119 .screenBar {
119 width: 670rpx; 120 width: 670rpx;
120 // height: 110rpx; 121 // height: 110rpx;
121 height: 70rpx; 122 height: 70rpx;
122 display: flex; 123 display: flex;
123 flex-direction: row; 124 flex-direction: row;
124 justify-content: space-between; 125 justify-content: space-between;
125 align-items: center; 126 align-items: center;
126 color: #333333; 127 color: #333333;
127 font-size: 32rpx; 128 font-size: 32rpx;
128 } 129 }
129 .screenItem { 130 .screenItem {
130 height: 50rpx; 131 height: 50rpx;
131 font-size: 32rpx; 132 font-size: 32rpx;
132 color: #333333; 133 color: #333333;
133 display: flex; 134 display: flex;
134 justify-content: center; 135 justify-content: center;
135 align-items: center; 136 align-items: center;
136 transition: all 0.2s; 137 transition: all 0.2s;
137 } 138 }
138 .active { 139 .active {
139 // font-size: 34rpx; 140 // font-size: 34rpx;
140 color: #ec5d3b; 141 color: #ec5d3b;
141 } 142 }
142 .searchIpt { 143 .searchIpt {
143 height: 68rpx; 144 height: 68rpx;
144 width: 670rpx; 145 width: 670rpx;
145 padding: 16rpx; 146 padding: 16rpx;
146 font-size: 28rpx; 147 font-size: 28rpx;
147 box-sizing: border-box; 148 box-sizing: border-box;
148 } 149 }
149 } 150 }
150 .orderList { 151 .orderList {
151 // margin-top: 232rpx; 152 // margin-top: 232rpx;
152 margin-top: 132rpx; 153 margin-top: 132rpx;
153 } 154 }
154 .footer { 155 .footer {
155 font-size: 14px; 156 font-size: 14px;
156 color: #b8b8b8; 157 color: #b8b8b8;
157 margin: 40rpx 0; 158 margin: 40rpx 0;
158 } 159 }
159 } 160 }
160 </style> 161 </style>
161 162
src/pages/myOrderPaying/myOrderPaying.vue
1 <!-- 订单待付款 待收货 --> 1 <!-- 订单待付款 待收货 -->
2 <template> 2 <template>
3 <view class="content"> 3 <view class="content">
4 <view 4 <view
5 class="headerBanner" 5 class="headerBanner"
6 v-if="status == '2'||'3'" 6 v-if="status == '2'||'3'"
7 > 7 >
8 <view class="bannerLeft"> 8 <view class="bannerLeft">
9 <view class="T1">订单已完成</view> 9 <view class="T1">订单已完成</view>
10 </view> 10 </view>
11 <image 11 <image
12 src="../../static/car.png" 12 src="../../static/car.png"
13 mode="aspectFill" 13 mode="aspectFill"
14 ></image> 14 ></image>
15 </view> 15 </view>
16 <!-- 待付款 --> 16 <!-- 待付款 -->
17 <view class="order-time" v-if="status == '0'" > 17 <view class="order-time" v-if="status == '0'" >
18 <text>请在</text> 18 <text>请在</text>
19 <uni-countdown 19 <uni-countdown
20 color="#EC5D3B" 20 color="#EC5D3B"
21 splitor-color="#EC5D3B" 21 splitor-color="#EC5D3B"
22 :show-day="false" 22 :show-day="false"
23 :hour="0" 23 :hour="0"
24 :second="getTime" 24 :second="getLeftTime"
25 @timeup=timeup > 25 @timeup="timeup" >
26 </uni-countdown> 26 </uni-countdown>
27 27
28 <text>内完成付款</text> 28 <text>内完成付款</text>
29 </view> 29 </view>
30 30
31 <view class="headerBanner" v-if="status == '1'"> 31 <view class="headerBanner" v-if="status == '1'">
32 <view class="bannerLeft"> 32 <view class="bannerLeft">
33 <view class="T1">卖家已发货</view> 33 <view class="T1">卖家已发货</view>
34 <!-- <view class="T2">还剩 确认收货</view> --> 34 <!-- <view class="T2">还剩 确认收货</view> -->
35 </view> 35 </view>
36 <image 36 <image
37 src="../../static/car.png" 37 src="../../static/car.png"
38 mode="aspectFill" 38 mode="aspectFill"
39 ></image> 39 ></image>
40 </view> 40 </view>
41 41
42 42
43 <view class="order"> 43 <view class="order">
44 <view class="order-user"> 44 <view class="order-user">
45 <view class="order-user-head"> 45 <view class="order-user-head">
46 <text class="p1">{{orderAddressInfo.userName}}</text> 46 <text class="p1">{{orderAddressInfo.userName}}</text>
47 <text class="p2">{{orderAddressInfo.telNumber}}</text> 47 <text class="p2">{{orderAddressInfo.telNumber}}</text>
48 </view> 48 </view>
49 <view class="order-user-body"> 49 <view class="order-user-body">
50 <image src="../../static/myorder-paying-location.png"></image> 50 <image src="../../static/myorder-paying-location.png"></image>
51 <text class="p3">{{orderAddressInfo.provinceName}} {{orderAddressInfo.cityName}} {{orderAddressInfo.countyName}}\n{{orderAddressInfo.detailInfo}}</text> 51 <text class="p3">{{orderAddressInfo.provinceName}} {{orderAddressInfo.cityName}} {{orderAddressInfo.countyName}}\n{{orderAddressInfo.detailInfo}}</text>
52 </view> 52 </view>
53 </view> 53 </view>
54 <view class="order-info"> 54 <view class="order-info">
55 <view 55 <view
56 class="order-info-head" 56 class="order-info-head"
57 v-for="(orderInfoListItem,index) in orderInfoList" 57 v-for="(orderInfoListItem,index) in orderInfoList"
58 :key="index" 58 :key="index"
59 > 59 >
60 <image 60 <image
61 :src="orderInfoListItem.imgUrl" 61 :src="orderInfoListItem.imgUrl"
62 mode="aspectFill" 62 mode="aspectFill"
63 ></image> 63 ></image>
64 <view class="order-info-head-r"> 64 <view class="order-info-head-r">
65 <text class="p1">{{orderInfoListItem.p_name}}</text> 65 <text class="p1">{{orderInfoListItem.p_name}}</text>
66 <view 66 <view
67 class="p2" 67 class="p2"
68 style="margin: 0;" 68 style="margin: 0;"
69 > 69 >
70 规格:玫瑰金 / 钛合金 / 防日光防紫外线 / 超薄超轻 70 规格:玫瑰金 / 钛合金 / 防日光防紫外线 / 超薄超轻
71 <!-- <view class="arrow"></view> --> 71 <!-- <view class="arrow"></view> -->
72 </view> 72 </view>
73 <view class="infoText-bottom"> 73 <view class="infoText-bottom">
74 <view class="markPrice">{{orderInfoListItem.nowPrice}}</view> 74 <view class="markPrice">{{orderInfoListItem.nowPrice}}</view>
75 <view class="buy-num">X {{orderInfoListItem.num}}</view> 75 <view class="buy-num">X {{orderInfoListItem.num}}</view>
76 </view> 76 </view>
77 </view> 77 </view>
78 </view> 78 </view>
79 <!-- <view class="order-info-goodsnum"> 79 <!-- <view class="order-info-goodsnum">
80 <text>X1</text> 80 <text>X1</text>
81 </view> --> 81 </view> -->
82 <text class="order-info-freight"> 82 <text class="order-info-freight">
83 <text class="p1">运费</text> 83 <text class="p1">运费</text>
84 <text class="p2">免运费</text> 84 <text class="p2">免运费</text>
85 </text> 85 </text>
86 <text class="order-info-discount"> 86 <text class="order-info-discount">
87 <text class="p1">优惠</text> 87 <text class="p1">优惠</text>
88 <text class="p2">-¥{{totalDiscount}}</text> 88 <text class="p2">-¥{{totalDiscount}}</text>
89 </text> 89 </text>
90 <text class="order-info-price"> 90 <text class="order-info-price">
91 <text class="p1">实付</text> 91 <text class="p1">实付</text>
92 <text class="p2">¥{{orderInfo.order_info.total_fee}}</text> 92 <text class="p2">¥{{orderInfo.order_info.total_fee}}</text>
93 93
94 </text> 94 </text>
95 <text class="order-info-num"> 95 <text class="order-info-num">
96 <text>订单号:{{payId}}</text> 96 <text>订单号:{{payId}}</text>
97 </text> 97 </text>
98 <text class="order-info-time"> 98 <text class="order-info-time">
99 <text>下单时间:{{orderInfo.order_info.pay_time | timerChange}}</text> 99 <text>下单时间:{{orderInfo.order_info?orderInfo.order_info.pay_time:'' | timerChange}}</text>
100
101 </text> 100 </text>
102 <view class="order-info-hr"></view> 101 <view class="order-info-hr"></view>
103 <view class="order-info-contact"> 102 <view class="order-info-contact">
104 <image src="../../static/myorder-paying-contact.png"></image> 103 <image src="../../static/myorder-paying-contact.png"></image>
105 <text>联系客服</text> 104 <text>联系客服</text>
106 </view> 105 </view>
107 </view> 106 </view>
108 </view> 107 </view>
109 <view 108 <view
110 class="order-confim" 109 class="order-confim"
111 v-if="status == '0'" 110 v-if="status == '0'"
112 > 111 >
113 <button 112 <button
114 class="b1" 113 class="b1"
115 @click="cancleOrder" 114 @click="cancleOrder"
116 >取消订单</button> 115 >取消订单</button>
117 <button 116 <button
118 class="b2" 117 class="b2"
119 @click="paylog" 118 @click="paylog"
120 >立即支付</button> 119 >立即支付</button>
121 </view> 120 </view>
122 121
123 <view 122 <view
124 class="order-confim" 123 class="order-confim"
125 v-if="status == '1'" 124 v-if="status == '1'"
126 > 125 >
127 <!-- <button class="b1">取消订单</button> --> 126 <!-- <button class="b1">取消订单</button> -->
128 <button 127 <button
129 class="b2" 128 class="b2"
130 @click="confirmOrder" 129 @click="confirmOrder"
131 >确认收货</button> 130 >确认收货</button>
132 </view> 131 </view>
133 <view 132 <view
134 class="order-confim" 133 class="order-confim"
135 v-if="status == '2'" 134 v-if="status == '2'"
136 > 135 >
137 <button 136 <button
138 class="b2" 137 class="b2"
139 @click="toDetail" 138 @click="toDetail"
140 >再次购买</button> 139 >再次购买</button>
141 </view> 140 </view>
142 141
143 </view> 142 </view>
144 </template> 143 </template>
145 144
146 <script> 145 <script>
147 import store from "@/store"; 146 import store from "@/store";
148 import MD5Util from '../../utils/md5' 147 import MD5Util from '../../utils/md5'
149 import UniCountdown from "../../components/UniCountdown/UniCountdown.vue"; 148 import UniCountdown from "../../components/UniCountdown/UniCountdown.vue";
150 export default { 149 export default {
151 components: { 150 components: {
152 UniCountdown 151 UniCountdown
153 }, 152 },
154 data() { 153 data() {
155 return { 154 return {
156 payId: "", 155 payId: "",
157 payTime: "", 156 payTime: "",
158 status: "", // status 0 待付款 1 已发货 157 status: "", // status 0 待付款 1 已发货
159 uid: "", 158 uid: "",
160 openid: "", 159 openid: "",
161 lefttime: 0, 160 lefttime: 0,
162 isPay: 0, 161 isPay: 0,
163 orderInfo:Object, 162 orderInfo:{},
164 totalPrice:0, 163 totalPrice:0,
165 }; 164 };
166 }, 165 },
167 onLoad:async function ({payId,status,isPay}) { 166 onLoad:async function ({payId,status,isPay}) {
168 this.payId = payId 167 this.payId = payId
169 this.status = status 168 this.status = status
170 this.isPay = isPay 169 this.isPay = isPay
171 console.log('++++++++++++++++++',this.status) 170 // console.log('++++++++++++++++++',this.status)
172 const openid = uni.getStorageSync('openid') 171 const openid = uni.getStorageSync('openid')
173 const uid = this.$store.state.user.userInfo.uid 172 const uid = this.$store.state.user.userInfo.uid
174 this.uid = uid 173 this.uid = uid
175 this.openid = openid 174 this.openid = openid
176 await store.dispatch('orderRead/getOrderInfo', { 175 await store.dispatch('orderRead/getOrderInfo', {
177 pay_id: this.payId, 176 pay_id: this.payId,
178 uid: uid, 177 uid: uid,
179 openid: openid 178 openid: openid
180 }); 179 });
181 // console.log(this.$store.state.orderRead.orderInfo) 180 // console.log(this.$store.state.orderRead.orderInfo)
182 this.orderInfo = this.$store.state.orderRead.orderInfo 181 this.orderInfo = this.$store.state.orderRead.orderInfo
183 this.totalPrice = this.orderInfo.total_fee 182 this.totalPrice = this.orderInfo.total_fee
184 }, 183 },
185 // 若从支付页面跳转过来,返回直接返回到首页 184 // 若从支付页面跳转过来,返回直接返回到首页
186 onBackPress(option) { 185 onBackPress(option) {
187 if (option.from === "backbutton" && this.isPay) { 186 if (option.from === "backbutton" && this.isPay) {
188 uni.switchTab({ 187 uni.switchTab({
189 url: "/pages/index/index" 188 url: "/pages/index/index"
190 }); 189 });
191 return true; // 阻止默认返回行为 190 return true; // 阻止默认返回行为
192 } 191 }
193 }, 192 },
194 computed: { 193 computed: {
195 orderInfoList () { 194 orderInfoList () {
196 return this.orderInfo.order_info.list 195 return this.orderInfo.order_info?this.orderInfo.order_info.list:null
197 }, 196 },
198 // 获取订单地址信息 197 // 获取订单地址信息
199 orderAddressInfo () { 198 orderAddressInfo () {
200 return this.orderInfo.order_info.address 199 return this.orderInfo.order_info?this.orderInfo.order_info.address:null
201 }, 200 },
202 // 订单付款时间 201 // 订单付款时间
203 getTime () { 202 getLeftTime () {
204 return this.orderInfo.order_info.lefttime 203 return this.orderInfo.order_info?this.orderInfo.order_info.lefttime:1800
205
206 }, 204 },
207 // 计算总优惠额 205 // 计算总优惠额
208 totalDiscount() { 206 totalDiscount() {
209 const discountInfoList = this.orderInfo.discount_info; 207 const discountInfoList = this.orderInfo.discount_info;
210 let totalDiscount = 0; 208 let totalDiscount = 0;
211 if (discountInfoList) { 209 if (discountInfoList) {
212 discountInfoList.map((discountItem, index) => { 210 discountInfoList.map((discountItem, index) => {
213 totalDiscount += Number(discountItem.value); 211 totalDiscount += Number(discountItem.value);
214 }); 212 });
215 } 213 }
216 // console.log(totalDiscount) 214 // console.log(totalDiscount)
217 return totalDiscount; 215 return totalDiscount;
218 } 216 }
219 }, 217 },
220 218
221 methods: { 219 methods: {
222 //再次购买 暂时只支持跳转第一个商品 220 //再次购买 暂时只支持跳转第一个商品
223 toDetail(){ 221 toDetail(){
224 const pid = this.orderInfo.order_info.list[0].pid 222 const pid = this.orderInfo.order_info.list[0].pid
225 uni.navigateTo({ 223 uni.navigateTo({
226 url: '../details/details?pid='+pid, 224 url: '../details/details?pid='+pid,
227 fail: (res) => {console.log(res)}, 225 fail: (res) => {console.log(res)},
228 }); 226 });
229 }, 227 },
230 // 取消订单 228 // 取消订单
231 timeup() { 229 timeup() {
232 this.cancleOrder(); 230 this.cancleOrder();
233 }, 231 },
234 cancleOrder() { 232 cancleOrder() {
235 const uid = this.uid; 233 const uid = this.uid;
236 const openid = this.openid; 234 const openid = this.openid;
237 const keyname = this.orderInfo.order_info.keyname 235 const keyname = this.orderInfo.order_info.keyname
238 // console.log('keyname',this.orderInfo.keyname) 236 // console.log('keyname',this.orderInfo.keyname)
239 uni.showModal({ 237 uni.showModal({
240 title: "提示", 238 title: "提示",
241 content: "现在取消,订单不可恢复哦,确认取消吗?", 239 content: "现在取消,订单不可恢复哦,确认取消吗?",
242 success: function(res) { 240 success: function(res) {
243 if (res.confirm) { 241 if (res.confirm) {
244 store.dispatch("cancelOrder/cancel", { 242 store.dispatch("cancelOrder/cancel", {
245 keyname: keyname, 243 keyname: keyname,
246 uid: uid, 244 uid: uid,
247 openid: openid 245 openid: openid
248 }); 246 });
249 uni.navigateBack({ 247 uni.navigateBack({
250 delta:1 248 delta:1
251 }) 249 })
252 } else if (res.cancel) { 250 } else if (res.cancel) {
253 console.log("用户点击取消"); 251 console.log("用户点击取消");
254 } 252 }
255 } 253 }
256 }); 254 });
257 }, 255 },
258 paylog() { 256 paylog() {
259 console.log('pay',this.orderInfo) 257 console.log('pay',this.orderInfo)
260 const { data, exKeyName: keyName } = this.orderInfo 258 const { data, exKeyName: keyName } = this.orderInfo
261 const uid = uni.getStorageSync('uid') 259 const uid = uni.getStorageSync('uid')
262 const timeStamp = new Date().getTime().toString() 260 const timeStamp = new Date().getTime().toString()
263 const nonceStr = 'asfafasfasfasfasf' 261 const nonceStr = 'asfafasfasfasfasf'
264 // 支付参数 262 // 支付参数
265 const fieldSet = { 263 const fieldSet = {
266 openid: this.$store.state.user.userInfo.openid, 264 openid: this.$store.state.user.userInfo.openid,
267 uid: this.$store.state.user.userInfo.uid, 265 uid: this.$store.state.user.userInfo.uid,
268 shopid: 0, 266 shopid: 0,
269 payCate: 2020, 267 payCate: 2020,
270 payMoney: this.totalPrice, 268 payMoney: this.totalPrice,
271 payWoodId: `fcdj-${uid}-${keyName}`, 269 payWoodId: `fcdj-${uid}-${keyName}`,
272 payWoodDesc: '在【非常戴镜】的微信付款凭证', 270 payWoodDesc: '在【非常戴镜】的微信付款凭证',
273 nonceStr, 271 nonceStr,
274 signType: 'MD5', 272 signType: 'MD5',
275 app_uid: 2020, 273 app_uid: 2020,
276 timeStamp, 274 timeStamp,
277 keyname: keyName, 275 keyname: keyName,
278 billInfo: JSON.stringify(data), 276 billInfo: JSON.stringify(data),
279 } 277 }
280 // 请求后台支付接口 278 // 请求后台支付接口
281 store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { 279 store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => {
282 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { 280 if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') {
283 const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` 281 const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}`
284 const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' 282 const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789'
285 283
286 // 微信支付接口 284 // 微信支付接口
287 uni.requestPayment({ 285 uni.requestPayment({
288 appId: data.appid, 286 appId: data.appid,
289 timeStamp, 287 timeStamp,
290 nonceStr, 288 nonceStr,
291 total_fee: this.totalPrice, 289 total_fee: this.totalPrice,
292 package: `prepay_id=${data.prepay_id}`, 290 package: `prepay_id=${data.prepay_id}`,
293 signType: 'MD5', 291 signType: 'MD5',
294 paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), 292 paySign: MD5Util.MD5(stringSignTemp).toUpperCase(),
295 success: (res) => { 293 success: (res) => {
296 // 支付成功 294 // 支付成功
297 uni.showModal({ 295 uni.showModal({
298 content: '支付成功', 296 content: '支付成功',
299 showCancel: false, 297 showCancel: false,
300 }) 298 })
301 // 跳转订单详情页->状态 待收货 299 // 跳转订单详情页->状态 待收货
302 uni.reLaunch({ 300 uni.reLaunch({
303 url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`, 301 url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=1&isPay=1`,
304 }) 302 })
305 }, 303 },
306 fail: (res) => { 304 fail: (res) => {
307 // 支付失败 305 // 支付失败
308 uni.showModal({ 306 uni.showModal({
309 content: '支付失败', 307 content: '支付失败',
310 showCancel: false, 308 showCancel: false,
311 }) 309 })
312 // 跳转订单详情页->刷新本页面 310 // 跳转订单详情页->刷新本页面
313 // uni.redirectTo({ 311 // uni.redirectTo({
314 // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`, 312 // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`,
315 // }) 313 // })
316 }, 314 },
317 complete: () => { 315 complete: () => {
318 uni.hideLoading() 316 uni.hideLoading()
319 }, 317 },
320 }) 318 })
321 } else { 319 } else {
322 uni.showModal({ 320 uni.showModal({
323 content: '支付失败', 321 content: '支付失败',
324 showCancel: false, 322 showCancel: false,
325 }) 323 })
326 console.log('支付失败') 324 console.log('支付失败')
327 uni.hideLoading() 325 uni.hideLoading()
328 // uni.redirectTo({ 326 // uni.redirectTo({
329 // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`, 327 // url: `../myOrderPaying/myOrderPaying?payId=${payId}&status=0&isPay=1`,
330 // }) 328 // })
331 } 329 }
332 }) 330 })
333 331
334 //修改订单状态 待付款==>待收货 332 //修改订单状态 待付款==>待收货
335 store.dispatch("statusConfirm/confirm", { 333 store.dispatch("statusConfirm/confirm", {
336 uid: this.uid, 334 uid: this.uid,
337 openid: this.openid, 335 openid: this.openid,
338 oldway: "0", 336 oldway: "0",
339 way: "1", 337 way: "1",
340 pay_id: this.payId, 338 pay_id: this.payId,
341 judgeContent: "", 339 judgeContent: "",
342 orderInfo: this.orderInfo.order_info 340 orderInfo: this.orderInfo.order_info
343 }) 341 })
344 .then( 342 .then(
345 // setTimeout(() => { 343 // setTimeout(() => {
346 // uni.navigateBack(); 344 // uni.navigateBack();
347 // }, 1500) 345 // }, 1500)
348 ); 346 );
349 }, 347 },
350 confirmOrder() { 348 confirmOrder() {
351 //确认收货 way1 ==>way2 349 //确认收货 way1 ==>way2
352 store 350 store
353 .dispatch("statusConfirm/confirm", { 351 .dispatch("statusConfirm/confirm", {
354 uid: this.uid, 352 uid: this.uid,
355 openid: this.openid, 353 openid: this.openid,
356 oldway: "1", 354 oldway: "1",
357 way: "2", 355 way: "2",
358 pay_id: this.payId, 356 pay_id: this.payId,
359 judgeContent: "", 357 judgeContent: "",
360 orderInfo: this.orderInfo.order_info 358 orderInfo: this.orderInfo.order_info
361 }) 359 })
362 .then((res)=>{ 360 .then((res)=>{
363 if(res.data.code === 1){ 361 if(res.data.code === 1){
364 uni.showToast({ 362 uni.showToast({
365 title:'已确认', 363 title:'已确认',
366 mask:true, 364 mask:true,
367 duration:1500, 365 duration:1500,
368 icon:'success' 366 icon:'success'
369 }) 367 })
370 }else{ 368 }else{
371 uni-uni.showToast({ 369 uni-uni.showToast({
372 title: '服务器错误,确认失败!', 370 title: '服务器错误,确认失败!',
373 mask:true 371 mask:true
374 }); 372 });
375 } 373 }
376 setTimeout(() => { 374 setTimeout(() => {
377 uni.navigateBack(); 375 uni.navigateBack();
378 }, 1500) 376 }, 1500)
379 }); 377 });
380 } 378 }
381 }, 379 },
382 filters: { 380 filters: {
383 timerChange: function(value) { 381 timerChange: function(value) {
384 var newDate = new Date(); 382 var newDate = new Date();
385 newDate.setTime(value * 1000); 383 newDate.setTime(value * 1000);
386 return newDate.toLocaleString(); 384 return newDate.toLocaleString();
387 } 385 }
388 } 386 }
389 }; 387 };
390 </script> 388 </script>
391 389
392 <style lang="scss" scoped> 390 <style lang="scss" scoped>
393 .content { 391 .content {
394 min-height: 100vh; 392 min-height: 100vh;
395 display: flex; 393 display: flex;
396 flex-direction: column; 394 flex-direction: column;
397 justify-content: flex-start; 395 justify-content: flex-start;
398 align-items: center; 396 align-items: center;
399 background-color: #f2f2f2; 397 background-color: #f2f2f2;
400 } 398 }
401 399
402 .order { 400 .order {
403 margin-bottom: 112rpx; 401 margin-bottom: 112rpx;
404 background: #f2f2f2; 402 background: #f2f2f2;
405 margin-top: 140rpx; 403 margin-top: 140rpx;
406 width: 670rpx; 404 width: 670rpx;
407 } 405 }
408 406
409 .order-time { 407 .order-time {
410 width: 100%; 408 width: 100%;
411 height: 140rpx; 409 height: 140rpx;
412 background-color: #fff; 410 background-color: #fff;
413 display: flex; 411 display: flex;
414 justify-content: center; 412 justify-content: center;
415 align-items: center; 413 align-items: center;
416 position: fixed; 414 position: fixed;
417 top: 0; 415 top: 0;
418 left: 0; 416 left: 0;
419 text { 417 text {
420 // font-family: PingFangSC-Regular; 418 // font-family: PingFangSC-Regular;
421 // margin-top: 48rpx; 419 // margin-top: 48rpx;
422 font-size: 14px; 420 font-size: 14px;
423 color: #333333; 421 color: #333333;
424 letter-spacing: -0.26px; 422 letter-spacing: -0.26px;
425 } 423 }
426 .p2 { 424 .p2 {
427 // font-family: DINAlternate-Bold; 425 // font-family: DINAlternate-Bold;
428 margin: 42rpx 20rpx 0 20rpx; 426 margin: 42rpx 20rpx 0 20rpx;
429 font-size: 18px; 427 font-size: 18px;
430 color: #ec5d3b; 428 color: #ec5d3b;
431 letter-spacing: -0.34px; 429 letter-spacing: -0.34px;
432 } 430 }
433 } 431 }
434 .headerBanner { 432 .headerBanner {
435 width: 100%; 433 width: 100%;
436 height: 140rpx; 434 height: 140rpx;
437 background: #4a90e2; 435 background: #4a90e2;
438 padding: 26rpx 60rpx 24rpx 60rpx; 436 padding: 26rpx 60rpx 24rpx 60rpx;
439 box-sizing: border-box; 437 box-sizing: border-box;
440 color: #ffffff; 438 color: #ffffff;
441 display: flex; 439 display: flex;
442 justify-content: space-between; 440 justify-content: space-between;
443 align-items: center; 441 align-items: center;
444 position: fixed; 442 position: fixed;
445 top: 0; 443 top: 0;
446 left: 0; 444 left: 0;
447 .bannerLeft { 445 .bannerLeft {
448 font-size: 36rpx; 446 font-size: 36rpx;
449 display: flex; 447 display: flex;
450 flex-direction: column; 448 flex-direction: column;
451 justify-content: center; 449 justify-content: center;
452 align-items: center; 450 align-items: center;
453 .T2 { 451 .T2 {
454 font-size: 24rpx; 452 font-size: 24rpx;
455 } 453 }
456 } 454 }
457 image { 455 image {
458 height: 56rpx; 456 height: 56rpx;
459 width: 72rpx; 457 width: 72rpx;
460 } 458 }
461 } 459 }
462 460
463 .order-user { 461 .order-user {
464 height: 228rpx; 462 height: 228rpx;
465 background: #ffffff; 463 background: #ffffff;
466 border-radius: 14rpx; 464 border-radius: 14rpx;
467 margin: 0 auto; 465 margin: 0 auto;
468 margin-top: 20rpx; 466 margin-top: 20rpx;
469 margin-bottom: 20rpx; 467 margin-bottom: 20rpx;
470 .order-user-head { 468 .order-user-head {
471 display: flex; 469 display: flex;
472 height: 108rpx; 470 height: 108rpx;
473 align-items: center; 471 align-items: center;
474 margin-left: 126rpx; 472 margin-left: 126rpx;
475 .p1 { 473 .p1 {
476 // font-family: PingFangSC-Regular; 474 // font-family: PingFangSC-Regular;
477 font-size: 14px; 475 font-size: 14px;
478 color: #333333; 476 color: #333333;
479 letter-spacing: -0.26px; 477 letter-spacing: -0.26px;
480 margin-right: 20rpx; 478 margin-right: 20rpx;
481 } 479 }
482 .p2 { 480 .p2 {
483 // font-family: PingFangSC-Regular; 481 // font-family: PingFangSC-Regular;
484 font-size: 14px; 482 font-size: 14px;
485 color: #999999; 483 color: #999999;
486 letter-spacing: -0.26px; 484 letter-spacing: -0.26px;
487 } 485 }
488 } 486 }
489 .order-user-body { 487 .order-user-body {
490 display: flex; 488 display: flex;
491 width: 100%; 489 width: 100%;
492 image { 490 image {
493 width: 24px; 491 width: 24px;
494 height: 26px; 492 height: 26px;
495 margin: 12rpx 32rpx 0 40rpx; 493 margin: 12rpx 32rpx 0 40rpx;
496 } 494 }
497 .p3 { 495 .p3 {
498 // font-family: PingFangSC-Semibold; 496 // font-family: PingFangSC-Semibold;
499 font-size: 14px; 497 font-size: 14px;
500 color: #333333; 498 color: #333333;
501 letter-spacing: -0.26px; 499 letter-spacing: -0.26px;
502 } 500 }
503 } 501 }
504 } 502 }
505 503
506 .order-info { 504 .order-info {
507 background-color: #fff; 505 background-color: #fff;
508 box-shadow: 0 0 20rpx 0 rgba(177, 128, 128, 0.06); 506 box-shadow: 0 0 20rpx 0 rgba(177, 128, 128, 0.06);
509 border-radius: 16rpx; 507 border-radius: 16rpx;
510 margin: 0 auto; 508 margin: 0 auto;
511 view { 509 view {
512 margin-left: 40rpx; 510 margin-left: 40rpx;
513 } 511 }
514 text { 512 text {
515 font-size: 14px; 513 font-size: 14px;
516 } 514 }
517 .order-info-head { 515 .order-info-head {
518 display: flex; 516 display: flex;
519 padding-top: 40rpx; 517 padding-top: 40rpx;
520 image { 518 image {
521 height: 188rpx; 519 height: 188rpx;
522 width: 188rpx; 520 width: 188rpx;
523 } 521 }
524 .order-info-head-r { 522 .order-info-head-r {
525 margin: 0; 523 margin: 0;
526 width: 368rpx; 524 width: 368rpx;
527 margin-left: 24rpx; 525 margin-left: 24rpx;
528 // margin-top: 40rpx; 526 // margin-top: 40rpx;
529 text { 527 text {
530 display: block; 528 display: block;
531 } 529 }
532 // .arrow{ 530 // .arrow{
533 // width: 0; 531 // width: 0;
534 // height: 0; 532 // height: 0;
535 // border-left: 5px transparent; 533 // border-left: 5px transparent;
536 // border-right: 5px transparent; 534 // border-right: 5px transparent;
537 // border-top: 5px #979797; 535 // border-top: 5px #979797;
538 // border-bottom: 0 transparent; 536 // border-bottom: 0 transparent;
539 // border-style: solid; 537 // border-style: solid;
540 // position: relative; 538 // position: relative;
541 // // transform: scaleY(-1); 539 // // transform: scaleY(-1);
542 // } 540 // }
543 // .arrow::after{ 541 // .arrow::after{
544 // content: ''; 542 // content: '';
545 // position: absolute; 543 // position: absolute;
546 // top: -6.5px; 544 // top: -6.5px;
547 // left: -5px; 545 // left: -5px;
548 // border-left: 5px transparent; 546 // border-left: 5px transparent;
549 // border-right: 5px transparent; 547 // border-right: 5px transparent;
550 // border-top: 5px #FFFFFF; 548 // border-top: 5px #FFFFFF;
551 // border-bottom: 0 transparent; 549 // border-bottom: 0 transparent;
552 // border-style: solid; 550 // border-style: solid;
553 // } 551 // }
554 .p1 { 552 .p1 {
555 min-height: 40px; 553 min-height: 40px;
556 // font-family: PingFangSC-Regular; 554 // font-family: PingFangSC-Regular;
557 font-size: 14px; 555 font-size: 14px;
558 color: #333333; 556 color: #333333;
559 letter-spacing: -0.26px; 557 letter-spacing: -0.26px;
560 line-height: 18px; 558 line-height: 18px;
561 // line-height: 20px; 559 // line-height: 20px;
562 } 560 }
563 .p2 { 561 .p2 {
564 height: 34px; 562 height: 34px;
565 padding: 1px 0 3px 0; 563 padding: 1px 0 3px 0;
566 // font-family: PingFangSC-Regular; 564 // font-family: PingFangSC-Regular;
567 font-size: 12px; 565 font-size: 12px;
568 color: #999999; 566 color: #999999;
569 letter-spacing: -0.23px; 567 letter-spacing: -0.23px;
570 } 568 }
571 .infoText-bottom { 569 .infoText-bottom {
572 display: flex; 570 display: flex;
573 flex-direction: row; 571 flex-direction: row;
574 justify-content: flex-start; 572 justify-content: flex-start;
575 align-items: center; 573 align-items: center;
576 width: 100%; 574 width: 100%;
577 margin-left: 0; 575 margin-left: 0;
578 .markPrice { 576 .markPrice {
579 font-size: 14px; 577 font-size: 14px;
580 color: #ff6b4a; 578 color: #ff6b4a;
581 margin-right: 20rpx; 579 margin-right: 20rpx;
582 margin-left: 0rpx; 580 margin-left: 0rpx;
583 } 581 }
584 .buy-num { 582 .buy-num {
585 font-size: 12px; 583 font-size: 12px;
586 color: #999999; 584 color: #999999;
587 } 585 }
588 } 586 }
589 } 587 }
590 } 588 }
591 // .order-info-goodsnum { 589 // .order-info-goodsnum {
592 // display: flex; 590 // display: flex;
593 // align-items: center; 591 // align-items: center;
594 // justify-content: flex-end; 592 // justify-content: flex-end;
595 // text { 593 // text {
596 // margin-right: 44rpx; 594 // margin-right: 44rpx;
597 // // ont-family: PingFangSC-Regular; 595 // // ont-family: PingFangSC-Regular;
598 // font-size: 12px; 596 // font-size: 12px;
599 // color: #999999; 597 // color: #999999;
600 // letter-spacing: -0.23px; 598 // letter-spacing: -0.23px;
601 // } 599 // }
602 // } 600 // }
603 .order-info-freight { 601 .order-info-freight {
604 display: block; 602 display: block;
605 margin-left: 40rpx; 603 margin-left: 40rpx;
606 margin-top: 22rpx; 604 margin-top: 22rpx;
607 .p1 { 605 .p1 {
608 // font-family: PingFangSC-Regular; 606 // font-family: PingFangSC-Regular;
609 font-size: 14px; 607 font-size: 14px;
610 color: #333333; 608 color: #333333;
611 letter-spacing: -0.26px; 609 letter-spacing: -0.26px;
612 line-height: 18px; 610 line-height: 18px;
613 margin-right: 24px; 611 margin-right: 24px;
614 } 612 }
615 .p2 { 613 .p2 {
616 // font-family: PingFangSC-Regular; 614 // font-family: PingFangSC-Regular;
617 font-size: 14px; 615 font-size: 14px;
618 color: #ff6b4a; 616 color: #ff6b4a;
619 letter-spacing: -0.26px; 617 letter-spacing: -0.26px;
620 } 618 }
621 } 619 }
622 .order-info-discount { 620 .order-info-discount {
623 display: block; 621 display: block;
624 margin-left: 40rpx; 622 margin-left: 40rpx;
625 margin-top: 24rpx; 623 margin-top: 24rpx;
626 .p1 { 624 .p1 {
627 // font-family: PingFangSC-Regular; 625 // font-family: PingFangSC-Regular;
628 font-size: 14px; 626 font-size: 14px;
629 color: #333333; 627 color: #333333;
630 letter-spacing: -0.26px; 628 letter-spacing: -0.26px;
631 line-height: 18px; 629 line-height: 18px;
632 margin-right: 24px; 630 margin-right: 24px;
633 } 631 }
634 .p2 { 632 .p2 {
635 // font-family: PingFangSC-Regular; 633 // font-family: PingFangSC-Regular;
636 font-size: 14px; 634 font-size: 14px;
637 color: #ff6b4a; 635 color: #ff6b4a;
638 letter-spacing: -0.26px; 636 letter-spacing: -0.26px;
639 } 637 }
640 } 638 }
641 .order-info-price { 639 .order-info-price {
642 display: block; 640 display: block;
643 margin-left: 40rpx; 641 margin-left: 40rpx;
644 margin-top: 24rpx; 642 margin-top: 24rpx;
645 .p1 { 643 .p1 {
646 // font-family: PingFangSC-Semibold; 644 // font-family: PingFangSC-Semibold;
647 font-size: 14px; 645 font-size: 14px;
648 color: #333333; 646 color: #333333;
649 letter-spacing: -0.26px; 647 letter-spacing: -0.26px;
650 line-height: 18px; 648 line-height: 18px;
651 margin-right: 24px; 649 margin-right: 24px;
652 } 650 }
653 .p2 { 651 .p2 {
654 // font-family: PingFangSC-Semibold; 652 // font-family: PingFangSC-Semibold;
655 font-size: 14px; 653 font-size: 14px;
656 color: #ff6b4a; 654 color: #ff6b4a;
657 letter-spacing: -0.26px; 655 letter-spacing: -0.26px;
658 } 656 }
659 } 657 }
660 .order-info-num { 658 .order-info-num {
661 display: block; 659 display: block;
662 margin-left: 40rpx; 660 margin-left: 40rpx;
663 margin-top: 44rpx; 661 margin-top: 44rpx;
664 text { 662 text {
665 // font-family: PingFangSC-Regular; 663 // font-family: PingFangSC-Regular;
666 font-size: 12px; 664 font-size: 12px;
667 color: #999999; 665 color: #999999;
668 letter-spacing: -0.23px; 666 letter-spacing: -0.23px;
669 } 667 }
670 } 668 }
671 .order-info-time { 669 .order-info-time {
672 display: block; 670 display: block;
673 margin: 8rpx 0 48rpx 40rpx; 671 margin: 8rpx 0 48rpx 40rpx;
674 text { 672 text {
675 // font-family: PingFangSC-Regular; 673 // font-family: PingFangSC-Regular;
676 font-size: 12px; 674 font-size: 12px;
677 color: #999999; 675 color: #999999;
678 letter-spacing: -0.23px; 676 letter-spacing: -0.23px;
679 } 677 }
680 } 678 }
681 .order-info-hr { 679 .order-info-hr {
682 width: 520rpx; 680 width: 520rpx;
683 height: 1px; 681 height: 1px;
684 background-color: #e9e9e9; 682 background-color: #e9e9e9;
685 margin-bottom: 20rpx; 683 margin-bottom: 20rpx;
686 } 684 }
687 .order-info-contact { 685 .order-info-contact {
688 display: flex; 686 display: flex;
689 padding-bottom: 28rpx; 687 padding-bottom: 28rpx;
690 image { 688 image {
691 width: 19px; 689 width: 19px;
692 height: 16px; 690 height: 16px;
693 } 691 }
694 text { 692 text {
695 // font-family: PingFangSC-Regular; 693 // font-family: PingFangSC-Regular;
696 margin-left: 20rpx; 694 margin-left: 20rpx;
697 font-size: 14px; 695 font-size: 14px;
698 color: #333333; 696 color: #333333;
699 letter-spacing: -0.26px; 697 letter-spacing: -0.26px;
700 line-height: 18px; 698 line-height: 18px;
701 } 699 }
702 } 700 }
703 } 701 }
704 702
705 .order-confim { 703 .order-confim {
706 display: flex; 704 display: flex;
707 align-items: center; 705 align-items: center;
708 justify-content: flex-end; 706 justify-content: flex-end;
709 // z-index: 999; 707 // z-index: 999;
710 width: 100%; 708 width: 100%;
711 height: 112rpx; 709 height: 112rpx;
712 position: fixed; 710 position: fixed;
713 bottom: 0; 711 bottom: 0;
714 background: #ffffff; 712 background: #ffffff;
715 button { 713 button {
716 width: 204rpx; 714 width: 204rpx;
717 height: 80rpx; 715 height: 80rpx;
718 border: 1px solid #ff6b4a; 716 border: 1px solid #ff6b4a;
719 border-radius: 40rpx; 717 border-radius: 40rpx;
720 font-size: 32rpx; 718 font-size: 32rpx;
721 letter-spacing: -0.3px; 719 letter-spacing: -0.3px;
722 margin-right: 0; 720 margin-right: 0;
723 } 721 }
724 .b1 { 722 .b1 {
725 // font-family: PingFangSC-Regular; 723 // font-family: PingFangSC-Regular;
726 color: #ff6b4a; 724 color: #ff6b4a;
727 background-color: #ffffff; 725 background-color: #ffffff;
728 } 726 }
729 .b2 { 727 .b2 {
730 // font-family: PingFangSC-Regular; 728 // font-family: PingFangSC-Regular;
731 background-color: #ff6b4a; 729 background-color: #ff6b4a;
732 color: #ffffff; 730 color: #ffffff;
733 margin: 0 26rpx 0 20rpx; 731 margin: 0 26rpx 0 20rpx;
734 } 732 }
735 } 733 }
736 </style> 734 </style>
737 735
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"> 80 <view class="orderHeader" @click="toMyOrder('10')" >
81 <text>我的订单</text> 81 <text>我的订单</text>
82 <view 82 <view class="btn">
83 class="btn"
84 @click="toMyOrder('10')"
85 >
86 全部 83 全部
87 <image 84 <image
88 src="../../static/right.png" 85 src="../../static/right.png"
89 mode="aspectFit" 86 mode="aspectFit"
90 ></image> 87 ></image>
91 </view> 88 </view>
92 </view> 89 </view>
93 <view class="orderBody"> 90 <view class="orderBody">
94 <view 91 <view
95 class="item waitPay" 92 class="item waitPay"
96 @click="toMyOrder('0')" 93 @click="toMyOrder('0')"
97 > 94 >
98 <image 95 <image
99 src="../../static/img/user/waitDeliver.png" 96 src="../../static/img/user/waitDeliver.png"
100 mode="aspectFit" 97 mode="aspectFit"
101 ></image> 98 ></image>
102 <text>待付款</text> 99 <text>待付款</text>
103 </view> 100 </view>
104 <view 101 <view
105 class="item waitDeliver" 102 class="item waitDeliver"
106 @click="toMyOrder('1')" 103 @click="toMyOrder('1')"
107 > 104 >
108 <image 105 <image
109 src="../../static/img/user/waitPay.png" 106 src="../../static/img/user/waitPay.png"
110 mode="aspectFit" 107 mode="aspectFit"
111 ></image> 108 ></image>
112 <text>待收货</text> 109 <text>待收货</text>
113 </view> 110 </view>
114 <view 111 <view
115 class="item waitReceive" 112 class="item waitReceive"
116 @click="toMyOrder('2')" 113 @click="toMyOrder('2')"
117 > 114 >
118 <image 115 <image
119 src="../../static/img/user/waitReceive.png" 116 src="../../static/img/user/waitReceive.png"
120 mode="aspectFit" 117 mode="aspectFit"
121 ></image> 118 ></image>
122 <text>已完成</text> 119 <text>已完成</text>
123 </view> 120 </view>
124 <!-- <view class="item service" @click="toMyOrder('3')"> 121 <!-- <view class="item service" @click="toMyOrder('3')">
125 <image src="../../static/img/user/refound.png" mode="aspectFit"></image> 122 <image src="../../static/img/user/refound.png" mode="aspectFit"></image>
126 <text>已评价</text> 123 <text>已评价</text>
127 </view> --> 124 </view> -->
128 </view> 125 </view>
129 </view> 126 </view>
130 <view class="someItem"> 127 <view class="someItem">
131 <!-- <view class="item"> 128 <!-- <view class="item">
132 <view class="left"> 129 <view class="left">
133 <image src="../../static/img/user/shouyi.png" mode="aspectFit"></image> 130 <image src="../../static/img/user/shouyi.png" mode="aspectFit"></image>
134 <text>推广记录与收益</text> 131 <text>推广记录与收益</text>
135 </view> 132 </view>
136 <image src="../../static/right.png" mode="aspectFit"></image> 133 <image src="../../static/right.png" mode="aspectFit"></image>
137 </view> --> 134 </view> -->
138 <view 135 <view
139 @tap="toAddress" 136 @tap="toAddress"
140 class="item" 137 class="item"
141 > 138 >
142 <image 139 <image
143 src="../../static/address-icon.png" 140 src="../../static/address-icon.png"
144 mode="aspectFit" 141 mode="aspectFit"
145 ></image> 142 ></image>
146 <view class="left"> 143 <view class="left">
147 <text>地址管理</text> 144 <text>地址管理</text>
148 <image 145 <image
149 class="image2" 146 class="image2"
150 src="../../static/right.png" 147 src="../../static/right.png"
151 mode="aspectFit" 148 mode="aspectFit"
152 ></image> 149 ></image>
153 </view> 150 </view>
154 151
155 </view> 152 </view>
156 <view 153 <view
157 @tap="introduce" 154 @tap="introduce"
158 class="item" 155 class="item"
159 > 156 >
160 <image 157 <image
161 src="../../static/img/user/introduce.png" 158 src="../../static/img/user/introduce.png"
162 mode="aspectFit" 159 mode="aspectFit"
163 ></image> 160 ></image>
164 <view class="left"> 161 <view class="left">
165 <text>系统介绍</text> 162 <text>系统介绍</text>
166 <image 163 <image
167 src="../../static/right.png" 164 src="../../static/right.png"
168 mode="aspectFit" 165 mode="aspectFit"
169 ></image> 166 ></image>
170 </view> 167 </view>
171 </view> 168 </view>
172 <view 169 <view
173 @tap="joinUs" 170 @tap="joinUs"
174 class="item" 171 class="item"
175 > 172 >
176 <image 173 <image
177 src="../../static/img/user/joinUs.png" 174 src="../../static/img/user/joinUs.png"
178 mode="aspectFit" 175 mode="aspectFit"
179 ></image> 176 ></image>
180 <view class="left"> 177 <view class="left">
181 <text>加入我们</text> 178 <text>加入我们</text>
182 <image 179 <image
183 src="../../static/right.png" 180 src="../../static/right.png"
184 mode="aspectFit" 181 mode="aspectFit"
185 ></image> 182 ></image>
186 </view> 183 </view>
187 </view> 184 </view>
188 <view class="item"> 185 <view class="item">
189 <image 186 <image
190 src="../../static/img/user/service.png" 187 src="../../static/img/user/service.png"
191 mode="aspectFit" 188 mode="aspectFit"
192 ></image> 189 ></image>
193 <view class="left lastLeft"> 190 <view class="left lastLeft">
194 <text>联系客服</text> 191 <text>联系客服</text>
195 <image 192 <image
196 src="../../static/right.png" 193 src="../../static/right.png"
197 mode="aspectFit" 194 mode="aspectFit"
198 ></image> 195 ></image>
199 </view> 196 </view>
200 </view> 197 </view>
201 </view> 198 </view>
202 <view class="recommend"> 199 <view class="recommend">
203 <view class="title"> 200 <view class="title">
204 <view class="line"></view> 201 <view class="line"></view>
205 <view class="text">精选推荐</view> 202 <view class="text">精选推荐</view>
206 <view class="line"></view> 203 <view class="line"></view>
207 </view> 204 </view>
208 <!-- 商品列表 --> 205 <!-- 商品列表 -->
209 <view class="goods-list"> 206 <view class="goods-list">
210 <!-- <scroll-view 207 <!-- <scroll-view
211 enable-flex 208 enable-flex
212 @scrolltolower="handleScrolltolower" 209 @scrolltolower="handleScrolltolower"
213 scroll-y 210 scroll-y
214 class="product-list" 211 class="product-list"
215 > --> 212 > -->
216 <view class="product-list"> 213 <view class="product-list">
217 <view 214 <view
218 class="product" 215 class="product"
219 v-for="(item, index) in userRecommandList" 216 v-for="(item, index) in userRecommandList"
220 :key="index" 217 :key="index"
221 > 218 >
222 <Card 219 <Card
223 :goods="item" 220 :goods="item"
224 :scrollTop="scrollTop" 221 :scrollTop="scrollTop"
225 :viewHeight="viewHeight" 222 :viewHeight="viewHeight"
226 ></Card> 223 ></Card>
227 </view> 224 </view>
228 </view> 225 </view>
229 <!-- </scroll-view> --> 226 <!-- </scroll-view> -->
230 <view class="loading-text">{{loadingText}}</view> 227 <view class="loading-text">{{loadingText}}</view>
231 </view> 228 </view>
232 </view> 229 </view>
233 </view> 230 </view>
234 <view 231 <view
235 v-else 232 v-else
236 class="auth" 233 class="auth"
237 > 234 >
238 <view class="icon"></view> 235 <view class="icon"></view>
239 <view class="divider"></view> 236 <view class="divider"></view>
240 <view class="title">申请获取以下权限</view> 237 <view class="title">申请获取以下权限</view>
241 <view class="text">获得您的公开信息(昵称、头像等)</view> 238 <view class="text">获得您的公开信息(昵称、头像等)</view>
242 <button 239 <button
243 type="primary" 240 type="primary"
244 open-type="getUserInfo" 241 open-type="getUserInfo"
245 @getuserinfo="onGotUserInfo" 242 @getuserinfo="onGotUserInfo"
246 >授权登陆</button> 243 >授权登陆</button>
247 </view> 244 </view>
248 <!-- </scroll-view> --> 245 <!-- </scroll-view> -->
249 </view> 246 </view>
250 </template> 247 </template>
251 248
252 <script> 249 <script>
253 import Card from '@/components/CommodityCard/CommodityCard.vue' 250 import Card from '@/components/CommodityCard/CommodityCard.vue'
254 import store from '@/store' 251 import store from '@/store'
255 import UniPopup from '@/components/UniPopup/uni-popup.vue' 252 import UniPopup from '@/components/UniPopup/uni-popup.vue'
256 253
257 export default { 254 export default {
258 components: { 255 components: {
259 Card, 256 Card,
260 UniPopup, 257 UniPopup,
261 }, 258 },
262 data() { 259 data() {
263 return { 260 return {
264 isAuth: true, // 是否显示授权页面, 261 isAuth: true, // 是否显示授权页面,
265 pagesnum: 1, // 分页请求初始值 262 pagesnum: 1, // 分页请求初始值
266 whichTap: 0, // 弹窗渲染选择条件 263 whichTap: 0, // 弹窗渲染选择条件
267 loadingText: '到底了', 264 loadingText: '到底了',
268 scrollTop: 0, 265 scrollTop: 0,
269 viewHeight: uni.getSystemInfoSync().windowHeight, 266 viewHeight: uni.getSystemInfoSync().windowHeight,
270 } 267 }
271 }, 268 },
272 onPageScroll({ scrollTop }) { 269 onPageScroll({ scrollTop }) {
273 // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件 270 // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件
274 this.scrollTop = scrollTop 271 this.scrollTop = scrollTop
275 }, 272 },
276 onLoad() { 273 onLoad() {
277 const that = this 274 const that = this
278 // 判断是否授权 275 // 判断是否授权
279 uni.getSetting({ 276 uni.getSetting({
280 success(res) { 277 success(res) {
281 console.log('authSetting', res.authSetting) 278 console.log('authSetting', res.authSetting)
282 if (res.authSetting['scope.userInfo'] === true) { 279 if (res.authSetting['scope.userInfo'] === true) {
283 that.isAuth = true 280 that.isAuth = true
284 } else { 281 } else {
285 that.isAuth = false 282 that.isAuth = false
286 } 283 }
287 }, 284 },
288 }) 285 })
289 store.dispatch('userRecommand/getRecommandList', { 286 store.dispatch('userRecommand/getRecommandList', {
290 uid: that.$store.state.user.userInfo.uid, 287 uid: that.$store.state.user.userInfo.uid,
291 openid: that.$store.state.user.userInfo.openid, 288 openid: that.$store.state.user.userInfo.openid,
292 page: that.pagesnum, 289 page: that.pagesnum,
293 }) 290 })
294 }, 291 },
295 onReachBottom() { 292 onReachBottom() {
296 // console.log('usr-my',this.$store.state.user.userInfo) 293 // console.log('usr-my',this.$store.state.user.userInfo)
297 this.pagesnum++ 294 this.pagesnum++
298 store.dispatch('userRecommand/getRecommandList', { 295 store.dispatch('userRecommand/getRecommandList', {
299 uid: this.$store.state.user.userInfo.uid, 296 uid: this.$store.state.user.userInfo.uid,
300 openid: this.$store.state.user.userInfo.openid, 297 openid: this.$store.state.user.userInfo.openid,
301 page: this.pagesnum, 298 page: this.pagesnum,
302 }) 299 })
303 }, 300 },
304 computed: { 301 computed: {
305 nickName() { 302 nickName() {
306 return this.$store.state.user.userInfo.nickName 303 return this.$store.state.user.userInfo.nickName
307 }, 304 },
308 headerphoto() { 305 headerphoto() {
309 return this.$store.state.user.userInfo.headerphoto 306 return this.$store.state.user.userInfo.headerphoto
310 }, 307 },
311 userRecommandList() { 308 userRecommandList() {
312 console.log('userRecommandList=====>', this.$store.state.userRecommand.recommandList) 309 console.log('userRecommandList=====>', this.$store.state.userRecommand.recommandList)
313 return this.$store.state.userRecommand.recommandList 310 return this.$store.state.userRecommand.recommandList
314 }, 311 },
315 }, 312 },
316 methods: { 313 methods: {
317 // 弹窗 314 // 弹窗
318 changeTap(item) { 315 changeTap(item) {
319 this.whichTap = item 316 this.whichTap = item
320 this.$refs.popup.open() 317 this.$refs.popup.open()
321 }, 318 },
322 chatOur(item) { 319 chatOur(item) {
323 if (item === 1) { 320 if (item === 1) {
324 uni.makePhoneCall({ 321 uni.makePhoneCall({
325 phoneNumber: 13376189297, // 客服1 电话 322 phoneNumber: 13376189297, // 客服1 电话
326 }) 323 })
327 } else { 324 } else {
328 uni.makePhoneCall({ 325 uni.makePhoneCall({
329 phoneNumber: 18014995101, // 客服2 电话 326 phoneNumber: 18014995101, // 客服2 电话
330 }) 327 })
331 } 328 }
332 }, 329 },
333 // 授权 330 // 授权
334 onGotUserInfo(e) { 331 onGotUserInfo(e) {
335 if (e.detail.errMsg === 'getUserInfo:ok') { 332 if (e.detail.errMsg === 'getUserInfo:ok') {
336 const { fromInfo } = this.$store.state.user 333 const { fromInfo } = this.$store.state.user
337 // 用户授权成功 334 // 用户授权成功
338 store.dispatch('user/getUserInfo', fromInfo) 335 store.dispatch('user/getUserInfo', fromInfo)
339 this.isAuth = true 336 this.isAuth = true
340 } 337 }
341 }, 338 },
342 toAddress() { 339 toAddress() {
343 uni.navigateTo({ 340 uni.navigateTo({
344 url: '../address/addressList', 341 url: '../address/addressList',
345 success: res => {}, 342 success: res => {},
346 fail: () => {}, 343 fail: () => {},
347 complete: () => {}, 344 complete: () => {},
348 }) 345 })
349 }, 346 },
350 introduce() { 347 introduce() {
351 uni.showModal({ 348 uni.showModal({
352 content: '这是一款眼镜及周边产品的销售平台,我们将帮您进行建立全球销售网络,欢迎入住。', 349 content: '这是一款眼镜及周边产品的销售平台,我们将帮您进行建立全球销售网络,欢迎入住。',
353 showCancel: false, 350 showCancel: false,
354 }) 351 })
355 }, 352 },
356 joinUs() { 353 joinUs() {
357 uni.showModal({ 354 uni.showModal({
358 content: '本平台欢迎全国各地的眼镜工厂、品牌、眼镜店加入。请联系我们申请注册账号', 355 content: '本平台欢迎全国各地的眼镜工厂、品牌、眼镜店加入。请联系我们申请注册账号',
359 showCancel: false, 356 showCancel: false,
360 }) 357 })
361 }, 358 },
362 toMyOrder(status) { 359 toMyOrder(status) {
363 uni.navigateTo({ 360 uni.navigateTo({
364 url: `../myOrder/myOrder?status=${status}`, 361 url: `../myOrder/myOrder?status=${status}`,
365 success: res => {}, 362 success: res => {},
366 fail: () => {}, 363 fail: () => {},
367 complete: () => {}, 364 complete: () => {},
368 }) 365 })
369 }, 366 },
370 toOpticsData() { 367 toOpticsData() {
371 uni.navigateTo({ 368 uni.navigateTo({
372 url: '../addOpticsData/addOpticsData', 369 url: '../addOpticsData/addOpticsData',
373 }) 370 })
374 }, 371 },
375 }, 372 },
376 } 373 }
377 </script> 374 </script>
378 375
379 <style lang="scss"> 376 <style lang="scss">
380 .warp { 377 .warp {
381 font-size: 24rpx; 378 font-size: 24rpx;
382 background-color: #f2f2f2; 379 background-color: #f2f2f2;
383 height: 100vh; 380 height: 100vh;
384 } 381 }
385 .content { 382 .content {
386 display: flex; 383 display: flex;
387 flex-direction: column; 384 flex-direction: column;
388 align-items: center; 385 align-items: center;
389 justify-content: center; 386 justify-content: center;
390 background-color: #f2f2f2; 387 background-color: #f2f2f2;
391 } 388 }
392 .userInfo { 389 .userInfo {
393 background-image: linear-gradient(270deg, #f79067 0%, #ff5f3b 66%); 390 background-image: linear-gradient(270deg, #f79067 0%, #ff5f3b 66%);
394 width: 100%; 391 width: 100%;
395 height: 240rpx; 392 height: 240rpx;
396 color: #ffffff; 393 color: #ffffff;
397 padding: 60rpx 82rpx 80rpx 44rpx; 394 padding: 60rpx 82rpx 80rpx 44rpx;
398 box-sizing: border-box; 395 box-sizing: border-box;
399 display: flex; 396 display: flex;
400 flex-direction: row; 397 flex-direction: row;
401 justify-content: space-between; 398 justify-content: space-between;
402 align-items: flex-start; 399 align-items: flex-start;
403 .info { 400 .info {
404 display: flex; 401 display: flex;
405 flex-direction: row; 402 flex-direction: row;
406 justify-content: space-between; 403 justify-content: space-between;
407 align-items: center; 404 align-items: center;
408 image { 405 image {
409 border-radius: 50rpx; 406 border-radius: 50rpx;
410 height: 100rpx; 407 height: 100rpx;
411 width: 100rpx; 408 width: 100rpx;
412 margin-right: 40rpx; 409 margin-right: 40rpx;
413 } 410 }
414 .infoText { 411 .infoText {
415 display: flex; 412 display: flex;
416 flex-direction: column; 413 flex-direction: column;
417 justify-content: space-between; 414 justify-content: space-between;
418 align-items: flex-scetart; 415 align-items: flex-scetart;
419 .userName { 416 .userName {
420 font-size: 18px; 417 font-size: 18px;
421 color: #ffffff; 418 color: #ffffff;
422 margin-bottom: 8rpx; 419 margin-bottom: 8rpx;
423 } 420 }
424 .nickName { 421 .nickName {
425 font-size: 12px; 422 font-size: 12px;
426 color: #ffffff; 423 color: #ffffff;
427 } 424 }
428 } 425 }
429 } 426 }
430 // .service { 427 // .service {
431 // margin-top: 20rpx; 428 // margin-top: 20rpx;
432 // image { 429 // image {
433 // height: 36rpx; 430 // height: 36rpx;
434 // width: 36rpx; 431 // width: 36rpx;
435 // } 432 // }
436 // } 433 // }
437 } 434 }
438 .myOpticsData { 435 .myOpticsData {
439 width: 670rpx; 436 width: 670rpx;
440 height: 120rpx; 437 height: 120rpx;
441 background-color: #ffffff; 438 background-color: #ffffff;
442 border-radius: 6px; 439 border-radius: 6px;
443 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);
444 position: relative; 441 position: relative;
445 bottom: 44rpx; 442 bottom: 44rpx;
446 padding: 40rpx; 443 padding: 40rpx;
447 box-sizing: border-box; 444 box-sizing: border-box;
448 display: flex; 445 display: flex;
449 justify-content: space-between; 446 justify-content: space-between;
450 align-items: center; 447 align-items: center;
451 .left { 448 .left {
452 font-size: 14px; 449 font-size: 14px;
453 color: #333333; 450 color: #333333;
454 display: flex; 451 display: flex;
455 align-items: center; 452 align-items: center;
456 image { 453 image {
457 margin-right: 32rpx; 454 margin-right: 32rpx;
458 width: 40rpx; 455 width: 40rpx;
459 height: 44rpx; 456 height: 44rpx;
460 } 457 }
461 } 458 }
462 image { 459 image {
463 height: 16px; 460 height: 16px;
464 width: 8px; 461 width: 8px;
465 } 462 }
466 } 463 }
467 .myOrder { 464 .myOrder {
468 width: 100%; 465 width: 100%;
469 height: 296rpx; 466 height: 296rpx;
470 // margin-top: 116rpx; 467 // margin-top: 116rpx;
471 margin-bottom: 20rpx; 468 margin-bottom: 20rpx;
472 padding: 0 40rpx; 469 padding: 0 40rpx;
473 box-sizing: border-box; 470 box-sizing: border-box;
474 background: #ffffff; 471 background: #ffffff;
475 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);
476 border-radius: 6px; 473 border-radius: 6px;
477 border-radius: 6px; 474 border-radius: 6px;
478 display: flex; 475 display: flex;
479 flex-direction: column; 476 flex-direction: column;
480 justify-content: space-around; 477 justify-content: space-around;
481 align-items: center; 478 align-items: center;
482 .orderHeader { 479 .orderHeader {
483 width: 100%; 480 width: 100%;
484 height: 100rpx; 481 height: 100rpx;
485 display: flex; 482 display: flex;
486 flex-direction: row; 483 flex-direction: row;
487 justify-content: space-between; 484 justify-content: space-between;
488 align-items: center; 485 align-items: center;
489 border-bottom: 1px solid #f5f5f5; 486 border-bottom: 1px solid #f5f5f5;
490 font-weight: bold; 487 font-weight: bold;
491 font-size: 18px; 488 font-size: 18px;
492 color: #333333; 489 color: #333333;
493 .btn { 490 .btn {
494 font-size: 12px; 491 font-size: 12px;
495 color: #999999; 492 color: #999999;
496 display: flex; 493 display: flex;
497 align-items: center; 494 align-items: center;
498 image { 495 image {
499 margin-left: 20rpx; 496 margin-left: 20rpx;
500 height: 32rpx; 497 height: 32rpx;
501 width: 16rpx; 498 width: 16rpx;
502 } 499 }
503 } 500 }
504 } 501 }
505 .orderBody { 502 .orderBody {
506 width: 100%; 503 width: 100%;
507 display: flex; 504 display: flex;
508 flex-direction: row; 505 flex-direction: row;
509 justify-content: space-around; 506 justify-content: space-around;
510 align-items: center; 507 align-items: center;
511 .item { 508 .item {
512 display: flex; 509 display: flex;
513 flex-direction: column; 510 flex-direction: column;
514 align-items: center; 511 align-items: center;
515 image { 512 image {
516 width: 62rpx; 513 width: 62rpx;
517 height: 46rpx; 514 height: 46rpx;
518 } 515 }
519 text { 516 text {
520 margin-top: 24rpx; 517 margin-top: 24rpx;
521 font-size: 12px; 518 font-size: 12px;
522 color: #333333; 519 color: #333333;
523 } 520 }
524 } 521 }
525 } 522 }
526 } 523 }
527 .someItem { 524 .someItem {
528 width: 100%; 525 width: 100%;
529 height: 336rpx; 526 height: 336rpx;
530 background: #ffffff; 527 background: #ffffff;
531 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);
532 border-radius: 6px; 529 border-radius: 6px;
533 border-radius: 6px; 530 border-radius: 6px;
534 margin-bottom: 18rpx; 531 margin-bottom: 18rpx;
535 box-sizing: border-box; 532 box-sizing: border-box;
536 padding: 21rpx 48rpx 21rpx 42rpx; 533 padding: 21rpx 48rpx 21rpx 42rpx;
537 box-sizing: border-box; 534 box-sizing: border-box;
538 display: flex; 535 display: flex;
539 flex-direction: column; 536 flex-direction: column;
540 justify-content: space-between; 537 justify-content: space-between;
541 align-items: center; 538 align-items: center;
542 .item { 539 .item {
543 display: grid; 540 display: grid;
544 grid-template-columns: 10% 90%; 541 grid-template-columns: 10% 90%;
545 align-items: center; 542 align-items: center;
546 height: 72rpx; 543 height: 72rpx;
547 width: 100%; 544 width: 100%;
548 .left { 545 .left {
549 font-size: 14px; 546 font-size: 14px;
550 color: #333333; 547 color: #333333;
551 display: flex; 548 display: flex;
552 align-items: center; 549 align-items: center;
553 justify-content: space-between; 550 justify-content: space-between;
554 height: 72rpx; 551 height: 72rpx;
555 border-bottom: 1px solid #f2f2f2; 552 border-bottom: 1px solid #f2f2f2;
556 image { 553 image {
557 margin-right: 0; 554 margin-right: 0;
558 height: 16px; 555 height: 16px;
559 width: 8px; 556 width: 8px;
560 } 557 }
561 } 558 }
562 image { 559 image {
563 margin-right: 32rpx; 560 margin-right: 32rpx;
564 width: 40rpx; 561 width: 40rpx;
565 height: 44rpx; 562 height: 44rpx;
566 } 563 }
567 .lastLeft { 564 .lastLeft {
568 border-bottom: none; 565 border-bottom: none;
569 } 566 }
570 } 567 }
571 } 568 }
572 .recommend { 569 .recommend {
573 background: #ffffff; 570 background: #ffffff;
574 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);
575 border-radius: 6px; 572 border-radius: 6px;
576 border-radius: 6px; 573 border-radius: 6px;
577 width: 100%; 574 width: 100%;
578 .title { 575 .title {
579 display: flex; 576 display: flex;
580 flex-direction: row; 577 flex-direction: row;
581 align-items: center; 578 align-items: center;
582 justify-content: space-between; 579 justify-content: space-between;
583 padding: 20rpx 40rpx; 580 padding: 20rpx 40rpx;
584 .line { 581 .line {
585 width: 264rpx; 582 width: 264rpx;
586 height: 1rpx; 583 height: 1rpx;
587 border-bottom: 1px solid #eaeaea; 584 border-bottom: 1px solid #eaeaea;
588 } 585 }
589 .text { 586 .text {
590 font-family: PingFangSC-Medium; 587 font-family: PingFangSC-Medium;
591 font-size: 14px; 588 font-size: 14px;
592 color: #333333; 589 color: #333333;
593 letter-spacing: -0.26px; 590 letter-spacing: -0.26px;
594 text-align: justify; 591 text-align: justify;
595 line-height: 24px; 592 line-height: 24px;
596 } 593 }
597 } 594 }
598 .goods-list { 595 .goods-list {
599 .loading-text { 596 .loading-text {
600 width: 100%; 597 width: 100%;
601 display: flex; 598 display: flex;
602 justify-content: center; 599 justify-content: center;
603 align-items: center; 600 align-items: center;
604 height: 30px; 601 height: 30px;
605 color: #979797; 602 color: #979797;
606 font-size: 12px; 603 font-size: 12px;
607 } 604 }
608 .product-list { 605 .product-list {
609 width: 92%; 606 width: 92%;
610 padding: 0 4% 3vw 4%; 607 padding: 0 4% 3vw 4%;
611 display: flex; 608 display: flex;
612 justify-content: space-between; 609 justify-content: space-between;
613 flex-wrap: wrap; 610 flex-wrap: wrap;
614 .product { 611 .product {
615 width: 48%; 612 width: 48%;
616 margin: 0 0 20rpx 0; 613 margin: 0 0 20rpx 0;
617 background: #ffffff; 614 background: #ffffff;
618 border: 1px solid #f2f2f2; 615 border: 1px solid #f2f2f2;
619 } 616 }
620 } 617 }
621 } 618 }
622 } 619 }
623 .auth { 620 .auth {
624 height: 100vh; 621 height: 100vh;
625 display: flex; 622 display: flex;
626 flex-direction: column; 623 flex-direction: column;
627 align-items: center; 624 align-items: center;
628 .icon { 625 .icon {
629 width: 140rpx; 626 width: 140rpx;
630 height: 140rpx; 627 height: 140rpx;
631 border-radius: 50%; 628 border-radius: 50%;
632 margin-top: 100rpx; 629 margin-top: 100rpx;
633 background-color: grey; 630 background-color: grey;
634 } 631 }
635 .divider { 632 .divider {
636 height: 1rpx; 633 height: 1rpx;
637 width: 600rpx; 634 width: 600rpx;
638 margin-top: 80rpx; 635 margin-top: 80rpx;
639 background-color: #e6e3e3; 636 background-color: #e6e3e3;
640 } 637 }
641 .title { 638 .title {
642 width: 600rpx; 639 width: 600rpx;
643 margin-top: 50rpx; 640 margin-top: 50rpx;
644 text-align: left; 641 text-align: left;
645 } 642 }
646 .text { 643 .text {
647 width: 600rpx; 644 width: 600rpx;
648 margin-top: 30rpx; 645 margin-top: 30rpx;
649 text-align: left; 646 text-align: left;
650 color: #e6e3e3; 647 color: #e6e3e3;
651 } 648 }
652 button { 649 button {
653 width: 450rpx; 650 width: 450rpx;
654 height: 80rpx; 651 height: 80rpx;
655 line-height: 80rpx; 652 line-height: 80rpx;
656 margin-top: 80rpx; 653 margin-top: 80rpx;
657 border-radius: 30rpx; 654 border-radius: 30rpx;
658 } 655 }
659 } 656 }
660 .closeBtn { 657 .closeBtn {
661 height: 28rpx; 658 height: 28rpx;
662 width: 28rpx; 659 width: 28rpx;
663 // border: 1px solid red; 660 // border: 1px solid red;
664 position: absolute; 661 position: absolute;
665 top: 20rpx; 662 top: 20rpx;
666 right: 10rpx; 663 right: 10rpx;
667 } 664 }
668 </style> 665 </style>
669 666
src/store/modules/cancelOrder.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 cancelOrder 5 cancelOrder
6 } = urlAlias; 6 } = urlAlias;
7 7
8 const state = {
9 orderList: [],
10 };
11
12 const mutations = {
13 INIT: (state, data) => {
14 state.orderList = data;
15 },
16 };
17
18 const actions = { 8 const actions = {
19 cancel({ commit }, param) { 9 cancel({ commit }, param) {
20 request({ 10 return new Promise((resolve)=>
21 url: cancelOrder, 11 request({
22 data: param, 12 url: cancelOrder,
23 success: (res) => { 13 data: param,
24 console.log(res.data); 14 success: (res) => {
25 // commit("INIT", res.data.data); 15 // console.log(res.data);
26 }, 16 resolve(res.data)
27 }) 17 },
18 }) )
28 } 19 }
29 } 20 }
30 21
31 export default { 22 export default {
32 namespaced: true, 23 namespaced: true,
33 state,
34 mutations,
35 actions, 24 actions,
src/store/modules/orderRead.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 orderRead 5 orderRead
6 } = urlAlias 6 } = urlAlias
7 7
8 const state = { 8 const state = {
9 orderInfo: {} 9 orderInfo: {}
10 } 10 }
11 11
12 const mutations = { 12 const mutations = {
13 INIT: (state, orderInfo) => { 13 INIT: (state, orderInfo) => {
14 state.orderInfo = orderInfo 14 state.orderInfo = orderInfo
15 } 15 }
16 } 16 }
17 17
18 const actions = { 18 const actions = {
19 getOrderInfo({ commit }, param) { 19 getOrderInfo({ commit }, param) {
20 return new Promise ((resolve) => request({ 20 return new Promise ((resolve) => request({
21 url: orderRead, 21 url: orderRead,
22 data: param, 22 data: param,
23 success: (res) => { 23 success: (res) => {
24 console.log(res)
24 commit("INIT", res.data.data) 25 commit("INIT", res.data.data)
25 resolve(res.data.data) 26 resolve(res.data.data)
26 } 27 }
27 })) 28 }))
28 } 29 }
29 } 30 }
30 31
31 export default { 32 export default {
32 namespaced: true, 33 namespaced: true,
33 state, 34 state,
34 mutations, 35 mutations,
35 actions 36 actions
36 } 37 }
37 38