Commit 36e5592037888e5b54ebfd4874c987d8f671e68f

Authored by BigBoss
1 parent 56ccc089ea
Exists in master

逻辑完善

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