Compare View
Commits (12)
-
Master See merge request !8
Showing
28 changed files
Show diff stats
src/components/CommodityCard/CommodityCard.vue
... | ... | @@ -3,10 +3,14 @@ |
3 | 3 | class="card" |
4 | 4 | @tap="toGoods(goods.id?goods.id:goods.pid,goods.sk_id)" |
5 | 5 | > |
6 | - <image | |
6 | + <easy-loadimage mode="widthFix" | |
7 | + :scroll-top="scrollTop" | |
8 | + :image-src="goods.imgurl?goods.imgurl:goods.pic" | |
9 | + :viewHeight="viewHeight"></easy-loadimage> | |
10 | +<!-- <image | |
7 | 11 | mode="widthFix" |
8 | 12 | :src="goods.imgurl?goods.imgurl:goods.pic" |
9 | - ></image> | |
13 | + ></image> --> | |
10 | 14 | <view class="name">{{goods.name?goods.name:goods.p_name}}</view> |
11 | 15 | <view class="info"> |
12 | 16 | <view class="priceBox"> |
... | ... | @@ -22,7 +26,10 @@ |
22 | 26 | </template> |
23 | 27 | |
24 | 28 | <script> |
29 | +import easyLoadimage from '@/components/EasyLoadimage/EasyLoadimage.vue' | |
30 | +// const MockData = require('@/static/easy-loadimage/mock-data.json') | |
25 | 31 | export default { |
32 | + components:{easyLoadimage}, | |
26 | 33 | props: { |
27 | 34 | /** |
28 | 35 | * 商品数据 |
... | ... | @@ -37,20 +44,22 @@ export default { |
37 | 44 | trade_num: String, |
38 | 45 | goodType: String, |
39 | 46 | }, |
40 | - | |
47 | + scrollTop:Number, | |
48 | + viewHeight:Number, | |
41 | 49 | }, |
42 | 50 | created () { |
43 | 51 | }, |
44 | 52 | data () { |
45 | 53 | return { |
46 | - | |
54 | + | |
47 | 55 | } |
48 | 56 | }, |
57 | + | |
49 | 58 | methods: { |
50 | - toGoods (id, sk_id) { | |
51 | - console.log('---', '../frameDetail/frameDetail?pid=' + id + '&sk_id=' + sk_id) | |
59 | + toGoods (id, skId) { | |
60 | + console.log('---', '../frameDetail/frameDetail?pid=' + id + '&sk_id=' + skId) | |
52 | 61 | uni.navigateTo({ |
53 | - url: '../frameDetail/frameDetail?pid=' + id + '&sk_id=' + sk_id, | |
62 | + url: '../frameDetail/frameDetail?pid=' + id + '&sk_id=' + skId, | |
54 | 63 | success: res => {}, |
55 | 64 | fail: () => {}, |
56 | 65 | complete: () => {}, |
... | ... | @@ -61,6 +70,7 @@ export default { |
61 | 70 | </script> |
62 | 71 | |
63 | 72 | <style lang="scss"> |
73 | + | |
64 | 74 | image { |
65 | 75 | width: 100%; |
66 | 76 | height: 120rpx; |
... | ... | @@ -74,7 +84,7 @@ image { |
74 | 84 | -webkit-line-clamp: 2; |
75 | 85 | text-align: justify; |
76 | 86 | overflow: hidden; |
77 | - font-size: 24rpx; | |
87 | + font-size: 26rpx; | |
78 | 88 | color: #333333; |
79 | 89 | } |
80 | 90 | .info { | ... | ... |
src/components/EasyLoadimage/EasyLoadimage.vue
... | ... | @@ -0,0 +1,170 @@ |
1 | +<template> | |
2 | + <view class="easy-loadimage" :id="uid"> | |
3 | + <image class="origin-img" :src="imageSrc?imageSrc:defaultImg" :mode="mode" | |
4 | + v-if="loadImg&&!isLoadError" | |
5 | + v-show="showImg" | |
6 | + :class="{'no-transition':!openTransition,'show-transition':showTransition&&openTransition}" | |
7 | + @load="handleImgLoad" | |
8 | + @error="handleImgError"> | |
9 | + </image> | |
10 | + <view class="loadfail-img" v-else-if="isLoadError"></view> | |
11 | + <view :class="['loading-img',loadingMode]" v-show="!showImg&&!isLoadError"></view> | |
12 | + | |
13 | + </view> | |
14 | +</template> | |
15 | +<script> | |
16 | +// 生成全局唯一id | |
17 | +function generateUUID() { | |
18 | + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
19 | + let r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); | |
20 | + return v.toString(16); | |
21 | + }) | |
22 | +} | |
23 | +export default{ | |
24 | + props:{ | |
25 | + imageSrc:{ | |
26 | + type: String, | |
27 | + }, | |
28 | + mode:{ | |
29 | + type: String, | |
30 | + }, | |
31 | + scrollTop:{ | |
32 | + type: Number, | |
33 | + }, | |
34 | + loadingMode:{ | |
35 | + type: String, | |
36 | + default:'looming-gray' | |
37 | + }, | |
38 | + openTransition:{ | |
39 | + type: Boolean, | |
40 | + default:true, | |
41 | + }, | |
42 | + viewHeight:{ | |
43 | + type:Number, | |
44 | + default() { | |
45 | + return uni.getSystemInfoSync().windowHeight; | |
46 | + } | |
47 | + } | |
48 | + }, | |
49 | + watch:{ | |
50 | + scrollTop(val){ | |
51 | + this.onScroll(val) | |
52 | + } | |
53 | + }, | |
54 | + data(){ | |
55 | + return { | |
56 | + uid:'', | |
57 | + loadImg:false, | |
58 | + showImg:false, | |
59 | + isLoadError:false, | |
60 | + showTransition:false | |
61 | + } | |
62 | + }, | |
63 | + methods:{ | |
64 | + init(){ | |
65 | + this.uid = 'uid-' + generateUUID(); | |
66 | + this.$nextTick(this.onScroll) | |
67 | + }, | |
68 | + handleImgLoad(e){ | |
69 | + // console.log('success'); | |
70 | + this.showImg = true; | |
71 | + // this.$nextTick(function(){ | |
72 | + // this.showTransition = true | |
73 | + // }) | |
74 | + setTimeout(()=>{ | |
75 | + this.showTransition = true | |
76 | + },50) | |
77 | + }, | |
78 | + handleImgError(e){ | |
79 | + // console.log('fail'); | |
80 | + this.isLoadError = true; | |
81 | + }, | |
82 | + onScroll(scrollTop){ | |
83 | + // 加载ing时才执行滚动监听判断是否可加载 | |
84 | + if(this.loadImg || this.isLoadError) return; | |
85 | + const id = this.uid | |
86 | + const query = uni.createSelectorQuery().in(this); | |
87 | + query.select('#'+id).boundingClientRect(data => { | |
88 | + if(!data) return; | |
89 | + if(data.top - this.viewHeight<0){ | |
90 | + this.loadImg = true; | |
91 | + } | |
92 | + }).exec() | |
93 | + }, | |
94 | + }, | |
95 | + mounted() { | |
96 | + this.init() | |
97 | + } | |
98 | +} | |
99 | +</script> | |
100 | + | |
101 | +<style scoped> | |
102 | + /* 官方优化图片tips */ | |
103 | + image{ | |
104 | + will-change: transform | |
105 | + } | |
106 | + /* 渐变过渡效果处理 */ | |
107 | + image.origin-img{ | |
108 | + width: 100%; | |
109 | + height: 100%; | |
110 | + opacity: 0.3; | |
111 | + } | |
112 | + image.origin-img.show-transition{ | |
113 | + transition: opacity 1.2s; | |
114 | + opacity: 1; | |
115 | + } | |
116 | + image.origin-img.no-transition{ | |
117 | + opacity: 1; | |
118 | + } | |
119 | + /* 加载失败、加载中的占位图样式控制 */ | |
120 | + .loadfail-img{ | |
121 | + height: 100%; | |
122 | + background: url('~@/static/easy-loadimage/loadfail.png') no-repeat center; | |
123 | + background-size: 50%; | |
124 | + } | |
125 | + .loading-img{ | |
126 | + height: 100%; | |
127 | + } | |
128 | + /* 转圈 */ | |
129 | + .spin-circle{ | |
130 | + background: url('~@/static/easy-loadimage/loading.gif') no-repeat center; | |
131 | + background-size: 100rpx; | |
132 | + } | |
133 | + /* 动态灰色若隐若现 */ | |
134 | + .looming-gray{ | |
135 | + animation: looming-gray 1s infinite linear; | |
136 | + background-color: #e3e3e3; | |
137 | + } | |
138 | + @keyframes looming-gray{ | |
139 | + 0% {background-color:#e3e3e3aa;} | |
140 | + 50% {background-color:#e3e3e3;} | |
141 | + 100% {background-color:#e3e3e3aa;} | |
142 | + } | |
143 | + /* 骨架屏1 */ | |
144 | + .skeleton-1{ | |
145 | + background-color: #e3e3e3; | |
146 | + background-image: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 80%); | |
147 | + background-size: 100rpx 100%; | |
148 | + background-repeat: repeat-y; | |
149 | + background-position:0 0; | |
150 | + animation: skeleton-1 .6s infinite; | |
151 | + } | |
152 | + @keyframes skeleton-1 { | |
153 | + to { | |
154 | + background-position: 200% 0; | |
155 | + } | |
156 | + } | |
157 | + /* 骨架屏2 */ | |
158 | + .skeleton-2{ | |
159 | + background-image: linear-gradient(-90deg, #fefefe 0%, #e6e6e6 50%,#fefefe 100%); | |
160 | + background-size: 400% 400%; | |
161 | + background-position:0 0; | |
162 | + animation: skeleton-2 1.2s ease-in-out infinite; | |
163 | + } | |
164 | + @keyframes skeleton-2{ | |
165 | + to { | |
166 | + background-position: -135% 0; | |
167 | + } | |
168 | + } | |
169 | +</style> | |
170 | + | ... | ... |
src/pages/addOpticsData/addOpticsData.vue
1 | -<template> | |
1 | +<template> | |
2 | 2 | <view class="wrap"> |
3 | 3 | <!-- 弹窗 --> |
4 | 4 | <uni-popup ref="popup" type="center"> |
... | ... | @@ -12,13 +12,13 @@ |
12 | 12 | <image class="dataInfo" src="../../static/img/myOpticsData/dataInfo.png" v-else mode="aspectFit"></image> |
13 | 13 | </view> |
14 | 14 | </uni-popup> |
15 | - <!-- 点击弹窗部分 --> | |
15 | + <!-- 点击弹窗部分 --> | |
16 | 16 | <view class="header"> |
17 | - <view class="headerLeft" @click=changeTap(0)> | |
17 | + <view class="headerLeft" @click=changeTap(1)> | |
18 | 18 | <text>如何查看验光单?</text> |
19 | 19 | <image src="../../static/dataLook.png" mode="aspectFit"></image> |
20 | 20 | </view> |
21 | - <view class="headerRight" @click=changeTap(1)> | |
21 | + <view class="headerRight" @click=changeTap(0)> | |
22 | 22 | <text>如何查看眼镜框架?</text> |
23 | 23 | <image src="../../static/glassLook.png" mode="aspectFit"></image> |
24 | 24 | </view> |
... | ... | @@ -48,21 +48,21 @@ |
48 | 48 | </view> |
49 | 49 | <view class="footer"> |
50 | 50 | <button class="btn" type="default" @click="toNewData(1)">新建验光单</button> |
51 | - </view> | |
52 | - </view> | |
53 | -</template> | |
54 | - | |
51 | + </view> | |
52 | + </view> | |
53 | +</template> | |
54 | + | |
55 | 55 | <script> |
56 | 56 | import UniCollapse from '@/components/UniCollapse/UniCollapse.vue' |
57 | 57 | import UniCollapseItem from '@/components/UniCollapseItem/UniCollapseItem.vue' |
58 | 58 | import UniPopup from '@/components/UniPopup/uni-popup.vue' |
59 | 59 | import store from '@/store'; |
60 | 60 | export default { |
61 | - components: {UniCollapse,UniCollapseItem,UniPopup}, | |
62 | - data() { | |
63 | - return { | |
64 | - whichTap:0 | |
65 | - }; | |
61 | + components: {UniCollapse,UniCollapseItem,UniPopup}, | |
62 | + data() { | |
63 | + return { | |
64 | + whichTap:0 | |
65 | + }; | |
66 | 66 | }, |
67 | 67 | onLoad: function(option) { |
68 | 68 | //获取关心的人列表 |
... | ... | @@ -116,11 +116,11 @@ |
116 | 116 | url:'../newOpticsData/newOpticsData?kinds='+item+'&index='+index |
117 | 117 | }) |
118 | 118 | } |
119 | - } | |
120 | - } | |
121 | -</script> | |
122 | - | |
123 | -<style lang="scss"> | |
119 | + } | |
120 | + } | |
121 | +</script> | |
122 | + | |
123 | +<style lang="scss"> | |
124 | 124 | .wrap{ |
125 | 125 | min-height: 100vh; |
126 | 126 | width: 100%; |
... | ... | @@ -223,5 +223,5 @@ |
223 | 223 | border-radius: 4px; |
224 | 224 | border: 1px solid #979797; |
225 | 225 | } |
226 | - | |
227 | -</style> | |
226 | + | |
227 | +</style> | ... | ... |
src/pages/address/addressList.vue
... | ... | @@ -133,6 +133,9 @@ export default { |
133 | 133 | text-align: center; |
134 | 134 | margin-right: 20rpx; |
135 | 135 | text { |
136 | + display: flex; | |
137 | + justify-content: center; | |
138 | + align-items: center; | |
136 | 139 | font-size: 12px; |
137 | 140 | color: #ffffff; |
138 | 141 | letter-spacing: -0.23px; |
... | ... | @@ -161,7 +164,7 @@ export default { |
161 | 164 | } |
162 | 165 | } |
163 | 166 | .arrow { |
164 | - width: 6px; | |
167 | + width: 12px; | |
165 | 168 | height: 12px; |
166 | 169 | position: absolute; |
167 | 170 | right: 40rpx; | ... | ... |
src/pages/cart/cart.vue
1 | 1 | <template> |
2 | - <view class="content"> | |
3 | - <block v-if="cartList.length==0"> | |
2 | + <view class="content"> | |
3 | + <block v-if="cartList.length==0"> | |
4 | 4 | |
5 | - </block> | |
6 | - <block v-else> | |
7 | - <view class="card"> | |
8 | - <view class="cardHeader"> | |
9 | - <view v-bind:class="pIsoPen? 'partentChecked' : 'partentCheck'" | |
10 | - @tap="pChange(pIsoPen)"> | |
11 | - <span class="correct"></span> | |
12 | - </view> | |
13 | - <image src="../../static/store.png" mode="aspectFill"></image> | |
14 | - <text>非常戴镜</text> | |
15 | - </view> | |
5 | + </block> | |
6 | + <block v-else> | |
7 | + <view class="card"> | |
8 | + <view class="cardHeader"> | |
9 | + <view | |
10 | + v-bind:class="pIsoPen? 'partentChecked' : 'partentCheck'" | |
11 | + @touchstart="pChange(pIsoPen)" | |
12 | + > | |
13 | + <span class="correct"></span> | |
14 | + </view> | |
15 | + <image | |
16 | + src="../../static/store.png" | |
17 | + mode="aspectFill" | |
18 | + ></image> | |
19 | + <text>非常戴镜</text> | |
20 | + </view> | |
21 | + <view | |
22 | + class="cardBody" | |
23 | + v-for="(item,index) in cartList" | |
24 | + :key="index" | |
25 | + @longpress="delCart(item.cart_id,index)" | |
26 | + > | |
27 | + <view | |
28 | + v-bind:class="childIsOpen[index]? 'partentChecked':'partentCheck'" | |
29 | + @touchstart="Change(childIsOpen[index],index)" | |
30 | + > | |
31 | + <span class="correct"></span> | |
32 | + </view> | |
33 | + <view class="imageWrap"> | |
34 | + <image | |
35 | + :src="item.img_index_url" | |
36 | + mode="aspectFit" | |
37 | + style="width: 188rpx;height: 168rpx;" | |
38 | + ></image> | |
39 | + </view> | |
40 | + <view class="goodInfo"> | |
41 | + <!-- <view class="imageWrap"> | |
42 | + <image :src="item.img_index_url" mode="aspectFit" style="width: 188rpx;height: 168rpx;"></image> | |
43 | + </view> --> | |
44 | + <view class="infoRight"> | |
45 | + <view | |
46 | + class="goodName" | |
47 | + @tap="toGoods(item.pid,item.sk_id)" | |
48 | + >{{item.p_name}}</view> | |
49 | + <!-- <view class="describ"> --> | |
50 | + <uni-collapse accordion="true" style="justify-content: space-around;width: 196px;"> | |
51 | + <uni-collapse-item | |
52 | + showAnimation='true' | |
53 | + :title="item.tag.prod_tag_fun[0].label&&item.tag.prod_tag_fun[1].label?item.tag.prod_tag_fun[0].label+'/'+item.tag.prod_tag_fun[1].label+'...':'暂无数据'"> | |
54 | + <text class="describ"> | |
55 | + <block | |
56 | + v-for="tag in item.tag.prod_tag_fun" | |
57 | + :key="tag.value" | |
58 | + > | |
59 | + {{tag.label+` `}} | |
60 | + </block> | |
61 | + </text> | |
62 | + <!-- <text> | |
63 | + <block v-for="tag in item.tag.prod_tag_style" :key="tag.value"> | |
64 | + {{tag.label+` `}} | |
65 | + </block> | |
66 | + </text> --> | |
67 | + </uni-collapse-item> | |
68 | + </uni-collapse> | |
69 | + <!-- <view v-bind:class="collapseList[index]? 'icon':'iconed'"></view> --> | |
70 | + <!-- </view> --> | |
71 | + <view class="priceBox"> | |
72 | + <view class="price">¥{{item.nowPrice*item.num}}</view> | |
73 | + <text class="maxCount">(限购{{maxCount}}副)</text> | |
74 | + <view class="counter"> | |
75 | + <view | |
76 | + class="btn" | |
77 | + disabled="this.addDisabled" | |
78 | + type="default" | |
79 | + @tap="counter(index,false,item)" | |
80 | + >-</view> | |
81 | + <text>{{item.num}}</text> | |
82 | + <view | |
83 | + class="btn" | |
84 | + disabled="this.desDisabled" | |
85 | + type="default" | |
86 | + @tap="counter(index,true,item)" | |
87 | + >+</view> | |
88 | + </view> | |
89 | + </view> | |
90 | + </view> | |
91 | + </view> | |
92 | + </view> | |
93 | + </view> | |
94 | + </block> | |
95 | + <view class="footer"> | |
96 | + <view class="footerLeft">实付金额:<text>¥{{totalPrice}}</text></view> | |
97 | + <view class="footerRight"> | |
98 | + <navigator | |
99 | + url="/pages/confirmOrder/confirmOrder" | |
100 | + hover-class="navigator-hover" | |
101 | + > | |
102 | + <view class="paybtn">立即结算</view> | |
103 | + </navigator> | |
104 | + </view> | |
105 | + </view> | |
16 | 106 | |
17 | - <view class="cardBody" v-for="(item,index) in cartList" :key="index" | |
18 | - @longpress="delCart(item.cart_id,index)"> | |
19 | - <view v-bind:class="childIsOpen[index]? 'partentChecked':'partentCheck'" | |
20 | - @tap="Change(childIsOpen[index],index)"> | |
21 | - <span class="correct"></span> | |
22 | - </view> | |
23 | - <view class="imageWrap"> | |
24 | - <image :src="item.img_index_url" mode="aspectFit" style="width: 188rpx;height: 168rpx;"></image> | |
25 | - </view> | |
26 | - <view class="goodInfo"> | |
27 | -<!-- <view class="imageWrap"> | |
28 | - <image :src="item.img_index_url" mode="aspectFit" style="width: 188rpx;height: 168rpx;"></image> | |
29 | - </view> --> | |
30 | - <view class="infoRight"> | |
31 | - <view class="goodName" @tap="toGoods(item.pid,item.sk_id)">{{item.p_name}}</view> | |
32 | - <!-- <view class="describ"> --> | |
33 | - <uni-collapse accordion="true" style="justify-content: space-around;width: 196px;"> | |
34 | - <uni-collapse-item showAnimation='true' | |
35 | - :title="item.tag.prod_tag_fun[0].label&&item.tag.prod_tag_fun[1].label?item.tag.prod_tag_fun[0].label+'/'+item.tag.prod_tag_fun[1].label+'...':'暂无数据'" > | |
36 | - <text class="describ"> | |
37 | - <block v-for="tag in item.tag.prod_tag_fun" :key="tag.value"> | |
38 | - {{tag.label+` `}} | |
39 | - </block> | |
40 | - </text> | |
41 | -<!-- <text> | |
42 | - <block v-for="tag in item.tag.prod_tag_style" :key="tag.value"> | |
43 | - {{tag.label+` `}} | |
44 | - </block> | |
45 | - </text> --> | |
46 | - </uni-collapse-item> | |
47 | - </uni-collapse> | |
48 | - <!-- <view v-bind:class="collapseList[index]? 'icon':'iconed'"></view> --> | |
49 | - <!-- </view> --> | |
50 | - <view class="priceBox"> | |
51 | - <view class="price">¥{{item.nowPrice*item.num}}</view> | |
52 | - <text class="maxCount">(限购{{maxCount}}副)</text> | |
53 | - <view class="counter"> | |
54 | - <view class="btn" disabled="this.addDisabled" type="default" | |
55 | - @tap="counter(index,false,item)">-</view> | |
56 | - <text>{{item.num}}</text> | |
57 | - <view class="btn" disabled="this.desDisabled" type="default" | |
58 | - @tap="counter(index,true,item)">+</view> | |
59 | - </view> | |
60 | - </view> | |
61 | - </view> | |
62 | - </view> | |
63 | - </view> | |
64 | - </view> | |
65 | - </block> | |
66 | - <view class="footer"> | |
67 | - <view class="footerLeft">实付金额:<text>¥{{totalPrice}}</text></view> | |
68 | - <view class="footerRight"> | |
69 | - <navigator url="/pages/confirmOrder/confirmOrder" hover-class="navigator-hover"> | |
70 | - <view class="paybtn" >立即结算</view> | |
71 | - </navigator> | |
72 | - </view> | |
73 | - </view> | |
74 | - | |
75 | - </view> | |
107 | + </view> | |
76 | 108 | </template> |
77 | 109 | |
78 | 110 | <script> |
... | ... | @@ -87,13 +119,14 @@ export default { |
87 | 119 | totalPrice: 0, |
88 | 120 | pIsoPen: false, |
89 | 121 | // childIsOpen:[], |
90 | - maxCount: 20 | |
122 | + maxCount: 20, | |
91 | 123 | } |
92 | 124 | }, |
93 | 125 | computed: { |
94 | 126 | |
95 | 127 | cartList() { |
96 | 128 | // console.log('cart-list', this.$store.state.cart.cartList); |
129 | + this.totalPrice=0 | |
97 | 130 | return this.$store.state.cart.cartList |
98 | 131 | }, |
99 | 132 | childIsOpen() { |
... | ... | @@ -104,65 +137,62 @@ export default { |
104 | 137 | } |
105 | 138 | console.log('this.childisOPne===>', temp) |
106 | 139 | return temp |
107 | - } | |
140 | + }, | |
108 | 141 | }, |
109 | 142 | onLoad: function() { |
110 | - // store.dispatch('cart/addCart', { | |
111 | - // uid: this.$store.state.user.userInfo.uid, | |
112 | - // openid: this.$store.state.user.userInfo.openid, | |
113 | - // mp_id: 7, | |
114 | - // sk_id: 7, | |
115 | - // num: 1, | |
116 | - // pid: 8, | |
117 | - // price: 128, | |
118 | - // checkedSKU:{}, | |
119 | - // }) | |
143 | + // store.dispatch('cart/addCart', { | |
144 | + // uid: this.$store.state.user.userInfo.uid, | |
145 | + // openid: this.$store.state.user.userInfo.openid, | |
146 | + // mp_id: 7, | |
147 | + // sk_id: 7, | |
148 | + // num: 1, | |
149 | + // pid: 8, | |
150 | + // price: 128, | |
151 | + // checkedSKU:{}, | |
152 | + // }) | |
120 | 153 | store.dispatch('cart/getCartList', { |
121 | - uid: this.$store.state.user.userInfo.uid // 用户id | |
154 | + uid: this.$store.state.user.userInfo.uid, // 用户id | |
122 | 155 | }) |
123 | 156 | }, |
124 | - | |
125 | 157 | methods: { |
126 | - | |
127 | 158 | toGoods(id, sk_id) { |
128 | - console.log('cart-list', this.$store.state.cart.cartList); | |
129 | - console.log('---', '../frameDetail/frameDetail?pid=' + id +'&sk_id='+sk_id) | |
130 | - uni.navigateTo({ | |
131 | - url: '../frameDetail/frameDetail?pid=' + id+'&sk_id='+sk_id, | |
132 | - success: res => {}, | |
133 | - fail: () => {}, | |
134 | - complete: () => {} | |
135 | - }) | |
159 | + console.log('cart-list', this.$store.state.cart.cartList) | |
160 | + console.log('---', '../frameDetail/frameDetail?pid=' + id + '&sk_id=' + sk_id) | |
161 | + uni.navigateTo({ | |
162 | + url: '../frameDetail/frameDetail?pid=' + id + '&sk_id=' + sk_id, | |
163 | + success: res => {}, | |
164 | + fail: () => {}, | |
165 | + complete: () => {}, | |
166 | + }) | |
136 | 167 | }, |
137 | - | |
138 | 168 | counter(index, isadd, item) { |
139 | 169 | // console.log('===>>counter ===>num',num) |
140 | 170 | // console.log('===>>counter ===>isadd',isadd) |
141 | - console.log('item=====>',item) | |
142 | - console.log('num=====>',item.num) | |
143 | - let nums = parseInt(item.num) | |
171 | + console.log('item=====>', item) | |
172 | + console.log('num=====>', item.num) | |
173 | + const nums = parseInt(item.num) | |
144 | 174 | if (isadd) { |
145 | 175 | if (nums >= this.maxCount) { |
146 | 176 | this.addDisabled = true |
147 | 177 | } else { |
148 | 178 | this.addDisabled = true |
149 | 179 | // 修改num |
150 | - if (this.childIsOpen[index]) { | |
151 | - this.totalPrice = this.totalPrice + this.$store.state.cart.cartList[index].nowPrice | |
152 | - } | |
180 | + if (this.childIsOpen[index]) { | |
181 | + this.totalPrice = this.totalPrice + this.$store.state.cart.cartList[index].nowPrice | |
182 | + } | |
153 | 183 | store.dispatch('cart/modiCart', { |
154 | 184 | uid: this.$store.state.user.userInfo.uid, |
155 | 185 | openid: this.$store.state.user.userInfo.openid, |
156 | 186 | mp_id: item.mp_id, |
157 | 187 | sk_id: item.sk_id, |
158 | - price: item.nowPrice, | |
159 | - pid: item.pid, | |
188 | + price: item.nowPrice, | |
189 | + pid: item.pid, | |
160 | 190 | num: nums + 1, |
161 | - cart_id: item.cart_id, | |
191 | + cart_id: item.cart_id, | |
162 | 192 | args: { |
163 | 193 | index: index, |
164 | - isadd: isadd | |
165 | - } | |
194 | + isadd: isadd, | |
195 | + }, | |
166 | 196 | }) |
167 | 197 | this.addDisabled = false |
168 | 198 | } |
... | ... | @@ -172,31 +202,30 @@ export default { |
172 | 202 | } else { |
173 | 203 | this.desDisabled = false |
174 | 204 | // post 请求修改相关参数 |
175 | - if (this.childIsOpen[index]) { | |
176 | - this.totalPrice = this.totalPrice - this.$store.state.cart.cartList[index].nowPrice | |
177 | - } | |
205 | + if (this.childIsOpen[index]) { | |
206 | + this.totalPrice = this.totalPrice - this.$store.state.cart.cartList[index].nowPrice | |
207 | + } | |
178 | 208 | store.dispatch('cart/modiCart', { |
179 | 209 | uid: this.$store.state.user.userInfo.uid, |
180 | 210 | openid: this.$store.state.user.userInfo.openid, |
181 | 211 | mp_id: item.mp_id, |
182 | 212 | sk_id: item.sk_id, |
183 | - price: item.nowPrice, | |
184 | - pid: item.pid, | |
213 | + price: item.nowPrice, | |
214 | + pid: item.pid, | |
185 | 215 | num: nums - 1, |
186 | - cart_id: item.cart_id, | |
216 | + cart_id: item.cart_id, | |
187 | 217 | args: { |
188 | 218 | index: index, |
189 | - isadd: isadd | |
190 | - } | |
219 | + isadd: isadd, | |
220 | + }, | |
191 | 221 | }) |
192 | 222 | this.desDisabled = true |
193 | 223 | } |
194 | 224 | } |
195 | - // store.dispatch('cart/getCartList', { | |
196 | - // uid: this.$store.state.user.userInfo.uid // 用户id | |
197 | - // }) | |
225 | + // store.dispatch('cart/getCartList', { | |
226 | + // uid: this.$store.state.user.userInfo.uid // 用户id | |
227 | + // }) | |
198 | 228 | }, |
199 | - | |
200 | 229 | Change(isopen, indexC) { |
201 | 230 | // console.log('lalla===>',isopen) |
202 | 231 | this.childIsOpen[indexC] = !isopen |
... | ... | @@ -209,7 +238,7 @@ export default { |
209 | 238 | for (let i = 0; i < this.childIsOpen.length; i++) { |
210 | 239 | m = m & this.childIsOpen[i] |
211 | 240 | } |
212 | - if (m == 1) { | |
241 | + if (m === 1) { | |
213 | 242 | this.pIsoPen = true |
214 | 243 | } else { |
215 | 244 | this.pIsoPen = false |
... | ... | @@ -222,7 +251,7 @@ export default { |
222 | 251 | } |
223 | 252 | if (this.pIsoPen) { |
224 | 253 | // 计算总价逻辑 |
225 | - if (this.childIsOpen.length != 0) { | |
254 | + if (this.childIsOpen.length !== 0) { | |
226 | 255 | for (let i = 0; i < this.childIsOpen.length; i++) { |
227 | 256 | if (this.childIsOpen[i]) { |
228 | 257 | this.totalPrice = this.totalPrice + (this.$store.state.cart.cartList[i].num * this.$store.state.cart.cartList[i].nowPrice) |
... | ... | @@ -239,273 +268,270 @@ export default { |
239 | 268 | // console.log('delcart------>cart_id',cart_id) |
240 | 269 | // console.log('cartlist====>delcart',this.$store.state.cart.cartList) |
241 | 270 | // console.log('delcart======>index',index) |
242 | - const uid=this.$store.state.user.userInfo.uid | |
243 | - const openid=this.$store.state.user.userInfo.openid | |
244 | - uni.showModal({ | |
245 | - title: '是否删除该商品', | |
246 | - // content: '是否删除该商品', | |
247 | - success: function (res) { | |
248 | - if (res.confirm) { | |
249 | - // this.$store.state.cart.cartList.splice(index,1) | |
250 | - store.dispatch('cart/delCart', { | |
251 | - uid: uid, | |
252 | - openid: openid, | |
253 | - cart_id: cart_id, // 要修改的购物车id | |
254 | - arg: index // 由于action 传参是能接收两参数,因此将index放入对象 | |
255 | - }) | |
256 | - console.log('用户点击确定') | |
257 | - } | |
258 | - } | |
259 | - }) | |
260 | - } | |
261 | - } | |
271 | + uni.showModal({ | |
272 | + title: '是否删除该商品', | |
273 | + // content: '是否删除该商品', | |
274 | + success: function (res) { | |
275 | + if (res.confirm) { | |
276 | + if (this.childIsOpen[index]) { | |
277 | + this.totalPrice = this.totalPrice - (this.$store.state.cart.cartList[index].nowPrice*this.$store.state.cart.cartList[index].num) | |
278 | + } | |
279 | + console.log('index===>',index) | |
280 | + store.dispatch('cart/delCart', { | |
281 | + uid: this.$store.state.user.userInfo.uid, | |
282 | + openid: this.$store.state.user.userInfo.openid, | |
283 | + cart_id: cart_id, // 要修改的购物车id | |
284 | + arg: index, // 由于action 传参是能接收两参数,因此将index放入对象 | |
285 | + }) | |
286 | + } | |
287 | + }.bind(this), | |
288 | + }) | |
289 | + }, | |
290 | + }, | |
262 | 291 | } |
263 | 292 | </script> |
264 | 293 | |
265 | 294 | <style lang="scss"> |
266 | 295 | .content { |
267 | - min-height: 100vh; | |
268 | - background-color: #f2f2f2; | |
269 | - display: flex; | |
270 | - flex-direction: column; | |
271 | - align-items: center; | |
272 | - justify-content: space-between; | |
273 | - padding: 20rpx 40rpx; | |
274 | - box-sizing: border-box; | |
296 | + min-height: 100vh; | |
297 | + background-color: #f2f2f2; | |
298 | + display: flex; | |
299 | + flex-direction: column; | |
300 | + align-items: center; | |
301 | + justify-content: space-between; | |
302 | + padding: 20rpx 40rpx; | |
303 | + box-sizing: border-box; | |
275 | 304 | |
276 | - .partentCheck{ | |
277 | - width: 16px; | |
278 | - height: 16px; | |
279 | - border-radius: 22px; | |
280 | - border: 1px solid #CFCFCF; | |
281 | - background-color: #FFFFFF; | |
282 | - margin: 6px; | |
283 | - } | |
284 | - .partentChecked{ | |
285 | - width: 18px; | |
286 | - height: 18px; | |
287 | - border-radius: 22px; | |
288 | - background-color: #FF6B4A; | |
289 | - margin: 6px; | |
290 | - .correct { | |
291 | - display: inline-block; | |
292 | - position: relative; | |
293 | - width: 10rpx; | |
294 | - height: 2rpx; | |
295 | - background: #FFFFFF; | |
296 | - line-height: 0; | |
297 | - font-size: 0; | |
298 | - position: relative; | |
299 | - top: -7px; | |
300 | - left: 4px; | |
301 | - -webkit-transform: rotate(45deg); | |
302 | - } | |
303 | - .correct:after { | |
304 | - content: '/'; | |
305 | - display: block; | |
306 | - width: 16rpx; | |
307 | - height: 2rpx; | |
308 | - background: #FFFFFF; | |
309 | - -webkit-transform: rotate(-90deg) translateY(50%) translateX(50%); | |
310 | - } | |
311 | - } | |
312 | - | |
313 | - .card{ | |
314 | - background-color: #FFFFFF; | |
315 | - border-radius: 16rpx; | |
316 | - box-sizing: border-box; | |
317 | - padding: 36rpx 36rpx 36rpx 18rpx; | |
318 | - display: flex; | |
319 | - flex-direction: column; | |
320 | - align-items: center; | |
321 | - justify-content: space-between; | |
322 | - margin-bottom: 180rpx; | |
323 | - .cardHeader{ | |
324 | - width: 100%; | |
325 | - height: 36rpx; | |
326 | - display: flex; | |
327 | - align-items: center; | |
328 | - justify-content: flex-start; | |
329 | - margin-bottom: 20rpx; | |
330 | - image{ | |
331 | - height: 32rpx; | |
332 | - width: 32rpx; | |
333 | - padding-left: 6px; | |
334 | - padding-right: 10px; | |
335 | - } | |
336 | - text{ | |
337 | - // font-family: PingFangSC-Regular; | |
338 | - font-size: 14px; | |
339 | - color: #333333; | |
340 | - letter-spacing: -0.26px; | |
341 | - } | |
342 | - } | |
343 | - .cardBody{ | |
344 | - width: 100%; | |
345 | - min-height: 300rpx; | |
346 | - display: flex; | |
347 | - align-items: center; | |
348 | - justify-content: space-between; | |
349 | - .goodInfo{ | |
350 | - width: 390rpx; | |
351 | - display: flex; | |
352 | - flex-direction: row; | |
353 | - justify-content: flex-start; | |
354 | - padding-left: 6px; | |
355 | - | |
356 | - .imageWrap{ | |
357 | - height: 188rpx; | |
358 | - width: 188rpx; | |
359 | - margin-right: 28rpx; | |
360 | - | |
361 | - image{ | |
362 | - border-radius: 4px; | |
363 | - height: 188rpx; | |
364 | - width: 188rpx; | |
365 | - } | |
366 | - } | |
367 | - .infoRight{ | |
368 | - display: flex; | |
369 | - flex-direction: column; | |
370 | - align-items: flex-start; | |
371 | - justify-content: space-between; | |
372 | - min-height: 240rpx; | |
373 | - .goodName{ | |
374 | - display: -webkit-box; | |
375 | - -webkit-box-orient: vertical; | |
376 | - -webkit-line-clamp: 2; | |
377 | - text-align: justify; | |
378 | - overflow: hidden; | |
379 | - font-size: 28rpx; | |
380 | - color: #333333; | |
381 | - } | |
382 | - .describ{ | |
383 | - width: 100%; | |
384 | - // min-height: 80rpx; | |
385 | - // box-sizing: border-box; | |
386 | - // padding: 10rpx; | |
387 | - font-size: 20rpx; | |
388 | - letter-spacing: -0.23px; | |
389 | - text-align: justify; | |
390 | - color: #999999; | |
391 | - // background: #F9F9F9; | |
392 | - // display: flex; | |
393 | - // justify-content: center; | |
394 | - // align-items: center; | |
395 | - // text{ | |
396 | - // text-overflow: -o-ellipsis-lastline; | |
397 | - // overflow: hidden; | |
398 | - // text-overflow: ellipsis; | |
399 | - // display: -webkit-box; | |
400 | - // -webkit-line-clamp: 2; | |
401 | - // line-clamp: 2; | |
402 | - // -webkit-box-orient: vertical; | |
403 | - // } | |
404 | - // .icon { | |
405 | - // width: 0; | |
406 | - // height: 0; | |
407 | - // border-left: 5px transparent; | |
408 | - // border-right: 5px transparent; | |
409 | - // border-top: 5px #979797; | |
410 | - // border-bottom: 0 transparent; | |
411 | - // border-style: solid; | |
412 | - // position: relative; | |
413 | - // margin-left: 10px; | |
414 | - // // transform: scaleY(-1); | |
415 | - // } | |
416 | - // .icon::after{ | |
417 | - // content: ''; | |
418 | - // position: absolute; | |
419 | - // top: -6.5px; | |
420 | - // left: -5px; | |
421 | - // border-left: 5px transparent; | |
422 | - // border-right: 5px transparent; | |
423 | - // border-top: 5px #FFFFFF; | |
424 | - // border-bottom: 0 transparent; | |
425 | - // border-style: solid; | |
426 | - // } | |
427 | - } | |
428 | - .priceBox{ | |
429 | - display: flex; | |
430 | - justify-content: space-between; | |
431 | - align-items: center; | |
432 | - // margin-top: 26px; | |
433 | - width: 100%; | |
434 | - font-size: 14px; | |
435 | - color: #999999; | |
436 | - .maxCount{ | |
437 | - color: #999999; | |
438 | - font-size: 24rpx; | |
439 | - } | |
440 | - .price{ | |
441 | - color: #FF6B4A; | |
442 | - font-size: 28rpx; | |
443 | - } | |
444 | - .counter{ | |
445 | - display: flex; | |
446 | - flex-direction: row; | |
447 | - justify-content: space-between; | |
448 | - align-items: center; | |
449 | - font-size: 28rpx; | |
450 | - color: #333333; | |
451 | - width: 122rpx; | |
452 | - .btn{ | |
453 | - display: flex; | |
454 | - justify-content: center; | |
455 | - line-height: 32rpx; | |
456 | - height: 32rpx; | |
457 | - width: 32rpx; | |
458 | - background-color: #F2F2F2; | |
459 | - color: #CFCFCF; | |
460 | - } | |
461 | - } | |
462 | - } | |
463 | - } | |
464 | - } | |
465 | - } | |
466 | - } | |
305 | + .partentCheck { | |
306 | + width: 16px; | |
307 | + height: 16px; | |
308 | + border-radius: 22px; | |
309 | + border: 1px solid #cfcfcf; | |
310 | + background-color: #ffffff; | |
311 | + margin: 24rpx 12rpx 24rpx 24rpx; | |
312 | + } | |
313 | + .partentChecked { | |
314 | + width: 18px; | |
315 | + height: 18px; | |
316 | + border-radius: 22px; | |
317 | + background-color: #ff6b4a; | |
318 | + margin: 24rpx 12rpx 24rpx 24rpx; | |
319 | + .correct { | |
320 | + display: inline-block; | |
321 | + position: relative; | |
322 | + width: 10rpx; | |
323 | + height: 2rpx; | |
324 | + background: #ffffff; | |
325 | + line-height: 0; | |
326 | + font-size: 0; | |
327 | + position: relative; | |
328 | + top: -7px; | |
329 | + left: 4px; | |
330 | + -webkit-transform: rotate(45deg); | |
331 | + } | |
332 | + .correct:after { | |
333 | + content: "/"; | |
334 | + display: block; | |
335 | + width: 16rpx; | |
336 | + height: 2rpx; | |
337 | + background: #ffffff; | |
338 | + -webkit-transform: rotate(-90deg) translateY(50%) translateX(50%); | |
339 | + } | |
340 | + } | |
467 | 341 | |
468 | - .footer{ | |
469 | - position: fixed; | |
470 | - left: 0; | |
471 | - bottom: 0px; | |
472 | - height: 112rpx; | |
473 | - width: 100%; | |
474 | - background-color: #FFFFFF; | |
475 | - font-size: 16px; | |
476 | - display: flex; | |
477 | - justify-content: space-between; | |
478 | - align-items: center; | |
479 | - .footerLeft{ | |
480 | - display: flex; | |
481 | - justify-content: center; | |
482 | - align-items: center; | |
483 | - width: 50%; | |
484 | - color: #333333; | |
485 | - text{ | |
486 | - color: #FF6B4A; | |
487 | - } | |
488 | - } | |
489 | - .footerRight{ | |
490 | - display: flex; | |
491 | - justify-content: flex-end; | |
492 | - align-items: center; | |
493 | - width: 50%; | |
494 | - margin-right: 26rpx; | |
495 | - .paybtn{ | |
496 | - display: flex; | |
497 | - justify-content: center; | |
498 | - align-items: center; | |
499 | - background: #FF6B4A; | |
500 | - border-radius: 20px; | |
501 | - border-radius: 20px; | |
502 | - color: #FFFFFF; | |
503 | - width: 204rpx; | |
504 | - height: 80rpx; | |
505 | - } | |
506 | - } | |
342 | + .card { | |
343 | + background-color: #ffffff; | |
344 | + border-radius: 16rpx; | |
345 | + box-sizing: border-box; | |
346 | + padding: 36rpx 36rpx 36rpx 18rpx; | |
347 | + display: flex; | |
348 | + flex-direction: column; | |
349 | + align-items: center; | |
350 | + justify-content: space-between; | |
351 | + margin-bottom: 180rpx; | |
352 | + .cardHeader { | |
353 | + width: 100%; | |
354 | + height: 36rpx; | |
355 | + display: flex; | |
356 | + align-items: center; | |
357 | + justify-content: flex-start; | |
358 | + margin-bottom: 20rpx; | |
359 | + image { | |
360 | + height: 32rpx; | |
361 | + width: 32rpx; | |
362 | + padding-left: 6px; | |
363 | + padding-right: 10px; | |
364 | + } | |
365 | + text { | |
366 | + // font-family: PingFangSC-Regular; | |
367 | + font-size: 14px; | |
368 | + color: #333333; | |
369 | + letter-spacing: -0.26px; | |
370 | + } | |
371 | + } | |
372 | + .cardBody { | |
373 | + width: 100%; | |
374 | + min-height: 300rpx; | |
375 | + display: flex; | |
376 | + align-items: center; | |
377 | + justify-content: space-between; | |
378 | + .goodInfo { | |
379 | + width: 390rpx; | |
380 | + display: flex; | |
381 | + flex-direction: row; | |
382 | + justify-content: flex-start; | |
383 | + padding-left: 6px; | |
507 | 384 | |
508 | - } | |
509 | - } | |
385 | + .imageWrap { | |
386 | + height: 188rpx; | |
387 | + width: 188rpx; | |
388 | + margin-right: 28rpx; | |
510 | 389 | |
511 | -</style> | |
512 | 390 | \ No newline at end of file |
391 | + image { | |
392 | + border-radius: 4px; | |
393 | + height: 188rpx; | |
394 | + width: 188rpx; | |
395 | + } | |
396 | + } | |
397 | + .infoRight { | |
398 | + display: flex; | |
399 | + flex-direction: column; | |
400 | + align-items: flex-start; | |
401 | + justify-content: space-between; | |
402 | + min-height: 240rpx; | |
403 | + .goodName { | |
404 | + display: -webkit-box; | |
405 | + -webkit-box-orient: vertical; | |
406 | + -webkit-line-clamp: 2; | |
407 | + text-align: justify; | |
408 | + overflow: hidden; | |
409 | + font-size: 28rpx; | |
410 | + color: #333333; | |
411 | + } | |
412 | + .describ { | |
413 | + width: 100%; | |
414 | + // min-height: 80rpx; | |
415 | + // box-sizing: border-box; | |
416 | + // padding: 10rpx; | |
417 | + font-size: 20rpx; | |
418 | + letter-spacing: -0.23px; | |
419 | + text-align: justify; | |
420 | + color: #999999; | |
421 | + // background: #F9F9F9; | |
422 | + // display: flex; | |
423 | + // justify-content: center; | |
424 | + // align-items: center; | |
425 | + // text{ | |
426 | + // text-overflow: -o-ellipsis-lastline; | |
427 | + // overflow: hidden; | |
428 | + // text-overflow: ellipsis; | |
429 | + // display: -webkit-box; | |
430 | + // -webkit-line-clamp: 2; | |
431 | + // line-clamp: 2; | |
432 | + // -webkit-box-orient: vertical; | |
433 | + // } | |
434 | + // .icon { | |
435 | + // width: 0; | |
436 | + // height: 0; | |
437 | + // border-left: 5px transparent; | |
438 | + // border-right: 5px transparent; | |
439 | + // border-top: 5px #979797; | |
440 | + // border-bottom: 0 transparent; | |
441 | + // border-style: solid; | |
442 | + // position: relative; | |
443 | + // margin-left: 10px; | |
444 | + // // transform: scaleY(-1); | |
445 | + // } | |
446 | + // .icon::after{ | |
447 | + // content: ''; | |
448 | + // position: absolute; | |
449 | + // top: -6.5px; | |
450 | + // left: -5px; | |
451 | + // border-left: 5px transparent; | |
452 | + // border-right: 5px transparent; | |
453 | + // border-top: 5px #FFFFFF; | |
454 | + // border-bottom: 0 transparent; | |
455 | + // border-style: solid; | |
456 | + // } | |
457 | + } | |
458 | + .priceBox { | |
459 | + display: flex; | |
460 | + justify-content: space-between; | |
461 | + align-items: center; | |
462 | + // margin-top: 26px; | |
463 | + width: 100%; | |
464 | + font-size: 14px; | |
465 | + color: #999999; | |
466 | + .maxCount { | |
467 | + color: #999999; | |
468 | + font-size: 24rpx; | |
469 | + } | |
470 | + .price { | |
471 | + color: #ff6b4a; | |
472 | + font-size: 28rpx; | |
473 | + } | |
474 | + .counter { | |
475 | + display: flex; | |
476 | + flex-direction: row; | |
477 | + justify-content: space-between; | |
478 | + align-items: center; | |
479 | + font-size: 28rpx; | |
480 | + color: #333333; | |
481 | + width: 122rpx; | |
482 | + .btn { | |
483 | + display: flex; | |
484 | + justify-content: center; | |
485 | + line-height: 32rpx; | |
486 | + height: 32rpx; | |
487 | + width: 32rpx; | |
488 | + background-color: #f2f2f2; | |
489 | + color: #cfcfcf; | |
490 | + } | |
491 | + } | |
492 | + } | |
493 | + } | |
494 | + } | |
495 | + } | |
496 | + } | |
497 | + .footer { | |
498 | + position: fixed; | |
499 | + left: 0; | |
500 | + bottom: 0px; | |
501 | + height: 112rpx; | |
502 | + width: 100%; | |
503 | + background-color: #ffffff; | |
504 | + font-size: 16px; | |
505 | + display: flex; | |
506 | + justify-content: space-between; | |
507 | + align-items: center; | |
508 | + .footerLeft { | |
509 | + display: flex; | |
510 | + justify-content: center; | |
511 | + align-items: center; | |
512 | + width: 50%; | |
513 | + color: #333333; | |
514 | + text { | |
515 | + color: #ff6b4a; | |
516 | + } | |
517 | + } | |
518 | + .footerRight { | |
519 | + display: flex; | |
520 | + justify-content: flex-end; | |
521 | + align-items: center; | |
522 | + width: 50%; | |
523 | + margin-right: 26rpx; | |
524 | + .paybtn { | |
525 | + display: flex; | |
526 | + justify-content: center; | |
527 | + align-items: center; | |
528 | + background: #ff6b4a; | |
529 | + border-radius: 20px; | |
530 | + border-radius: 20px; | |
531 | + color: #ffffff; | |
532 | + width: 204rpx; | |
533 | + height: 80rpx; | |
534 | + } | |
535 | + } | |
536 | + } | |
537 | +} | |
538 | +</style> | ... | ... |
src/pages/confirmOrder/confirmOrder.vue
... | ... | @@ -39,6 +39,7 @@ |
39 | 39 | <image |
40 | 40 | class="arrow" |
41 | 41 | src="../../static/right.png" |
42 | + mode="aspectFill" | |
42 | 43 | ></image> |
43 | 44 | </view> |
44 | 45 | <view class="content"> |
... | ... | @@ -108,7 +109,7 @@ |
108 | 109 | <view class="rightText"> |
109 | 110 | <view class="choosePayWay"> |
110 | 111 | <image |
111 | - src="../../static/store.png" | |
112 | + src="../../static/chat_logo.png" | |
112 | 113 | mode="aspectFill" |
113 | 114 | ></image> |
114 | 115 | <text>微信支付</text> |
... | ... | @@ -158,6 +159,7 @@ |
158 | 159 | </checkbox-group> |
159 | 160 | </view> --> |
160 | 161 | </view> |
162 | + <view class="last_zhanwei"></view> | |
161 | 163 | <view class="footer"> |
162 | 164 | <view class="footerLeft">实付金额:<text>¥{{Number(skuInfo.real_price) * count}}</text></view> |
163 | 165 | <view class="footerRight"> |
... | ... | @@ -171,73 +173,74 @@ |
171 | 173 | </template> |
172 | 174 | |
173 | 175 | <script> |
174 | -import store from "@/store"; | |
176 | +import store from '@/store' | |
177 | +import MD5Util from '../../utils/md5' | |
175 | 178 | |
176 | 179 | export default { |
177 | 180 | data() { |
178 | 181 | return { |
179 | - addAddress: "添加收货地址", | |
182 | + addAddress: '添加收货地址', | |
180 | 183 | count: 1, |
181 | 184 | pid: 0, |
182 | 185 | disabled: false, |
183 | 186 | freight: 0.0, |
184 | 187 | showAddress: false, |
185 | - note: "", | |
188 | + note: '', | |
186 | 189 | addressInfo: { |
187 | - address: "" | |
188 | - } | |
190 | + address: '', | |
191 | + }, | |
189 | 192 | // isAnonymous: |
190 | - }; | |
193 | + } | |
191 | 194 | }, |
192 | 195 | onLoad({ pid, addressId, isCart }) { |
193 | - this.pid = pid; | |
196 | + this.pid = pid | |
194 | 197 | // 若已经选择地址 |
195 | 198 | if (addressId) { |
196 | 199 | store |
197 | - .dispatch("address/details", { | |
198 | - add_id: addressId | |
200 | + .dispatch('address/details', { | |
201 | + add_id: addressId, | |
199 | 202 | }) |
200 | 203 | .then(({ code, data }) => { |
201 | 204 | if (code === 1) { |
202 | - console.log("code", code, data); | |
203 | - this.showAddress = true; | |
204 | - this.addressInfo = data; | |
205 | + console.log('code', code, data) | |
206 | + this.showAddress = true | |
207 | + this.addressInfo = data | |
205 | 208 | } |
206 | - }); | |
209 | + }) | |
207 | 210 | } else { |
208 | - store.dispatch("address/default").then(({ code, data }) => { | |
211 | + store.dispatch('address/default').then(({ code, data }) => { | |
209 | 212 | if (code === 1) { |
210 | - console.log("code", code, data); | |
211 | - this.showAddress = true; | |
212 | - this.addressInfo = data; | |
213 | + console.log('code', code, data) | |
214 | + this.showAddress = true | |
215 | + this.addressInfo = data | |
213 | 216 | } |
214 | - }); | |
217 | + }) | |
215 | 218 | } |
216 | - store.dispatch("read/fetch", { | |
217 | - pid | |
218 | - }); | |
219 | + store.dispatch('read/fetch', { | |
220 | + pid, | |
221 | + }) | |
219 | 222 | }, |
220 | 223 | computed: { |
221 | 224 | goodInfo() { |
222 | - console.log("state", this.$store.state); | |
223 | - return this.$store.state.read.goodInfo; | |
225 | + console.log('state', this.$store.state) | |
226 | + return this.$store.state.read.goodInfo | |
224 | 227 | }, |
225 | 228 | skuInfo() { |
226 | - return this.$store.state.order.param.sk_id_arr; | |
229 | + return this.$store.state.order.param.sk_id_arr | |
227 | 230 | }, |
228 | 231 | attrList() { |
229 | - return this.$store.state.order.param.attrList; | |
232 | + return this.$store.state.order.param.attrList | |
230 | 233 | }, |
231 | 234 | current() { |
232 | - return this.$store.state.order.param.current; | |
233 | - } | |
235 | + return this.$store.state.order.param.current | |
236 | + }, | |
234 | 237 | }, |
235 | 238 | methods: { |
236 | 239 | counter(isadd) { |
237 | 240 | if (isadd) { |
238 | - this.count++; | |
241 | + this.count++ | |
239 | 242 | } else { |
240 | - this.count <= 1 ? (this.disabled = true) : this.count--; | |
243 | + this.count <= 1 ? (this.disabled = true) : this.count-- | |
241 | 244 | } |
242 | 245 | }, |
243 | 246 | // 跳转添加地址页面 |
... | ... | @@ -246,35 +249,39 @@ export default { |
246 | 249 | url: `../address/addressList?edit=${1}`, |
247 | 250 | success: res => {}, |
248 | 251 | fail: error => { |
249 | - console.log("跳转到地址列表页面失败====>", error); | |
252 | + console.log('跳转到地址列表页面失败====>', error) | |
250 | 253 | }, |
251 | - complete: () => {} | |
252 | - }); | |
254 | + complete: () => {}, | |
255 | + }) | |
253 | 256 | }, |
254 | 257 | // 下单 |
255 | 258 | orderBuild() { |
256 | - console.log("this", this.$store.state); | |
257 | - const { sk_id_arr: skId, mp_id: mpId } = this.$store.state.order.param; | |
258 | - store | |
259 | - .dispatch("order/buyNow", { | |
260 | - pid: skId.pid, | |
261 | - sk_id: skId.sk_id, | |
262 | - number: this.count, | |
263 | - mp_id: mpId, | |
264 | - address: JSON.stringify(this.addressInfo), | |
265 | - totalPrice: Number(this.skuInfo.real_price) * this.count * 100, | |
266 | - liuyan: this.note, | |
267 | - dir: 1 | |
268 | - }) | |
269 | - .then(res => { | |
270 | - this.pay(res.data); | |
271 | - }); | |
259 | + uni.showLoading({ | |
260 | + title: '支付中', | |
261 | + }) | |
262 | + console.log('this', this.$store.state) | |
263 | + const { sk_id_arr: skId, mp_id: mpId } = this.$store.state.order.param | |
264 | + store.dispatch('order/buyNow', { | |
265 | + pid: skId.pid, | |
266 | + sk_id: skId.sk_id, | |
267 | + number: this.count, | |
268 | + mp_id: mpId, | |
269 | + address: JSON.stringify(this.addressInfo), | |
270 | + totalPrice: Number(this.skuInfo.real_price) * this.count * 100, | |
271 | + liuyan: this.note, | |
272 | + dir: 1, | |
273 | + }).then((res) => { | |
274 | + this.pay(res.data) | |
275 | + }) | |
272 | 276 | }, |
273 | 277 | // 支付 |
274 | 278 | pay(res) { |
275 | - console.log("pay", res); | |
276 | - const { data, exKeyName: keyName } = res; | |
277 | - const uid = uni.getStorageSync("uid"); | |
279 | + console.log('pay', res) | |
280 | + const { data, exKeyName: keyName } = res | |
281 | + const uid = uni.getStorageSync('uid') | |
282 | + const timeStamp = new Date().getTime().toString() | |
283 | + const nonceStr = 'asfafasfasfasfasf' | |
284 | + // 支付参数 | |
278 | 285 | const fieldSet = { |
279 | 286 | openid: this.$store.state.user.userInfo.openid, |
280 | 287 | uid: this.$store.state.user.userInfo.uid, |
... | ... | @@ -282,20 +289,67 @@ export default { |
282 | 289 | payCate: 2020, |
283 | 290 | payMoney: Number(this.skuInfo.real_price) * this.count * 100, |
284 | 291 | payWoodId: `fcdj-${uid}-${keyName}`, |
285 | - nonceStr: "asfafasfasfasfasf", | |
286 | - signType: "MD5", | |
292 | + payWoodDesc: '在【非常戴镜】的微信付款凭证', | |
293 | + nonceStr, | |
294 | + signType: 'MD5', | |
287 | 295 | app_uid: 2020, |
288 | - timeStamp: new Date().getTime().toString(), | |
296 | + timeStamp, | |
297 | + keyname: keyName, | |
289 | 298 | billInfo: JSON.stringify(data), |
290 | - keyname: keyName | |
291 | - }; | |
292 | - console.log("fieldSet", fieldSet); | |
293 | - store.dispatch("order/pay", fieldSet).then(res => { | |
294 | - console.log("res", res); | |
295 | - }); | |
296 | - } | |
297 | - } | |
298 | -}; | |
299 | + } | |
300 | + // 请求后台支付接口 | |
301 | + store.dispatch('order/pay', fieldSet).then(({ data, data2, pay_id: payId }) => { | |
302 | + if (data.return_code === 'SUCCESS' && data.result_code === 'SUCCESS') { | |
303 | + const stringA = `appId=wx115b25aa396d27ac&nonceStr=${nonceStr}&package=prepay_id=${data.prepay_id}&signType=MD5&timeStamp=${timeStamp}` | |
304 | + const stringSignTemp = stringA + '&key=NewMoney2017hatemydaddy123456789' | |
305 | + | |
306 | + // 微信支付接口 | |
307 | + uni.requestPayment({ | |
308 | + appId: data.appid, | |
309 | + timeStamp, | |
310 | + nonceStr, | |
311 | + total_fee: Number(this.skuInfo.real_price) * this.count * 100, | |
312 | + package: `prepay_id=${data.prepay_id}`, | |
313 | + signType: 'MD5', | |
314 | + paySign: MD5Util.MD5(stringSignTemp).toUpperCase(), | |
315 | + success: (res) => { | |
316 | + // 支付成功 | |
317 | + uni.showModal({ | |
318 | + content: '支付成功', | |
319 | + showCancel: false, | |
320 | + }) | |
321 | + // 跳转订单详情页->状态 待收货 | |
322 | + uni.reLaunch({ | |
323 | + url: `../myOrderPaying/myOrderPaying?payId=${payId}&state=1&ispay=1`, | |
324 | + }) | |
325 | + }, | |
326 | + fail: (res) => { | |
327 | + // 支付失败 | |
328 | + uni.showModal({ | |
329 | + content: '支付失败', | |
330 | + showCancel: false, | |
331 | + }) | |
332 | + // 跳转订单详情页->状态 待付款 | |
333 | + uni.reLaunch({ | |
334 | + url: `../myOrderPaying/myOrderPaying?payId=${payId}&state=0&ispay=1`, | |
335 | + }) | |
336 | + }, | |
337 | + complete: () => { | |
338 | + uni.hideLoading() | |
339 | + }, | |
340 | + }) | |
341 | + } else { | |
342 | + uni.showModal({ | |
343 | + content: '支付失败', | |
344 | + showCancel: false, | |
345 | + }) | |
346 | + console.log('支付失败') | |
347 | + uni.hideLoading() | |
348 | + } | |
349 | + }) | |
350 | + }, | |
351 | + }, | |
352 | +} | |
299 | 353 | </script> |
300 | 354 | |
301 | 355 | <style lang="scss"> |
... | ... | @@ -326,7 +380,7 @@ export default { |
326 | 380 | } |
327 | 381 | image { |
328 | 382 | height: 28rpx; |
329 | - width: 28rpx; | |
383 | + width: 30rpx; | |
330 | 384 | } |
331 | 385 | .addressText { |
332 | 386 | font-size: 28rpx; |
... | ... | @@ -484,13 +538,15 @@ export default { |
484 | 538 | margin-right: 20rpx; |
485 | 539 | text-align: right; |
486 | 540 | .choosePayWay { |
541 | + display: flex; | |
542 | + align-items: center; | |
487 | 543 | text { |
488 | 544 | color: #333333; |
489 | 545 | } |
490 | 546 | image { |
491 | - height: 26rpx; | |
492 | - width: 30rpx; | |
493 | - margin-right: 20px; | |
547 | + height: 36rpx; | |
548 | + width: 40rpx; | |
549 | + margin-right: 8px; | |
494 | 550 | } |
495 | 551 | } |
496 | 552 | .randomSubstraction { |
... | ... | @@ -590,6 +646,9 @@ export default { |
590 | 646 | text-align: center; |
591 | 647 | margin-right: 20rpx; |
592 | 648 | text { |
649 | + display: flex; | |
650 | + justify-content: center; | |
651 | + align-items: center; | |
593 | 652 | font-size: 12px; |
594 | 653 | color: #ffffff; |
595 | 654 | letter-spacing: -0.23px; |
... | ... | @@ -607,7 +666,7 @@ export default { |
607 | 666 | width: 100%; |
608 | 667 | image { |
609 | 668 | width: 24px; |
610 | - height: 26px; | |
669 | + height: 28px; | |
611 | 670 | margin: 12rpx 32rpx 0 40rpx; |
612 | 671 | } |
613 | 672 | .address { |
... | ... | @@ -618,11 +677,15 @@ export default { |
618 | 677 | } |
619 | 678 | } |
620 | 679 | .arrow { |
621 | - width: 6px; | |
680 | + width: 12px; | |
622 | 681 | height: 12px; |
623 | 682 | position: absolute; |
624 | 683 | right: 40rpx; |
625 | 684 | bottom: 104rpx; |
626 | 685 | } |
627 | 686 | } |
687 | +.last_zhanwei{ | |
688 | + background: #f2f2f2; | |
689 | + height: 60px; | |
690 | +} | |
628 | 691 | </style> | ... | ... |
src/pages/frameDetail/frameDetail.vue
... | ... | @@ -308,7 +308,10 @@ |
308 | 308 | @tap="toCart()" |
309 | 309 | class="botton_1" |
310 | 310 | > |
311 | - <image v-bind:src="imgShop.img"></image> | |
311 | + <view class="cart_icon"> | |
312 | + <image v-bind:src="imgShop.img"/> | |
313 | + <text>{{cartNumber}}</text> | |
314 | + </view> | |
312 | 315 | <view class="botton_image">购物车</view> |
313 | 316 | </view> |
314 | 317 | <view class="botton_2"> |
... | ... | @@ -381,12 +384,12 @@ export default { |
381 | 384 | }, |
382 | 385 | } |
383 | 386 | }, |
384 | - onLoad: function ({ pid, sk_id }) { | |
387 | + onLoad: function ({ pid, sk_id: skId }) { | |
385 | 388 | this.pid = pid |
386 | 389 | // console.log('sk_id=====>',sk_id) |
387 | 390 | store.dispatch('read/fetch', { |
388 | 391 | pid, |
389 | - sk_id, | |
392 | + sk_id: skId, | |
390 | 393 | }).then(() => { |
391 | 394 | this.parameter[0].slength = `${this.goodInfo.frame_width}mm` |
392 | 395 | this.parameter[1].slength = `${this.goodInfo.glass_width}mm` |
... | ... | @@ -396,12 +399,13 @@ export default { |
396 | 399 | this.parameter[5].slength = `${this.goodInfo.weight}mm` |
397 | 400 | this.tag = this.goodInfo.tag |
398 | 401 | this.test = this.goodInfo.prodIntro1 |
399 | - this.test = this.test.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ') | |
402 | + this.test = this.test.replace(/\<img/gi, '<img style="max-width:100%;height:auto"') | |
400 | 403 | // addCart |
401 | 404 | this.addCartList.price = this.goodInfo.priceArea.Min_Price |
402 | 405 | this.addCartList.sk_id = this.goodInfo.skuList[0].sk_id |
403 | 406 | this.addCartList.mp_id = this.goodInfo.glassData.mp_id |
404 | 407 | }) |
408 | + store.dispatch('cart/getCartList') | |
405 | 409 | // console.log(this.$store.state.user.userInfo.uid + 'ssss') |
406 | 410 | }, |
407 | 411 | computed: { |
... | ... | @@ -412,6 +416,9 @@ export default { |
412 | 416 | console.log(this.$store.state.read.goodInfo) |
413 | 417 | return this.$store.state.read.goodInfo |
414 | 418 | }, |
419 | + cartNumber() { | |
420 | + return this.$store.state.cart.cartList.length || 0 | |
421 | + }, | |
415 | 422 | }, |
416 | 423 | methods: { |
417 | 424 | // 前往购物车 |
... | ... | @@ -770,6 +777,26 @@ export default { |
770 | 777 | height: 100%; |
771 | 778 | text-align: center; |
772 | 779 | color: #989898; |
780 | + .cart_icon { | |
781 | + position: relative; | |
782 | + image { | |
783 | + | |
784 | + } | |
785 | + text { | |
786 | + position: absolute; | |
787 | + color: white; | |
788 | + font-size: 17px; | |
789 | + background-color: red; | |
790 | + min-height: 24px; | |
791 | + min-width:24px; | |
792 | + line-height: 24px; | |
793 | + right: -12%; | |
794 | + top: -12px; | |
795 | + text-align: center; | |
796 | + border-radius: 24px; | |
797 | + padding:2px; | |
798 | + } | |
799 | + } | |
773 | 800 | } |
774 | 801 | image { |
775 | 802 | width: 60%; | ... | ... |
src/pages/index/index.vue
... | ... | @@ -84,6 +84,12 @@ |
84 | 84 | data-format="Object" |
85 | 85 | ></HMfilterDropdown> |
86 | 86 | <!-- 商品列表 --> |
87 | + <!-- <scroll-view | |
88 | + enable-flex | |
89 | + @scrolltolower="handleScrolltolower" | |
90 | + scroll-y | |
91 | + style="height: 1000px;margin-bottom: 20px;" | |
92 | + > --> | |
87 | 93 | <view class="goods-list"> |
88 | 94 | <view class="product-list"> |
89 | 95 | <view |
... | ... | @@ -91,21 +97,26 @@ |
91 | 97 | v-for="(goods) in goodsList" |
92 | 98 | :key="goods.id" |
93 | 99 | > |
94 | - <Card :goods="goods"></Card> | |
100 | + <Card | |
101 | + :goods="goods" | |
102 | + :scrollTop="scrollTop" | |
103 | + :viewHeight="viewHeight" | |
104 | + ></Card> | |
95 | 105 | </view> |
96 | 106 | </view> |
97 | 107 | <view class="loading-text">{{loadingText}}</view> |
98 | 108 | </view> |
109 | + <!-- </scroll-view> --> | |
99 | 110 | </view> |
100 | 111 | </view> |
101 | 112 | </view> |
102 | 113 | </template> |
103 | 114 | |
104 | 115 | <script> |
105 | -import UniDrawer from '@/components/UniDrawer/UniDrawer.vue' | |
106 | -import Card from '@/components/CommodityCard/CommodityCard.vue' | |
107 | -import HMfilterDropdown from '@/components/HMFilterDropdown/HMFilterDropdown.vue' | |
108 | -import store from '@/store' | |
116 | +import UniDrawer from "@/components/UniDrawer/UniDrawer.vue"; | |
117 | +import Card from "@/components/CommodityCard/CommodityCard.vue"; | |
118 | +import HMfilterDropdown from "@/components/HMFilterDropdown/HMFilterDropdown.vue"; | |
119 | +import store from "@/store"; | |
109 | 120 | |
110 | 121 | export default { |
111 | 122 | components: { |
... | ... | @@ -113,104 +124,114 @@ export default { |
113 | 124 | HMfilterDropdown: HMfilterDropdown, |
114 | 125 | Card: Card |
115 | 126 | }, |
116 | - data () { | |
127 | + data() { | |
117 | 128 | return { |
118 | - indexArr: '', | |
119 | - valueArr: '', | |
120 | - loadingText: '~~到底了~~', | |
129 | + indexArr: "", | |
130 | + valueArr: "", | |
131 | + isLoading: true, //初始化加载状态 | |
132 | + loadingText: "~~一开始应该是加载中。。。。等数据传完后,更新为到底了~~", | |
121 | 133 | filterDropdownValue: [], |
122 | 134 | filterData: [], |
123 | - searchText: '' | |
124 | - } | |
135 | + searchText: "", | |
136 | + scrollTop: 0, | |
137 | + viewHeight: uni.getSystemInfoSync().windowHeight | |
138 | + }; | |
139 | + }, | |
140 | + onPageScroll({ scrollTop }) { | |
141 | + // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件 | |
142 | + | |
143 | + this.scrollTop = scrollTop; | |
144 | + console.log("pagescroll====>", this.viewHeight); | |
125 | 145 | }, |
126 | 146 | computed: { |
127 | - goodsList () { | |
147 | + goodsList() { | |
128 | 148 | // 也可以从 getters 获取 |
129 | - // console.log('index-list=====>',this.$store.state.index.list) | |
130 | - return this.$store.state.index.list | |
149 | + // console.log('index-list=====>',this.$store.state.index.list) | |
150 | + return this.$store.state.index.list; | |
131 | 151 | }, |
132 | - categoryList () { | |
133 | - return this.$store.state.index.categoryList | |
152 | + categoryList() { | |
153 | + return this.$store.state.index.categoryList; | |
134 | 154 | } |
135 | 155 | }, |
136 | 156 | filters: { |
137 | - outData (value) { | |
138 | - return JSON.stringify(value) | |
157 | + outData(value) { | |
158 | + return JSON.stringify(value); | |
139 | 159 | } |
140 | 160 | }, |
141 | - onLoad () { | |
142 | - store.dispatch('index/category') | |
161 | + onLoad() { | |
162 | + store.dispatch("index/category"); | |
143 | 163 | // this.getList(); |
144 | - store.dispatch('index/list') | |
164 | + store.dispatch("index/list"); | |
145 | 165 | }, |
146 | 166 | methods: { |
147 | - showDrawer (e) { | |
148 | - this.$refs[e].open() | |
167 | + showDrawer(e) { | |
168 | + this.$refs[e].open(); | |
149 | 169 | }, |
150 | - getList () { | |
151 | - store.dispatch('index/list') | |
170 | + getList() { | |
171 | + store.dispatch("index/list"); | |
152 | 172 | }, |
153 | 173 | // search(params) { |
154 | 174 | // this.$store.index. |
155 | 175 | // }, |
156 | - closeDrawer (e) { | |
157 | - this.$refs[e].close() | |
176 | + closeDrawer(e) { | |
177 | + this.$refs[e].close(); | |
158 | 178 | }, |
159 | - change (e, type) { | |
160 | - this[type] = e | |
179 | + change(e, type) { | |
180 | + this[type] = e; | |
161 | 181 | }, |
162 | - onClickItem (e) { | |
182 | + onClickItem(e) { | |
163 | 183 | if (this.current !== e) { |
164 | - this.current = e | |
184 | + this.current = e; | |
165 | 185 | } |
166 | 186 | }, |
167 | - dropDown () { | |
168 | - console.log('下拉') | |
187 | + dropDown() { | |
188 | + console.log("下拉"); | |
169 | 189 | }, |
170 | - searchKey (e) { | |
171 | - const { value: keyword } = e.detail | |
172 | - this.keyWords = keyword | |
173 | - store.dispatch('index/search', { | |
190 | + searchKey(e) { | |
191 | + const { value: keyword } = e.detail; | |
192 | + this.keyWords = keyword; | |
193 | + store.dispatch("index/search", { | |
174 | 194 | params: {}, |
175 | 195 | keyword |
176 | - }) | |
196 | + }); | |
177 | 197 | }, |
178 | 198 | // 接收菜单结果 |
179 | - search (e) { | |
180 | - const { on, value, selectedData } = e | |
181 | - let params = {} | |
182 | - const selectedPayload = {} | |
199 | + search(e) { | |
200 | + const { on, value, selectedData } = e; | |
201 | + let params = {}; | |
202 | + const selectedPayload = {}; | |
183 | 203 | for (const key in selectedData) { |
184 | 204 | if (Object.prototype.hasOwnProperty.call(selectedData, key)) { |
185 | - selectedPayload[key] = selectedData[key].toString() | |
205 | + selectedPayload[key] = selectedData[key].toString(); | |
186 | 206 | } |
187 | 207 | } |
188 | 208 | if (on[0] === 1) { |
189 | 209 | // 若点击全部 |
190 | - this.searchText = '' | |
191 | - store.dispatch('index/list') | |
210 | + this.searchText = ""; | |
211 | + store.dispatch("index/list"); | |
192 | 212 | } else { |
193 | - for (let i = 1; i <= on.length; i++) { // on[0]是全部 | |
194 | - if (on[i] === 1) { // 若该选项被选中 | |
195 | - if (this.categoryList[i].value === 'filter') { | |
213 | + for (let i = 1; i <= on.length; i++) { | |
214 | + // on[0]是全部 | |
215 | + if (on[i] === 1) { | |
216 | + // 若该选项被选中 | |
217 | + if (this.categoryList[i].value === "filter") { | |
196 | 218 | params = { |
197 | 219 | ...selectedPayload, |
198 | 220 | ...params |
199 | - } | |
221 | + }; | |
200 | 222 | } else { |
201 | - params[`${this.categoryList[i].value}`] = value[i][0] | |
223 | + params[`${this.categoryList[i].value}`] = value[i][0]; | |
202 | 224 | } |
203 | 225 | } |
204 | 226 | } |
205 | - store.dispatch('index/search', { | |
227 | + store.dispatch("index/search", { | |
206 | 228 | params, |
207 | 229 | keyword: this.keyWords |
208 | - }) | |
230 | + }); | |
209 | 231 | } |
210 | 232 | } |
211 | 233 | } |
212 | - | |
213 | -} | |
234 | +}; | |
214 | 235 | </script> |
215 | 236 | |
216 | 237 | <style lang="scss"> | ... | ... |
src/pages/myOrder/components/OrderCard.vue
1 | 1 | <template> |
2 | - <view> | |
3 | - <view class="card" v-if="current == status" @click="toOrderInfo(status,order.pay_id)"> | |
4 | - <view class="cardHeader"> | |
5 | - <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.mch_id}}</text> | |
6 | - <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> | |
7 | - <text class="orderType" v-if="status=='0'">待付款</text> | |
8 | - <text class="orderType" v-if="status=='1'">待收货</text> | |
9 | - <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> | |
10 | - <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
11 | - </view> | |
12 | - <view class="orderCardInfo" v-for="(orderInfo) in orderInfoList.list" :key="orderInfo"> | |
13 | - <image :src="orderInfo.imgUrl" mode="aspectFill"></image> | |
14 | - <view class="infoText"> | |
15 | - <view class="orderName">{{orderInfo.p_name}}</view> | |
16 | - <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
17 | - <view class="infoText-bottom"> | |
18 | - <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
19 | - <view class="buy-num">X {{orderInfo.num}}</view> | |
20 | - </view> | |
21 | - </view> | |
22 | - </view> | |
23 | - <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
24 | - <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 --> | |
25 | - <view class="btns" v-if="status == '0'"> | |
26 | - <view class="btn-type1" >取消订单</view> | |
27 | - <view class="btn-type2">去支付</view> | |
28 | - </view> | |
29 | - <view class="btns" v-if="status == '1'"> | |
30 | - <view class="btn-type2">确认收货</view> | |
31 | - </view> | |
32 | - <view class="btns" v-if="status == '2'"> | |
33 | - <view class="btn-type2">再次购买</view> | |
34 | - </view> | |
35 | - <!-- <view class="btns" v-if="status == '3'"> | |
2 | + <view> | |
3 | + <view | |
4 | + class="card" | |
5 | + v-if="current == status" | |
6 | + @click="toOrderInfo(status,order.pay_id)" | |
7 | + > | |
8 | + <view class="cardHeader"> | |
9 | + <text | |
10 | + class="orderId" | |
11 | + v-if="status == '0'||status == '1'" | |
12 | + >订单号:{{order.pay_id}}</text> | |
13 | + <text | |
14 | + class="orderId" | |
15 | + v-if="status == '2'||status == '3'" | |
16 | + >下单时间:{{order.pay_time}}</text> | |
17 | + <text | |
18 | + class="orderType" | |
19 | + v-if="status=='0'" | |
20 | + >待付款</text> | |
21 | + <text | |
22 | + class="orderType" | |
23 | + v-if="status=='1'" | |
24 | + >待收货</text> | |
25 | + <text | |
26 | + class="orderType" | |
27 | + v-if="status == '2'||status == '3'" | |
28 | + >已完成</text> | |
29 | + <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
30 | + </view> | |
31 | + <view | |
32 | + class="orderCardInfo" | |
33 | + v-for="(orderInfo, index) in order.order_info.list" | |
34 | + :key="index" | |
35 | + > | |
36 | + <image | |
37 | + :src="orderInfo.imgUrl" | |
38 | + mode="aspectFill" | |
39 | + ></image> | |
40 | + <view class="infoText"> | |
41 | + <view class="orderName">{{orderInfo.p_name}}</view> | |
42 | + <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
43 | + <view class="infoText-bottom"> | |
44 | + <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
45 | + <view class="buy-num">X {{orderInfo.num}}</view> | |
46 | + </view> | |
47 | + </view> | |
48 | + </view> | |
49 | + <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
50 | + <!-- 0待付款 1 已付款 待收货 2 已收货待评价 3 已评价 --> | |
51 | + <view | |
52 | + class="btns" | |
53 | + v-if="status == '0'" | |
54 | + > | |
55 | + <view class="btn-type1">取消订单</view> | |
56 | + <view class="btn-type2">去支付</view> | |
57 | + </view> | |
58 | + <view | |
59 | + class="btns" | |
60 | + v-if="status == '1'" | |
61 | + > | |
62 | + <view class="btn-type2">确认收货</view> | |
63 | + </view> | |
64 | + <view | |
65 | + class="btns" | |
66 | + v-if="status == '2'" | |
67 | + > | |
68 | + <view class="btn-type2">再次购买</view> | |
69 | + </view> | |
70 | + <!-- <view class="btns" v-if="status == '3'"> | |
36 | 71 | <view class="btn-type2">再次购买</view> |
37 | 72 | </view> --> |
38 | - </view> | |
39 | - <view class="card" v-if="current == '10'" @click="toOrderInfo(status,order.pay_id)"> | |
40 | - <view class="cardHeader"> | |
41 | - <text class="orderId" v-if="status == '0'||status == '1'">订单号:{{order.mch_id}}</text> | |
42 | - <text class="orderId" v-if="status == '2'||status == '3'">下单时间:{{order.pay_time}}</text> | |
43 | - <text class="orderType" v-if="status=='0'">待付款</text> | |
44 | - <text class="orderType" v-if="status=='1'">待收货</text> | |
45 | - <text class="orderType" v-if="status == '2'||status == '3'">已完成</text> | |
46 | - <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
47 | - </view> | |
48 | - <view class="orderCardInfo" v-if v-for="(orderInfo) in orderInfoList.list" :key="orderInfo"> | |
49 | - <image :src="orderInfo.imgUrl" mode="aspectFill"></image> | |
50 | - <view class="infoText"> | |
51 | - <view class="orderName">{{orderInfo.p_name}}</view> | |
52 | - <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
53 | - <view class="infoText-bottom"> | |
54 | - <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
55 | - <view class="buy-num">X {{orderInfo.num}}</view> | |
56 | - </view> | |
57 | - </view> | |
58 | - </view> | |
59 | - <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
60 | - <view class="btns" v-if="status == '0'"> | |
61 | - <view class="btn-type1" >取消订单</view> | |
62 | - <view class="btn-type2">去支付</view> | |
63 | - </view> | |
64 | - <view class="btns" v-if="status == '1'"> | |
65 | - <view class="btn-type2">确认收货</view> | |
66 | - </view> | |
67 | - <view class="btns" v-if="status == '2'"> | |
68 | - <view class="btn-type2">再次购买</view> | |
69 | - </view> | |
70 | - <!-- <view class="btns" v-if="status == '3'"> | |
73 | + </view> | |
74 | + <view | |
75 | + class="card" | |
76 | + v-if="current == '10'" | |
77 | + @click="toOrderInfo(status,order.pay_id)" | |
78 | + > | |
79 | + <view class="cardHeader"> | |
80 | + <text | |
81 | + class="orderId" | |
82 | + v-if="status == '0'||status == '1'" | |
83 | + >订单号:{{order.pay_id}}</text> | |
84 | + <text | |
85 | + class="orderId" | |
86 | + v-if="status == '2'||status == '3'" | |
87 | + >下单时间:{{order.pay_time}}</text> | |
88 | + <text | |
89 | + class="orderType" | |
90 | + v-if="status=='0'" | |
91 | + >待付款</text> | |
92 | + <text | |
93 | + class="orderType" | |
94 | + v-if="status=='1'" | |
95 | + >待收货</text> | |
96 | + <text | |
97 | + class="orderType" | |
98 | + v-if="status == '2'||status == '3'" | |
99 | + >已完成</text> | |
100 | + <!-- <text class="orderType" v-if="status == '3'">已评价</text> --> | |
101 | + </view> | |
102 | + <view | |
103 | + class="orderCardInfo" | |
104 | + v-if | |
105 | + v-for="(orderInfo) in order.order_info.list" | |
106 | + :key="orderInfo" | |
107 | + > | |
108 | + <image | |
109 | + :src="orderInfo.imgUrl" | |
110 | + mode="aspectFit" | |
111 | + ></image> | |
112 | + <view class="infoText"> | |
113 | + <view class="orderName">{{orderInfo.p_name}}</view> | |
114 | + <view class="orderDescrib">{{orderInfo.p_name}}</view> | |
115 | + <view class="infoText-bottom"> | |
116 | + <view class="markPrice">{{orderInfo.nowPrice}}</view> | |
117 | + <view class="buy-num">X {{orderInfo.num}}</view> | |
118 | + </view> | |
119 | + </view> | |
120 | + </view> | |
121 | + <view class="payPrice">实付:<text class="priceNum">{{order.total_fee}}</text> </view> | |
122 | + <view | |
123 | + class="btns" | |
124 | + v-if="status == '0'" | |
125 | + > | |
126 | + <view class="btn-type1">取消订单</view> | |
127 | + <view class="btn-type2">去支付</view> | |
128 | + </view> | |
129 | + <view | |
130 | + class="btns" | |
131 | + v-if="status == '1'" | |
132 | + > | |
133 | + <view class="btn-type2">确认收货</view> | |
134 | + </view> | |
135 | + <view | |
136 | + class="btns" | |
137 | + v-if="status == '2'" | |
138 | + > | |
139 | + <view class="btn-type2">再次购买</view> | |
140 | + </view> | |
141 | + <!-- <view class="btns" v-if="status == '3'"> | |
71 | 142 | <view class="btn-type2">再次购买</view> |
72 | 143 | </view> --> |
73 | - </view> | |
74 | - </view> | |
144 | + </view> | |
145 | + </view> | |
75 | 146 | </template> |
76 | 147 | |
77 | 148 | <script> |
78 | - export default { | |
79 | - props: { | |
80 | - /** | |
81 | - * 订单数据 | |
82 | - */ | |
83 | - order: { | |
84 | - // orderId: Number, | |
85 | - // img: String, | |
86 | - // name: String, | |
87 | - // originCost:String, | |
88 | - // price: String, | |
89 | - // orderType:Number, | |
90 | - // buyNum:Number, | |
91 | - finished_time: null, | |
92 | - is_refound: String, | |
93 | - mch_id: String, | |
94 | - money_of_dcw: String, | |
95 | - money_of_partner: String, | |
96 | - money_of_shop: String, | |
97 | - orderJudge: Boolean, | |
98 | - order_info: { | |
99 | - address:{ | |
100 | - cityName: String, | |
101 | - countyName: String, | |
102 | - detailInfo: String, | |
103 | - errMsg: String, | |
104 | - nationalCode: String, | |
105 | - postalCode: String, | |
106 | - provinceName: String, | |
107 | - telNumber: String, | |
108 | - userName: String, | |
109 | - }, | |
110 | - cartinfo: ["127"], | |
111 | - keyname: "330_1588911391", | |
112 | - lefttime: Number, | |
113 | - list:[ | |
114 | - { | |
115 | - cart_id: "127", | |
116 | - imgUrl: String, | |
117 | - img_index_url: null, | |
118 | - memo: String, | |
119 | - mp_id: String, | |
120 | - nowPrice: String, | |
121 | - num: String, | |
122 | - oldPrice: Number, | |
123 | - p_discount: String, | |
124 | - p_name: String, | |
125 | - p_root_index: String, | |
126 | - p_sale_price: String, | |
127 | - peopleName: String, | |
128 | - pics: ["79_0_D122D2.jpg","79_1_E0A1ED.jpg","79_2_B00B3D.jpg","79_3_B2CF21.jpg","79_4_33AD1B.jpg"], | |
129 | - pid: String, | |
130 | - sk_id: String, | |
131 | - } | |
132 | - ], | |
133 | - orderDesc: String, | |
134 | - total_fee: Number, | |
135 | - }, | |
136 | - partner_uid: String, | |
137 | - pay_cate: String, | |
138 | - pay_id: String, | |
139 | - pay_time: String, | |
140 | - pay_wood_desc: String, | |
141 | - pay_wood_id: String, | |
142 | - prepay_id: String, | |
143 | - re_check_staus: String, | |
144 | - shopid: String, | |
145 | - split_userid: String, | |
146 | - status: String, | |
147 | - // status0待付款 1已付款 待收货 2 已收货待评价 3 已评价 | |
148 | - total_fee: String, | |
149 | - uid: String, | |
150 | - }, | |
151 | - /** | |
152 | - * 当前选择 | |
153 | - */ | |
154 | - current:Number | |
155 | - | |
156 | - }, | |
157 | - created() { | |
158 | - console.log(this.order); | |
159 | - // console.log(this.order.status ); | |
160 | - // console.log(this.current); | |
161 | - }, | |
162 | - computed:{ | |
163 | - status(){ | |
164 | - return this.order.status | |
165 | - }, | |
166 | - orderInfoList(){ | |
167 | - return this.order.order_info[0] | |
168 | - } | |
169 | - }, | |
170 | - data() { | |
171 | - return { | |
172 | - }; | |
173 | - }, | |
174 | - methods:{ | |
175 | - toRefundment(){ | |
176 | - uni.navigateTo({ | |
177 | - url: '../refundment/refundment', | |
178 | - success: res => {}, | |
179 | - fail: () => {}, | |
180 | - complete: () => {} | |
181 | - }); | |
182 | - }, | |
183 | - toOrderInfo(status,payId){ | |
184 | - console.log(status,payId) | |
185 | - switch(status){ | |
186 | - // 0待付款 1待收货 2已收货 3 已评价 | |
187 | - case '0': | |
188 | - uni.navigateTo({ | |
189 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
190 | - fail(errMsg) { | |
191 | - console.log(errMsg) | |
192 | - } | |
193 | - }) | |
194 | - break; | |
195 | - case '1': | |
196 | - uni.navigateTo({ | |
197 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
198 | - fail(errMsg) { | |
199 | - console.log(errMsg) | |
200 | - } | |
201 | - }) | |
202 | - | |
203 | - break; | |
204 | - case '2 || 3': | |
205 | - uni.navigateTo({ | |
206 | - url:`../myOrderPaying/myOrderPaying?status=`+status+`&payId=`+payId, | |
207 | - fail(errMsg) { | |
208 | - console.log(errMsg) | |
209 | - } | |
210 | - }) | |
211 | - break; | |
212 | - default: | |
213 | - break; | |
214 | - | |
215 | - } | |
216 | - } | |
217 | - } | |
218 | - } | |
149 | +export default { | |
150 | + props: { | |
151 | + /** | |
152 | + * 订单数据 | |
153 | + */ | |
154 | + order: { | |
155 | + // orderId: Number, | |
156 | + // img: String, | |
157 | + // name: String, | |
158 | + // originCost:String, | |
159 | + // price: String, | |
160 | + // orderType:Number, | |
161 | + // buyNum:Number, | |
162 | + finished_time: null, | |
163 | + is_refound: String, | |
164 | + mch_id: String, | |
165 | + money_of_dcw: String, | |
166 | + money_of_partner: String, | |
167 | + money_of_shop: String, | |
168 | + orderJudge: Boolean, | |
169 | + order_info: { | |
170 | + address: { | |
171 | + cityName: String, | |
172 | + countyName: String, | |
173 | + detailInfo: String, | |
174 | + errMsg: String, | |
175 | + nationalCode: String, | |
176 | + postalCode: String, | |
177 | + provinceName: String, | |
178 | + telNumber: String, | |
179 | + userName: String | |
180 | + }, | |
181 | + cartinfo: ["127"], | |
182 | + keyname: "330_1588911391", | |
183 | + lefttime: Number, | |
184 | + list: [ | |
185 | + { | |
186 | + cart_id: "127", | |
187 | + imgUrl: String, | |
188 | + img_index_url: null, | |
189 | + memo: String, | |
190 | + mp_id: String, | |
191 | + nowPrice: String, | |
192 | + num: String, | |
193 | + oldPrice: Number, | |
194 | + p_discount: String, | |
195 | + p_name: String, | |
196 | + p_root_index: String, | |
197 | + p_sale_price: String, | |
198 | + peopleName: String, | |
199 | + pics: [ | |
200 | + "79_0_D122D2.jpg", | |
201 | + "79_1_E0A1ED.jpg", | |
202 | + "79_2_B00B3D.jpg", | |
203 | + "79_3_B2CF21.jpg", | |
204 | + "79_4_33AD1B.jpg" | |
205 | + ], | |
206 | + pid: String, | |
207 | + sk_id: String | |
208 | + } | |
209 | + ], | |
210 | + orderDesc: String, | |
211 | + total_fee: Number | |
212 | + }, | |
213 | + partner_uid: String, | |
214 | + pay_cate: String, | |
215 | + pay_id: String, | |
216 | + pay_time: String, | |
217 | + pay_wood_desc: String, | |
218 | + pay_wood_id: String, | |
219 | + prepay_id: String, | |
220 | + re_check_staus: String, | |
221 | + shopid: String, | |
222 | + split_userid: String, | |
223 | + status: String, | |
224 | + // status0待付款 1已付款 待收货 2 已收货待评价 3 已评价 | |
225 | + total_fee: String, | |
226 | + uid: String | |
227 | + }, | |
228 | + /** | |
229 | + * 当前选择 | |
230 | + */ | |
231 | + current: Number | |
232 | + }, | |
233 | + created() { | |
234 | + console.log("this.order", this.order); | |
235 | + // console.log(this.order.status ); | |
236 | + // console.log(this.current); | |
237 | + }, | |
238 | + computed: { | |
239 | + status() { | |
240 | + return this.order.status; | |
241 | + }, | |
242 | + orderInfoList() { | |
243 | + console.log("this.order.order_info[0]", this.order); | |
244 | + return this.order.order_info; | |
245 | + } | |
246 | + }, | |
247 | + data() { | |
248 | + return {}; | |
249 | + }, | |
250 | + methods: { | |
251 | + toRefundment() { | |
252 | + uni.navigateTo({ | |
253 | + url: "../refundment/refundment", | |
254 | + success: res => {}, | |
255 | + fail: () => {}, | |
256 | + complete: () => {} | |
257 | + }); | |
258 | + }, | |
259 | + toOrderInfo(status, payId) { | |
260 | + console.log(status, payId); | |
261 | + switch (status) { | |
262 | + // 0待付款 1待收货 2已收货 3 已评价 | |
263 | + case "0": | |
264 | + uni.navigateTo({ | |
265 | + url: | |
266 | + `../myOrderPaying/myOrderPaying?status=` + | |
267 | + status + | |
268 | + `&payId=` + | |
269 | + payId, | |
270 | + fail(errMsg) { | |
271 | + console.log(errMsg); | |
272 | + } | |
273 | + }); | |
274 | + break; | |
275 | + case "1": | |
276 | + uni.navigateTo({ | |
277 | + url: | |
278 | + `../myOrderPaying/myOrderPaying?status=` + | |
279 | + status + | |
280 | + `&payId=` + | |
281 | + payId, | |
282 | + fail(errMsg) { | |
283 | + console.log(errMsg); | |
284 | + } | |
285 | + }); | |
286 | + | |
287 | + break; | |
288 | + case "2 || 3": | |
289 | + uni.navigateTo({ | |
290 | + url: | |
291 | + `../myOrderPaying/myOrderPaying?status=` + | |
292 | + status + | |
293 | + `&payId=` + | |
294 | + payId, | |
295 | + fail(errMsg) { | |
296 | + console.log(errMsg); | |
297 | + } | |
298 | + }); | |
299 | + break; | |
300 | + default: | |
301 | + break; | |
302 | + } | |
303 | + } | |
304 | + } | |
305 | +}; | |
219 | 306 | </script> |
220 | 307 | |
221 | 308 | <style lang="scss"> |
222 | - .card{ | |
223 | - width: 670rpx; | |
224 | - height: 478rpx; | |
225 | - background: #FFFFFF; | |
226 | - box-shadow: 0 0 10px 0 rgba(177,128,128,0.06); | |
227 | - border-radius: 8px; | |
228 | - border-radius: 8px; | |
229 | - margin-top: 20rpx; | |
230 | - padding: 40rpx; | |
231 | - box-sizing: border-box; | |
232 | - .cardHeader{ | |
233 | - width: 100%; | |
234 | - height: 40rpx; | |
235 | - display: flex; | |
236 | - justify-content: space-between; | |
237 | - align-items: center; | |
238 | - .orderId{ | |
239 | - font-size: 12px; | |
240 | - color: #999999; | |
241 | - } | |
242 | - .orderType{ | |
243 | - font-size: 14px; | |
244 | - color: #FF6B4A; | |
245 | - } | |
246 | - } | |
247 | - .orderCardInfo{ | |
248 | - width: 100%; | |
249 | - height: 188rpx; | |
250 | - display: flex; | |
251 | - flex-direction: row; | |
252 | - justify-content: space-between; | |
253 | - align-items: center; | |
254 | - margin-top: 40rpx; | |
255 | - image{ | |
256 | - height: 188rpx; | |
257 | - width: 188rpx; | |
258 | - margin-right: 24rpx; | |
259 | - } | |
260 | - .infoText{ | |
261 | - display: flex; | |
262 | - flex-direction: column; | |
263 | - justify-content: space-between; | |
264 | - align-items: flex-start; | |
265 | - height: 188rpx; | |
266 | - width: 368rpx; | |
267 | - } | |
268 | - .orderName{ | |
269 | - font-size: 14px; | |
270 | - color: #333333; | |
271 | - display: -webkit-box; | |
272 | - overflow: hidden; | |
273 | - -webkit-box-orient: vertical; | |
274 | - -webkit-line-clamp: 2; | |
275 | - } | |
276 | - .orderDescrib{ | |
277 | - font-size: 12px; | |
278 | - color: #999999; | |
279 | - display: -webkit-box; | |
280 | - overflow: hidden; | |
281 | - -webkit-box-orient: vertical; | |
282 | - -webkit-line-clamp: 2; | |
283 | - } | |
284 | - .infoText-bottom{ | |
285 | - display: flex; | |
286 | - flex-direction: row; | |
287 | - justify-content: flex-start; | |
288 | - align-items: center; | |
289 | - width: 100%; | |
290 | - .markPrice{ | |
291 | - font-size: 14px; | |
292 | - color: #FF6B4A; | |
293 | - margin-right: 20rpx; | |
294 | - } | |
295 | - .buy-num{ | |
296 | - font-size: 12px; | |
297 | - color: #999999; | |
298 | - } | |
299 | - } | |
300 | - } | |
301 | - .payPrice{ | |
302 | - text-align: right; | |
303 | - margin: 20rpx 0; | |
304 | - font-size: 14px; | |
305 | - color: #333333; | |
306 | - .priceNum{ | |
307 | - font-size: 14px; | |
308 | - color: #FF6B4A; | |
309 | - } | |
310 | - } | |
311 | - .btns{ | |
312 | - display: flex; | |
313 | - justify-content: flex-end; | |
314 | - align-items: center; | |
315 | - .btn-type1{ | |
316 | - height: 48rpx; | |
317 | - width: 156rpx; | |
318 | - border: 1px solid #FF6B4A; | |
319 | - border-radius: 12px; | |
320 | - border-radius: 12px; | |
321 | - text-align: center; | |
322 | - line-height: 48rpx; | |
323 | - font-size: 12px; | |
324 | - color: #FF6B4A; | |
325 | - } | |
326 | - .btn-type2{ | |
327 | - height: 48rpx; | |
328 | - width: 140rpx; | |
329 | - background: #FF6B4A; | |
330 | - border-radius: 12px; | |
331 | - border-radius: 12px; | |
332 | - text-align: center; | |
333 | - line-height: 48rpx; | |
334 | - font-size: 12px; | |
335 | - color: #FFFFFF; | |
336 | - margin-left: 20rpx; | |
337 | - } | |
338 | - } | |
339 | - } | |
309 | +.card { | |
310 | + width: 670rpx; | |
311 | + height: 478rpx; | |
312 | + background: #ffffff; | |
313 | + box-shadow: 0 0 10px 0 rgba(177, 128, 128, 0.06); | |
314 | + border-radius: 8px; | |
315 | + border-radius: 8px; | |
316 | + margin-top: 20rpx; | |
317 | + padding: 40rpx; | |
318 | + box-sizing: border-box; | |
319 | + .cardHeader { | |
320 | + width: 100%; | |
321 | + height: 40rpx; | |
322 | + display: flex; | |
323 | + justify-content: space-between; | |
324 | + align-items: center; | |
325 | + .orderId { | |
326 | + font-size: 12px; | |
327 | + color: #999999; | |
328 | + } | |
329 | + .orderType { | |
330 | + font-size: 14px; | |
331 | + color: #ff6b4a; | |
332 | + } | |
333 | + } | |
334 | + .orderCardInfo { | |
335 | + width: 100%; | |
336 | + height: 188rpx; | |
337 | + display: flex; | |
338 | + flex-direction: row; | |
339 | + justify-content: space-between; | |
340 | + align-items: center; | |
341 | + margin-top: 40rpx; | |
342 | + image { | |
343 | + height: 188rpx; | |
344 | + width: 188rpx; | |
345 | + margin-right: 24rpx; | |
346 | + } | |
347 | + .infoText { | |
348 | + display: flex; | |
349 | + flex-direction: column; | |
350 | + justify-content: space-between; | |
351 | + align-items: flex-start; | |
352 | + height: 188rpx; | |
353 | + width: 368rpx; | |
354 | + } | |
355 | + .orderName { | |
356 | + font-size: 14px; | |
357 | + color: #333333; | |
358 | + display: -webkit-box; | |
359 | + overflow: hidden; | |
360 | + -webkit-box-orient: vertical; | |
361 | + -webkit-line-clamp: 2; | |
362 | + } | |
363 | + .orderDescrib { | |
364 | + font-size: 12px; | |
365 | + color: #999999; | |
366 | + display: -webkit-box; | |
367 | + overflow: hidden; | |
368 | + -webkit-box-orient: vertical; | |
369 | + -webkit-line-clamp: 2; | |
370 | + } | |
371 | + .infoText-bottom { | |
372 | + display: flex; | |
373 | + flex-direction: row; | |
374 | + justify-content: flex-start; | |
375 | + align-items: center; | |
376 | + width: 100%; | |
377 | + .markPrice { | |
378 | + font-size: 14px; | |
379 | + color: #ff6b4a; | |
380 | + margin-right: 20rpx; | |
381 | + } | |
382 | + .buy-num { | |
383 | + font-size: 12px; | |
384 | + color: #999999; | |
385 | + } | |
386 | + } | |
387 | + } | |
388 | + .payPrice { | |
389 | + text-align: right; | |
390 | + margin: 20rpx 0; | |
391 | + font-size: 14px; | |
392 | + color: #333333; | |
393 | + .priceNum { | |
394 | + font-size: 14px; | |
395 | + color: #ff6b4a; | |
396 | + } | |
397 | + } | |
398 | + .btns { | |
399 | + display: flex; | |
400 | + justify-content: flex-end; | |
401 | + align-items: center; | |
402 | + .btn-type1 { | |
403 | + height: 48rpx; | |
404 | + width: 156rpx; | |
405 | + border: 1px solid #ff6b4a; | |
406 | + border-radius: 12px; | |
407 | + border-radius: 12px; | |
408 | + text-align: center; | |
409 | + line-height: 48rpx; | |
410 | + font-size: 12px; | |
411 | + color: #ff6b4a; | |
412 | + } | |
413 | + .btn-type2 { | |
414 | + height: 48rpx; | |
415 | + width: 140rpx; | |
416 | + background: #ff6b4a; | |
417 | + border-radius: 12px; | |
418 | + border-radius: 12px; | |
419 | + text-align: center; | |
420 | + line-height: 48rpx; | |
421 | + font-size: 12px; | |
422 | + color: #ffffff; | |
423 | + margin-left: 20rpx; | |
424 | + } | |
425 | + } | |
426 | +} | |
340 | 427 | </style> | ... | ... |
src/pages/myOrder/myOrder.vue
... | ... | @@ -22,7 +22,7 @@ |
22 | 22 | <view class="orderList"> |
23 | 23 | <view |
24 | 24 | v-for="(order) in orderList" |
25 | - :key="order.orderId" | |
25 | + :key="order.pay_id" | |
26 | 26 | > |
27 | 27 | <OrderCard |
28 | 28 | :order="order" |
... | ... | @@ -34,53 +34,53 @@ |
34 | 34 | </view> |
35 | 35 | </template> |
36 | 36 | <script> |
37 | -import OrderCard from './components/OrderCard.vue' | |
38 | -import store from '@/store' | |
37 | +import OrderCard from "./components/OrderCard.vue"; | |
38 | +import store from "@/store"; | |
39 | 39 | |
40 | 40 | export default { |
41 | 41 | components: { |
42 | - OrderCard: OrderCard, | |
42 | + OrderCard: OrderCard | |
43 | 43 | }, |
44 | 44 | data() { |
45 | 45 | return { |
46 | 46 | // 顶部筛选项 |
47 | 47 | screenItems: [ |
48 | - { current: '10', text: '全部' }, | |
49 | - { current: '0', text: '待付款' }, | |
50 | - { current: '1', text: '待收货' }, | |
51 | - { current: '2', text: '已完成' }, | |
48 | + { current: "10", text: "全部" }, | |
49 | + { current: "0", text: "待付款" }, | |
50 | + { current: "1", text: "待收货" }, | |
51 | + { current: "2", text: "待评价" } | |
52 | 52 | // {current:"3",text:'已评价'}, |
53 | 53 | // {current:"4",text:'退款'}, |
54 | 54 | ], |
55 | 55 | // 当前所在item 默认10-->全部 |
56 | - current: '10', | |
57 | - } | |
56 | + current: "10" | |
57 | + }; | |
58 | 58 | }, |
59 | 59 | |
60 | 60 | onLoad: function(option) { |
61 | 61 | // 获取订单列表 |
62 | - store.dispatch('myOrder/getList', { | |
63 | - way: '', | |
64 | - }) | |
62 | + store.dispatch("myOrder/getList", { | |
63 | + way: "" | |
64 | + }); | |
65 | 65 | // 从user过来传的status,给current,以显示对应item |
66 | - this.current = option.status | |
66 | + this.current = option.status; | |
67 | 67 | }, |
68 | 68 | computed: { |
69 | 69 | orderList() { |
70 | 70 | // console.log('orderList', this.$store.state.myOrder.orderList); |
71 | - return this.$store.state.myOrder.orderList | |
72 | - }, | |
71 | + return this.$store.state.myOrder.orderList; | |
72 | + } | |
73 | 73 | }, |
74 | 74 | methods: { |
75 | 75 | // tab点击事件 |
76 | 76 | onClickItem(e) { |
77 | + console.log("onClickItem", e); | |
77 | 78 | if (this.current !== e) { |
78 | - this.current = e | |
79 | + this.current = e; | |
79 | 80 | } |
80 | - }, | |
81 | - | |
82 | - }, | |
83 | -} | |
81 | + } | |
82 | + } | |
83 | +}; | |
84 | 84 | </script> |
85 | 85 | |
86 | 86 | <style lang="scss"> | ... | ... |
src/pages/myOrderPaying/myOrderPaying.vue
... | ... | @@ -72,7 +72,7 @@ |
72 | 72 | </view> --> |
73 | 73 | <text class="order-info-freight"> |
74 | 74 | <text class="p1">运费</text> |
75 | - <text class="p2">{{orderInfo.trans_price}}</text> | |
75 | + <text class="p2">免运费</text> | |
76 | 76 | </text> |
77 | 77 | <text class="order-info-discount"> |
78 | 78 | <text class="p1">优惠</text> |
... | ... | @@ -80,13 +80,13 @@ |
80 | 80 | </text> |
81 | 81 | <text class="order-info-price"> |
82 | 82 | <text class="p1">实付</text> |
83 | - <text class="p2">¥{{orderInfo.order_info[0].total_fee}}</text> | |
83 | + <text class="p2">¥{{orderInfo.total_fee}}</text> | |
84 | 84 | </text> |
85 | 85 | <text class="order-info-num"> |
86 | 86 | <text>订单号:{{payId}}</text> |
87 | 87 | </text> |
88 | 88 | <text class="order-info-time"> |
89 | - <text>下单时间:{{orderInfo.order_info[0].pay_time | timerChange}}</text> | |
89 | + <text>下单时间:{{orderInfo.pay_time | timerChange}}</text> | |
90 | 90 | </text> |
91 | 91 | <view class="order-info-hr"></view> |
92 | 92 | <view class="order-info-contact"> |
... | ... | @@ -123,120 +123,130 @@ |
123 | 123 | </template> |
124 | 124 | |
125 | 125 | <script> |
126 | -import store from '@/store' | |
127 | -import UniCountdown from '../../components/UniCountdown/UniCountdown.vue' | |
126 | +import store from "@/store"; | |
127 | +import UniCountdown from "../../components/UniCountdown/UniCountdown.vue"; | |
128 | 128 | export default { |
129 | 129 | components: { |
130 | 130 | UniCountdown |
131 | 131 | }, |
132 | - data () { | |
132 | + data() { | |
133 | 133 | return { |
134 | - payId: '', | |
135 | - payTime: '', | |
136 | - status: '', | |
137 | - uid: '', | |
138 | - openid: '', | |
139 | - lefttime: 0 | |
140 | - } | |
134 | + payId: "", | |
135 | + payTime: "", | |
136 | + status: "", // status 0 待付款 1 已发货 | |
137 | + uid: "", | |
138 | + openid: "", | |
139 | + lefttime: 0, | |
140 | + isPay: 0 | |
141 | + }; | |
141 | 142 | }, |
142 | - onLoad: function (option) { | |
143 | - console.log(option) | |
144 | - this.payId = option.payId | |
145 | - this.status = option.status | |
146 | - const openid = uni.getStorageSync('openid') | |
147 | - const uid = this.$store.state.user.uid | |
148 | - this.uid = uid | |
149 | - this.openid = openid | |
150 | - store.dispatch('orderRead/getOrderInfo', { | |
143 | + onLoad: function(option) { | |
144 | + console.log(option); | |
145 | + this.payId = option.payId; | |
146 | + this.status = option.status; | |
147 | + this.isPay = option.isPay; | |
148 | + const openid = uni.getStorageSync("openid"); | |
149 | + const uid = this.$store.state.user.uid; | |
150 | + this.uid = uid; | |
151 | + this.openid = openid; | |
152 | + store.dispatch("orderRead/getOrderInfo", { | |
151 | 153 | pay_id: this.payId, |
152 | - uid: '1', | |
154 | + uid: "1", | |
153 | 155 | openid: openid |
154 | - }) | |
155 | - | |
156 | + }); | |
156 | 157 | // this.orderInfo = this.$store.state.orderRead.orderInfo |
157 | 158 | }, |
159 | + // 若从支付页面跳转过来,返回直接返回到首页 | |
160 | + onBackPress(option) { | |
161 | + if (option.from === "backbutton" && this.isPay) { | |
162 | + uni.switchTab({ | |
163 | + url: "/pages/index/index" | |
164 | + }); | |
165 | + return true; // 阻止默认返回行为 | |
166 | + } | |
167 | + }, | |
158 | 168 | computed: { |
159 | 169 | // 获取订单详细信息 |
160 | - orderInfo () { | |
161 | - console.log('orderInfo', this.$store.state.orderRead.orderInfo) | |
162 | - return this.$store.state.orderRead.orderInfo || {} | |
170 | + orderInfo() { | |
171 | + console.log("orderInfo", this.$store.state.orderRead.orderInfo); | |
172 | + return this.$store.state.orderRead.orderInfo || {}; | |
163 | 173 | }, |
164 | - orderInfoList () { | |
165 | - const orderInfoList = this.orderInfo.order_info[0].list | |
166 | - return orderInfoList | |
174 | + orderInfoList() { | |
175 | + const orderInfoList = this.orderInfo.order_info.list; | |
176 | + return orderInfoList; | |
167 | 177 | }, |
168 | 178 | // 获取订单地址信息 |
169 | - orderAddressInfo () { | |
170 | - return this.orderInfo.order_info[0].address | |
179 | + orderAddressInfo() { | |
180 | + return this.orderInfo.order_info.address; | |
171 | 181 | }, |
172 | 182 | // 订单付款时间 |
173 | - getTime () { | |
174 | - return this.orderInfo.order_info[0].lefttime | |
183 | + getTime() { | |
184 | + return this.orderInfo.order_info.lefttime; | |
175 | 185 | }, |
176 | 186 | // 计算总优惠额 |
177 | - totalDiscount () { | |
178 | - const discountInfoList = this.orderInfo.discount_info | |
179 | - let totalDiscount = 0 | |
187 | + totalDiscount() { | |
188 | + const discountInfoList = this.orderInfo.discount_info; | |
189 | + let totalDiscount = 0; | |
180 | 190 | if (discountInfoList) { |
181 | 191 | discountInfoList.map((discountItem, index) => { |
182 | - totalDiscount += Number(discountItem.value) | |
183 | - }) | |
192 | + totalDiscount += Number(discountItem.value); | |
193 | + }); | |
184 | 194 | } |
185 | 195 | // console.log(totalDiscount) |
186 | - return totalDiscount | |
196 | + return totalDiscount; | |
187 | 197 | } |
188 | 198 | }, |
189 | 199 | methods: { |
190 | 200 | // 取消订单 |
191 | - timeup () { | |
192 | - this.cancleOrder() | |
201 | + timeup() { | |
202 | + this.cancleOrder(); | |
193 | 203 | }, |
194 | - cancleOrder () { | |
195 | - const uid = this.uid | |
196 | - const openid = this.openid | |
204 | + cancleOrder() { | |
205 | + const uid = this.uid; | |
206 | + const openid = this.openid; | |
197 | 207 | uni.showModal({ |
198 | - title: '提示', | |
199 | - content: '现在取消,订单不可恢复哦,确认取消吗?', | |
200 | - success: function (res) { | |
208 | + title: "提示", | |
209 | + content: "现在取消,订单不可恢复哦,确认取消吗?", | |
210 | + success: function(res) { | |
201 | 211 | if (res.confirm) { |
202 | - store.dispatch('cancelOrder/cancel', { | |
203 | - keyname: '1', | |
212 | + store.dispatch("cancelOrder/cancel", { | |
213 | + keyname: "1", | |
204 | 214 | uid: uid, |
205 | 215 | openid: openid |
206 | - }) | |
216 | + }); | |
207 | 217 | } else if (res.cancel) { |
208 | - console.log('用户点击取消') | |
218 | + console.log("用户点击取消"); | |
209 | 219 | } |
210 | 220 | } |
211 | - }) | |
221 | + }); | |
212 | 222 | }, |
213 | - paylog () { | |
214 | - | |
215 | - }, | |
216 | - confirmOrder () { | |
217 | - store.dispatch('statusConfirm/confirm', { | |
218 | - uid: this.uid, | |
219 | - openid: this.openid, | |
220 | - oldway: '1', | |
221 | - way: '2', | |
222 | - pay_id: this.payId, | |
223 | - judgeContent: '', | |
224 | - orderInfo: this.orderInfo.order_info | |
225 | - }).then( | |
226 | - setTimeout(() => { | |
227 | - uni.navigateBack() | |
228 | - }, 1500) | |
229 | - ) | |
223 | + paylog() {}, | |
224 | + confirmOrder() { | |
225 | + store | |
226 | + .dispatch("statusConfirm/confirm", { | |
227 | + uid: this.uid, | |
228 | + openid: this.openid, | |
229 | + oldway: "1", | |
230 | + way: "2", | |
231 | + pay_id: this.payId, | |
232 | + judgeContent: "", | |
233 | + orderInfo: this.orderInfo.order_info | |
234 | + }) | |
235 | + .then( | |
236 | + setTimeout(() => { | |
237 | + uni.navigateBack(); | |
238 | + }, 1500) | |
239 | + ); | |
230 | 240 | } |
231 | 241 | }, |
232 | 242 | filters: { |
233 | 243 | timerChange: function(value) { |
234 | - var newDate = new Date() | |
235 | - newDate.setTime(value * 1000) | |
236 | - return newDate.toLocaleString() | |
244 | + var newDate = new Date(); | |
245 | + newDate.setTime(value * 1000); | |
246 | + return newDate.toLocaleString(); | |
237 | 247 | } |
238 | 248 | } |
239 | -} | |
249 | +}; | |
240 | 250 | </script> |
241 | 251 | |
242 | 252 | <style lang="scss" scoped> | ... | ... |
src/pages/user/user.vue
... | ... | @@ -36,10 +36,16 @@ |
36 | 36 | <button @tap="chatOur(2)">客服2</button> |
37 | 37 | </view> |
38 | 38 | </uni-popup> |
39 | - <view | |
40 | - v-if="isAuth" | |
41 | - class="content" | |
42 | - > | |
39 | +<!-- <scroll-view | |
40 | + enable-flex | |
41 | + @scrolltolower="handleScrolltolower" | |
42 | + scroll-y | |
43 | + style="height: 1000px;" | |
44 | + > --> | |
45 | + <view | |
46 | + v-if="isAuth" | |
47 | + class="content" | |
48 | + > | |
43 | 49 | <view class="userInfo"> |
44 | 50 | <view class="info"> |
45 | 51 | <image |
... | ... | @@ -72,7 +78,7 @@ |
72 | 78 | </view> |
73 | 79 | <view class="myOrder"> |
74 | 80 | <view class="orderHeader"> |
75 | - <text>全部订单</text> | |
81 | + <text>我的订单</text> | |
76 | 82 | <view |
77 | 83 | class="btn" |
78 | 84 | @click="toMyOrder('10')" |
... | ... | @@ -130,56 +136,58 @@ |
130 | 136 | <image src="../../static/right.png" mode="aspectFit"></image> |
131 | 137 | </view> --> |
132 | 138 | <view class="item"> |
139 | + <image | |
140 | + src="../../static/address-icon.png" | |
141 | + mode="aspectFit" | |
142 | + ></image> | |
133 | 143 | <view class="left"> |
144 | + <text @tap="toAddress">地址管理</text> | |
134 | 145 | <image |
135 | - src="../../static/address-icon.png" | |
146 | + class="image2" | |
147 | + src="../../static/right.png" | |
136 | 148 | mode="aspectFit" |
137 | 149 | ></image> |
138 | - <text @tap="toAddress">地址管理</text> | |
139 | 150 | </view> |
151 | + | |
152 | + </view> | |
153 | + <view class="item"> | |
140 | 154 | <image |
141 | - src="../../static/right.png" | |
155 | + src="../../static/img/user/introduce.png" | |
142 | 156 | mode="aspectFit" |
143 | 157 | ></image> |
144 | - </view> | |
145 | - <view class="item"> | |
146 | 158 | <view class="left"> |
159 | + <text @tap="introduce">系统介绍</text> | |
147 | 160 | <image |
148 | - src="../../static/img/user/introduce.png" | |
161 | + src="../../static/right.png" | |
149 | 162 | mode="aspectFit" |
150 | 163 | ></image> |
151 | - <text @tap="introduce">系统介绍</text> | |
152 | 164 | </view> |
165 | + </view> | |
166 | + <view class="item"> | |
153 | 167 | <image |
154 | - src="../../static/right.png" | |
168 | + src="../../static/img/user/joinUs.png" | |
155 | 169 | mode="aspectFit" |
156 | 170 | ></image> |
157 | - </view> | |
158 | - <view class="item"> | |
159 | 171 | <view class="left"> |
172 | + <text @tap="joinUs">加入我们</text> | |
160 | 173 | <image |
161 | - src="../../static/img/user/joinUs.png" | |
174 | + src="../../static/right.png" | |
162 | 175 | mode="aspectFit" |
163 | 176 | ></image> |
164 | - <text @tap="joinUs">加入我们</text> | |
165 | 177 | </view> |
178 | + </view> | |
179 | + <view class="item"> | |
166 | 180 | <image |
167 | - src="../../static/right.png" | |
181 | + src="../../static/img/user/service.png" | |
168 | 182 | mode="aspectFit" |
169 | 183 | ></image> |
170 | - </view> | |
171 | - <view class="item"> | |
172 | - <view class="left"> | |
184 | + <view class="left lastLeft"> | |
185 | + <text>联系客服</text> | |
173 | 186 | <image |
174 | - src="../../static/img/user/service.png" | |
187 | + src="../../static/right.png" | |
175 | 188 | mode="aspectFit" |
176 | 189 | ></image> |
177 | - <text>联系客服</text> | |
178 | 190 | </view> |
179 | - <image | |
180 | - src="../../static/right.png" | |
181 | - mode="aspectFit" | |
182 | - ></image> | |
183 | 191 | </view> |
184 | 192 | </view> |
185 | 193 | <view class="recommend"> |
... | ... | @@ -190,24 +198,26 @@ |
190 | 198 | </view> |
191 | 199 | <!-- 商品列表 --> |
192 | 200 | <view class="goods-list"> |
193 | - <scroll-view | |
201 | +<!-- <scroll-view | |
194 | 202 | enable-flex |
195 | 203 | @scrolltolower="handleScrolltolower" |
196 | 204 | scroll-y |
197 | 205 | class="product-list" |
198 | - > | |
206 | + > --> | |
207 | + <view class="product-list"> | |
199 | 208 | <view |
200 | 209 | class="product" |
201 | 210 | v-for="(item, index) in userRecommandList" |
202 | 211 | :key="index" |
203 | 212 | > |
204 | - <Card :goods="item"></Card> | |
213 | + <Card :goods="item" :scrollTop="scrollTop" :viewHeight="viewHeight"></Card> | |
205 | 214 | </view> |
206 | - </scroll-view> | |
215 | + </view> | |
216 | + <!-- </scroll-view> --> | |
207 | 217 | <view class="loading-text">{{loadingText}}</view> |
208 | 218 | </view> |
209 | 219 | </view> |
210 | - </view> | |
220 | + </view> | |
211 | 221 | <view |
212 | 222 | v-else |
213 | 223 | class="auth" |
... | ... | @@ -222,6 +232,7 @@ |
222 | 232 | @getuserinfo="onGotUserInfo" |
223 | 233 | >授权登陆</button> |
224 | 234 | </view> |
235 | + <!-- </scroll-view> --> | |
225 | 236 | </view> |
226 | 237 | </template> |
227 | 238 | |
... | ... | @@ -239,9 +250,16 @@ export default { |
239 | 250 | return { |
240 | 251 | isAuth: true, // 是否显示授权页面, |
241 | 252 | pagesnum: 1, // 分页请求初始值 |
242 | - whichTap: 0 // 弹窗渲染选择条件 | |
253 | + whichTap: 0 ,// 弹窗渲染选择条件 | |
254 | + loadingText: '到底了', | |
255 | + scrollTop: 0, | |
256 | + viewHeight: uni.getSystemInfoSync().windowHeight, | |
243 | 257 | } |
244 | 258 | }, |
259 | + onPageScroll({scrollTop}) { | |
260 | + // 传入scrollTop值并触发所有easy-loadimage组件下的滚动监听事件 | |
261 | + this.scrollTop = scrollTop; | |
262 | + }, | |
245 | 263 | onLoad() { |
246 | 264 | // 判断是否授权 |
247 | 265 | uni.getSetting({ |
... | ... | @@ -260,6 +278,15 @@ export default { |
260 | 278 | page: this.pagesnum |
261 | 279 | }) |
262 | 280 | }, |
281 | + onReachBottom() { | |
282 | + // console.log('usr-my',this.$store.state.user.userInfo) | |
283 | + this.pagesnum++ | |
284 | + store.dispatch('userRecommand/getRecommandList', { | |
285 | + uid: this.$store.state.user.userInfo.uid, | |
286 | + openid: this.$store.state.user.userInfo.openid, | |
287 | + page: this.pagesnum | |
288 | + }) | |
289 | + }, | |
263 | 290 | computed: { |
264 | 291 | nickName() { |
265 | 292 | return this.$store.state.user.userInfo.nickName |
... | ... | @@ -330,15 +357,6 @@ export default { |
330 | 357 | uni.navigateTo({ |
331 | 358 | url: '../addOpticsData/addOpticsData' |
332 | 359 | }) |
333 | - }, | |
334 | - handleScrolltolower() { | |
335 | - // console.log('usr-my',this.$store.state.user.userInfo) | |
336 | - this.pagesnum++ | |
337 | - store.dispatch('userRecommand/getRecommandList', { | |
338 | - uid: this.$store.state.user.userInfo.uid, | |
339 | - openid: this.$store.state.user.userInfo.openid, | |
340 | - page: this.pagesnum | |
341 | - }) | |
342 | 360 | } |
343 | 361 | } |
344 | 362 | } |
... | ... | @@ -358,7 +376,7 @@ export default { |
358 | 376 | background-color: #f2f2f2; |
359 | 377 | } |
360 | 378 | .userInfo { |
361 | - background-image: linear-gradient(270deg, #ffa481 0%, #ff6b4a 66%); | |
379 | + background-image: linear-gradient(270deg, #f79067 0%, #FF5F3B 66%); | |
362 | 380 | width: 100%; |
363 | 381 | height: 240rpx; |
364 | 382 | color: #ffffff; |
... | ... | @@ -423,8 +441,8 @@ export default { |
423 | 441 | align-items: center; |
424 | 442 | image { |
425 | 443 | margin-right: 32rpx; |
426 | - width: 30rpx; | |
427 | - height: 34rpx; | |
444 | + width: 40rpx; | |
445 | + height: 44rpx; | |
428 | 446 | } |
429 | 447 | } |
430 | 448 | image { |
... | ... | @@ -454,7 +472,7 @@ export default { |
454 | 472 | flex-direction: row; |
455 | 473 | justify-content: space-between; |
456 | 474 | align-items: center; |
457 | - border-bottom: 1px solid #e9e9e9; | |
475 | + border-bottom: 1px solid #F5F5F5; | |
458 | 476 | font-weight: bold; |
459 | 477 | font-size: 18px; |
460 | 478 | color: #333333; |
... | ... | @@ -508,9 +526,8 @@ export default { |
508 | 526 | justify-content: space-between; |
509 | 527 | align-items: center; |
510 | 528 | .item { |
511 | - display: flex; | |
512 | - justify-content: space-between; | |
513 | - border-bottom: 1px solid #f2f2f2; | |
529 | + display: grid; | |
530 | + grid-template-columns: 10% 90%; | |
514 | 531 | align-items: center; |
515 | 532 | height: 72rpx; |
516 | 533 | width: 100%; |
... | ... | @@ -519,16 +536,23 @@ export default { |
519 | 536 | color: #333333; |
520 | 537 | display: flex; |
521 | 538 | align-items: center; |
539 | + justify-content: space-between; | |
540 | + height: 72rpx; | |
541 | + border-bottom: 1px solid #F2F2F2; | |
522 | 542 | image { |
523 | - margin-right: 32rpx; | |
524 | - width: 30rpx; | |
525 | - height: 34rpx; | |
543 | + margin-right: 0; | |
544 | + height: 16px; | |
545 | + width: 8px; | |
526 | 546 | } |
527 | 547 | } |
528 | 548 | image { |
529 | - height: 16px; | |
530 | - width: 8px; | |
549 | + margin-right: 32rpx; | |
550 | + width: 40rpx; | |
551 | + height: 44rpx; | |
531 | 552 | } |
553 | + .lastLeft{ | |
554 | + border-bottom: none; | |
555 | + } | |
532 | 556 | } |
533 | 557 | } |
534 | 558 | .recommend { |
... | ... | @@ -573,7 +597,6 @@ export default { |
573 | 597 | display: flex; |
574 | 598 | justify-content: space-between; |
575 | 599 | flex-wrap: wrap; |
576 | - height: 400px; | |
577 | 600 | .product { |
578 | 601 | width: 48%; |
579 | 602 | margin: 0 0 20rpx 0; | ... | ... |
src/static/chat_logo.png
3.92 KB
src/static/easy-loadimage/loadfail.png
3.42 KB
src/static/easy-loadimage/loading.gif
16.9 KB
src/static/icon-data.png
src/static/img/user/dataWrite.png
src/static/img/user/introduce.png
src/static/img/user/joinUs.png
src/static/joinUs (2).png
src/static/tab-cart.png
src/store/modules/address.js
... | ... | @@ -14,7 +14,7 @@ const mutations = { |
14 | 14 | }, |
15 | 15 | DEFAULT: (state, data) => { |
16 | 16 | state.defaultInfo = data |
17 | - } | |
17 | + }, | |
18 | 18 | } |
19 | 19 | |
20 | 20 | const actions = { |
... | ... | @@ -28,12 +28,12 @@ const actions = { |
28 | 28 | fail: () => { |
29 | 29 | uni.showModal({ |
30 | 30 | content: '编辑失败', |
31 | - showCancel: false | |
31 | + showCancel: false, | |
32 | 32 | }) |
33 | 33 | }, |
34 | 34 | complete: (res) => { |
35 | 35 | console.log('complete status === > ', res) |
36 | - } | |
36 | + }, | |
37 | 37 | })) |
38 | 38 | }, |
39 | 39 | list({ commit }) { |
... | ... | @@ -45,9 +45,9 @@ const actions = { |
45 | 45 | fail: () => { |
46 | 46 | uni.showModal({ |
47 | 47 | content: '获取地址列表失败', |
48 | - showCancel: false | |
48 | + showCancel: false, | |
49 | 49 | }) |
50 | - } | |
50 | + }, | |
51 | 51 | }) |
52 | 52 | }, |
53 | 53 | details({ commit }, param) { |
... | ... | @@ -58,15 +58,15 @@ const actions = { |
58 | 58 | commit('DETAILS', res.data.data) |
59 | 59 | resolve({ |
60 | 60 | code: res.data.code, |
61 | - data: res.data.data | |
61 | + data: res.data.data, | |
62 | 62 | }) |
63 | 63 | }, |
64 | 64 | fail: () => { |
65 | 65 | uni.showModal({ |
66 | 66 | content: '获取地址信息失败', |
67 | - showCancel: false | |
67 | + showCancel: false, | |
68 | 68 | }) |
69 | - } | |
69 | + }, | |
70 | 70 | })) |
71 | 71 | }, |
72 | 72 | default({ commit }, param) { |
... | ... | @@ -76,22 +76,22 @@ const actions = { |
76 | 76 | success: (res) => { |
77 | 77 | resolve({ |
78 | 78 | code: res.data.code, |
79 | - data: res.data.data | |
79 | + data: res.data.data, | |
80 | 80 | }) |
81 | 81 | }, |
82 | 82 | fail: () => { |
83 | 83 | uni.showModal({ |
84 | 84 | content: '获取默认地址信息失败', |
85 | - showCancel: false | |
85 | + showCancel: false, | |
86 | 86 | }) |
87 | - } | |
87 | + }, | |
88 | 88 | })) |
89 | - } | |
89 | + }, | |
90 | 90 | } |
91 | 91 | |
92 | 92 | export default { |
93 | 93 | namespaced: true, |
94 | 94 | state, |
95 | 95 | mutations, |
96 | - actions | |
96 | + actions, | |
97 | 97 | } | ... | ... |
src/store/modules/cart.js
... | ... | @@ -4,7 +4,7 @@ import request from '../request' |
4 | 4 | const { cartList, cartModi, cartDel, cartAdd } = urlAlias |
5 | 5 | |
6 | 6 | const state = { |
7 | - cartList: [] | |
7 | + cartList: [], | |
8 | 8 | } |
9 | 9 | |
10 | 10 | const mutations = { |
... | ... | @@ -22,11 +22,12 @@ const mutations = { |
22 | 22 | console.log('mutations====>isadd', args) |
23 | 23 | state.cartList[args.index].num = args.num |
24 | 24 | console.log('the num', state.cartList[args.index].num) |
25 | - } | |
25 | + }, | |
26 | 26 | |
27 | 27 | } |
28 | 28 | |
29 | 29 | const actions = { |
30 | + // 获取购物车列表 | |
30 | 31 | getCartList({ commit }, param) { |
31 | 32 | request({ |
32 | 33 | url: cartList, |
... | ... | @@ -40,10 +41,10 @@ const actions = { |
40 | 41 | }, |
41 | 42 | complete: (res) => { |
42 | 43 | console.log('complete status === > ', res) |
43 | - } | |
44 | + }, | |
44 | 45 | }) |
45 | 46 | }, |
46 | - | |
47 | + // 修改购物车数量 | |
47 | 48 | modiCart({ commit }, param) { |
48 | 49 | const arg = Object.assign({ num: param.num }, param.args) |
49 | 50 | delete param.args |
... | ... | @@ -60,10 +61,10 @@ const actions = { |
60 | 61 | }, |
61 | 62 | complete: (res) => { |
62 | 63 | console.log('complete status === > ', res) |
63 | - } | |
64 | + }, | |
64 | 65 | }) |
65 | 66 | }, |
66 | - | |
67 | + // 删除购物车商品 | |
67 | 68 | delCart({ commit }, param) { |
68 | 69 | const arg = param.arg |
69 | 70 | delete param.arg |
... | ... | @@ -80,10 +81,10 @@ const actions = { |
80 | 81 | }, |
81 | 82 | complete: (res) => { |
82 | 83 | console.log('complete status === > ', res) |
83 | - } | |
84 | + }, | |
84 | 85 | }) |
85 | 86 | }, |
86 | - | |
87 | + // 添加到购物车 | |
87 | 88 | addCart({ commit }, param) { |
88 | 89 | console.log('请求接口开始') |
89 | 90 | request({ |
... | ... | @@ -99,15 +100,14 @@ const actions = { |
99 | 100 | }, |
100 | 101 | complete: (res) => { |
101 | 102 | console.log('complete status === > ', res) |
102 | - } | |
103 | + }, | |
103 | 104 | }) |
104 | - } | |
105 | - | |
105 | + }, | |
106 | 106 | } |
107 | 107 | |
108 | 108 | export default { |
109 | 109 | namespaced: true, |
110 | 110 | state, |
111 | 111 | mutations, |
112 | - actions | |
112 | + actions, | |
113 | 113 | } | ... | ... |
src/store/modules/index.js
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | |
10 | 10 | const state = { |
11 | 11 | categoryList: [], |
12 | - list: [], | |
12 | + list: [] | |
13 | 13 | }; |
14 | 14 | |
15 | 15 | const mutations = { |
... | ... | @@ -18,7 +18,7 @@ const mutations = { |
18 | 18 | }, |
19 | 19 | CATEGORY: (state, categoryList) => { |
20 | 20 | state.categoryList = categoryList; |
21 | - }, | |
21 | + } | |
22 | 22 | }; |
23 | 23 | |
24 | 24 | const actions = { |
... | ... | @@ -84,7 +84,7 @@ const actions = { |
84 | 84 | console.log("complete status === > ", res); |
85 | 85 | }, |
86 | 86 | }) |
87 | - } | |
87 | + }, | |
88 | 88 | }; |
89 | 89 | |
90 | 90 | export default { | ... | ... |
src/store/modules/myOrder.js
... | ... | @@ -83,14 +83,16 @@ const mutations = { |
83 | 83 | }; |
84 | 84 | |
85 | 85 | const actions = { |
86 | - getList({ commit }, param) { | |
87 | - request({ | |
88 | - url: myOrderList, | |
89 | - data: param, | |
90 | - success: (res) => { | |
91 | - // console.log(res.data); | |
92 | - commit("INIT", res.data.data); | |
93 | - }, | |
86 | + getList({ | |
87 | + commit | |
88 | + }, param) { | |
89 | + request({ | |
90 | + url: myOrderList, | |
91 | + data: param, | |
92 | + success: (res) => { | |
93 | + console.log('myOrderList', res.data); | |
94 | + commit("INIT", res.data.data); | |
95 | + }, | |
94 | 96 | }) |
95 | 97 | } |
96 | 98 | } | ... | ... |
src/store/modules/userRecommand.js
... | ... | @@ -23,7 +23,8 @@ const actions = { |
23 | 23 | url: recommandList, |
24 | 24 | data: param, |
25 | 25 | success: (res) => { |
26 | - console.log(res.data.data) | |
26 | + console.log('ReccomandList请求结果',res.data) | |
27 | + // console.log(res.data.data) | |
27 | 28 | // const Res={...res.data.data.list,...data.data.list} |
28 | 29 | const data = res.data.data |
29 | 30 | for (let index = 0; index < data.length; index++) { | ... | ... |
src/tab-cart.png
2.85 KB
src/utils/md5.js
... | ... | @@ -0,0 +1,261 @@ |
1 | +/* | |
2 | + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message | |
3 | + * Digest Algorithm, as defined in RFC 1321. | |
4 | + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. | |
5 | + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet | |
6 | + * Distributed under the BSD License | |
7 | + */ | |
8 | + | |
9 | +/* | |
10 | + * Configurable variables. You may need to tweak these to be compatible with | |
11 | + * the server-side, but the defaults work in most cases. | |
12 | + */ | |
13 | +var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | |
14 | +var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ | |
15 | +var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | |
16 | + | |
17 | +/* | |
18 | + * These are the functions you'll usually want to call | |
19 | + * They take string arguments and return either hex or base-64 encoded strings | |
20 | + */ | |
21 | +function hex_md5(s) { | |
22 | + return binl2hex(core_md5(str2binl(s), s.length * chrsz)); | |
23 | +} | |
24 | + | |
25 | +function b64_md5(s) { | |
26 | + return binl2b64(core_md5(str2binl(s), s.length * chrsz)); | |
27 | +} | |
28 | + | |
29 | +function str_md5(s) { | |
30 | + return binl2str(core_md5(str2binl(s), s.length * chrsz)); | |
31 | +} | |
32 | + | |
33 | +function hex_hmac_md5(key, data) { | |
34 | + return binl2hex(core_hmac_md5(key, data)); | |
35 | +} | |
36 | + | |
37 | +function b64_hmac_md5(key, data) { | |
38 | + return binl2b64(core_hmac_md5(key, data)); | |
39 | +} | |
40 | + | |
41 | +function str_hmac_md5(key, data) { | |
42 | + return binl2str(core_hmac_md5(key, data)); | |
43 | +} | |
44 | + | |
45 | +/* | |
46 | + * Perform a simple self-test to see if the VM is working | |
47 | + */ | |
48 | +function md5_vm_test() { | |
49 | + return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"; | |
50 | +} | |
51 | + | |
52 | +/* | |
53 | + * Calculate the MD5 of an array of little-endian words, and a bit length | |
54 | + */ | |
55 | +function core_md5(x, len) { | |
56 | + /* append padding */ | |
57 | + x[len >> 5] |= 0x80 << ((len) % 32); | |
58 | + x[(((len + 64) >>> 9) << 4) + 14] = len; | |
59 | + | |
60 | + var a = 1732584193; | |
61 | + var b = -271733879; | |
62 | + var c = -1732584194; | |
63 | + var d = 271733878; | |
64 | + | |
65 | + for (var i = 0; i < x.length; i += 16) { | |
66 | + var olda = a; | |
67 | + var oldb = b; | |
68 | + var oldc = c; | |
69 | + var oldd = d; | |
70 | + | |
71 | + a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); | |
72 | + d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); | |
73 | + c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); | |
74 | + b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); | |
75 | + a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); | |
76 | + d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); | |
77 | + c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); | |
78 | + b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); | |
79 | + a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); | |
80 | + d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); | |
81 | + c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); | |
82 | + b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); | |
83 | + a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); | |
84 | + d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); | |
85 | + c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); | |
86 | + b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); | |
87 | + | |
88 | + a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); | |
89 | + d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); | |
90 | + c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); | |
91 | + b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); | |
92 | + a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); | |
93 | + d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); | |
94 | + c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); | |
95 | + b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); | |
96 | + a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); | |
97 | + d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); | |
98 | + c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); | |
99 | + b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); | |
100 | + a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); | |
101 | + d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); | |
102 | + c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); | |
103 | + b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); | |
104 | + | |
105 | + a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); | |
106 | + d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); | |
107 | + c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); | |
108 | + b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); | |
109 | + a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); | |
110 | + d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); | |
111 | + c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); | |
112 | + b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); | |
113 | + a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); | |
114 | + d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); | |
115 | + c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); | |
116 | + b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); | |
117 | + a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); | |
118 | + d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); | |
119 | + c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); | |
120 | + b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); | |
121 | + | |
122 | + a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); | |
123 | + d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); | |
124 | + c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); | |
125 | + b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); | |
126 | + a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); | |
127 | + d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); | |
128 | + c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); | |
129 | + b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); | |
130 | + a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); | |
131 | + d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); | |
132 | + c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); | |
133 | + b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); | |
134 | + a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); | |
135 | + d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); | |
136 | + c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); | |
137 | + b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); | |
138 | + | |
139 | + a = safe_add(a, olda); | |
140 | + b = safe_add(b, oldb); | |
141 | + c = safe_add(c, oldc); | |
142 | + d = safe_add(d, oldd); | |
143 | + } | |
144 | + return Array(a, b, c, d); | |
145 | + | |
146 | +} | |
147 | + | |
148 | +/* | |
149 | + * These functions implement the four basic operations the algorithm uses. | |
150 | + */ | |
151 | +function md5_cmn(q, a, b, x, s, t) { | |
152 | + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); | |
153 | +} | |
154 | + | |
155 | +function md5_ff(a, b, c, d, x, s, t) { | |
156 | + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); | |
157 | +} | |
158 | + | |
159 | +function md5_gg(a, b, c, d, x, s, t) { | |
160 | + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); | |
161 | +} | |
162 | + | |
163 | +function md5_hh(a, b, c, d, x, s, t) { | |
164 | + return md5_cmn(b ^ c ^ d, a, b, x, s, t); | |
165 | +} | |
166 | + | |
167 | +function md5_ii(a, b, c, d, x, s, t) { | |
168 | + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); | |
169 | +} | |
170 | + | |
171 | +/* | |
172 | + * Calculate the HMAC-MD5, of a key and some data | |
173 | + */ | |
174 | +function core_hmac_md5(key, data) { | |
175 | + var bkey = str2binl(key); | |
176 | + if (bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); | |
177 | + | |
178 | + var ipad = Array(16), | |
179 | + opad = Array(16); | |
180 | + for (var i = 0; i < 16; i++) { | |
181 | + ipad[i] = bkey[i] ^ 0x36363636; | |
182 | + opad[i] = bkey[i] ^ 0x5C5C5C5C; | |
183 | + } | |
184 | + | |
185 | + var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); | |
186 | + return core_md5(opad.concat(hash), 512 + 128); | |
187 | +} | |
188 | + | |
189 | +/* | |
190 | + * Add integers, wrapping at 2^32. This uses 16-bit operations internally | |
191 | + * to work around bugs in some JS interpreters. | |
192 | + */ | |
193 | +function safe_add(x, y) { | |
194 | + var lsw = (x & 0xFFFF) + (y & 0xFFFF); | |
195 | + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); | |
196 | + return (msw << 16) | (lsw & 0xFFFF); | |
197 | +} | |
198 | + | |
199 | +/* | |
200 | + * Bitwise rotate a 32-bit number to the left. | |
201 | + */ | |
202 | +function bit_rol(num, cnt) { | |
203 | + return (num << cnt) | (num >>> (32 - cnt)); | |
204 | +} | |
205 | + | |
206 | +/* | |
207 | + * Convert a string to an array of little-endian words | |
208 | + * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. | |
209 | + */ | |
210 | +function str2binl(str) { | |
211 | + var bin = Array(); | |
212 | + var mask = (1 << chrsz) - 1; | |
213 | + for (var i = 0; i < str.length * chrsz; i += chrsz) | |
214 | + bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << (i % 32); | |
215 | + return bin; | |
216 | +} | |
217 | + | |
218 | +/* | |
219 | + * Convert an array of little-endian words to a string | |
220 | + */ | |
221 | +function binl2str(bin) { | |
222 | + var str = ""; | |
223 | + var mask = (1 << chrsz) - 1; | |
224 | + for (var i = 0; i < bin.length * 32; i += chrsz) | |
225 | + str += String.fromCharCode((bin[i >> 5] >>> (i % 32)) & mask); | |
226 | + return str; | |
227 | +} | |
228 | + | |
229 | +/* | |
230 | + * Convert an array of little-endian words to a hex string. | |
231 | + */ | |
232 | +function binl2hex(binarray) { | |
233 | + var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; | |
234 | + var str = ""; | |
235 | + for (var i = 0; i < binarray.length * 4; i++) { | |
236 | + str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + | |
237 | + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF); | |
238 | + } | |
239 | + return str; | |
240 | +} | |
241 | + | |
242 | +/* | |
243 | + * Convert an array of little-endian words to a base-64 string | |
244 | + */ | |
245 | +function binl2b64(binarray) { | |
246 | + var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
247 | + var str = ""; | |
248 | + for (var i = 0; i < binarray.length * 4; i += 3) { | |
249 | + var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) | | |
250 | + (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) | | |
251 | + ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF); | |
252 | + for (var j = 0; j < 4; j++) { | |
253 | + if (i * 8 + j * 6 > binarray.length * 32) str += b64pad; | |
254 | + else str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F); | |
255 | + } | |
256 | + } | |
257 | + return str; | |
258 | +} | |
259 | +module.exports = { | |
260 | + MD5: hex_md5 | |
261 | +} | |
0 | 262 | \ No newline at end of file | ... | ... |