Commit 6111092e894ad2e4dd850b0b9b6a6d4f49149e8c
1 parent
843fce64ee
Exists in
master
update cart
Showing
5 changed files
with
216 additions
and
36 deletions
Show diff stats
src/pages.json
| 1 | { | 1 | { |
| 2 | "pages": [ | 2 | "pages": [ |
| 3 | { | 3 | { |
| 4 | "path": "pages/cart/cart", | ||
| 5 | "style": { | ||
| 6 | "navigationBarTitleText": "购物车" | ||
| 7 | } | ||
| 8 | }, | ||
| 9 | { | ||
| 4 | "path": "pages/index/index", | 10 | "path": "pages/index/index", |
| 5 | "style": { | 11 | "style": { |
| 6 | "navigationBarTitleText": "商城一览" | 12 | "navigationBarTitleText": "商城一览" |
| 7 | } | 13 | } |
| 8 | }, | 14 | }, |
| 9 | { | 15 | { |
| 10 | "path": "pages/detail/detail", | 16 | "path": "pages/detail/detail", |
| 11 | "style": { | 17 | "style": { |
| 12 | "navigationBarTitleText": "产品详情" | 18 | "navigationBarTitleText": "产品详情" |
| 13 | } | 19 | } |
| 14 | }, | 20 | }, |
| 15 | { | 21 | { |
| 16 | "path": "pages/details-3/details-3", | 22 | "path": "pages/details-3/details-3", |
| 17 | "style": { | 23 | "style": { |
| 18 | "navigationBarTitleText": "产品详情" | 24 | "navigationBarTitleText": "产品详情" |
| 19 | } | 25 | } |
| 20 | }, | 26 | }, |
| 21 | { | 27 | { |
| 22 | "path" : "pages/purchaseLenses/purchaseLenses", | 28 | "path" : "pages/purchaseLenses/purchaseLenses", |
| 23 | "style" : { | 29 | "style" : { |
| 24 | "navigationBarTitleText": "产品选购" | 30 | "navigationBarTitleText": "产品选购" |
| 25 | } | 31 | } |
| 26 | }, | 32 | }, |
| 27 | { | 33 | { |
| 28 | "path" : "pages/refundProgress/refundProgress", | 34 | "path" : "pages/refundProgress/refundProgress", |
| 29 | "style": { | 35 | "style": { |
| 30 | "navigationBarTitleText": "申请退款" | 36 | "navigationBarTitleText": "申请退款" |
| 31 | } | 37 | } |
| 32 | }, | 38 | }, |
| 33 | { | 39 | { |
| 34 | "path" : "pages/myOrder/myOrder", | 40 | "path" : "pages/myOrder/myOrder", |
| 35 | "style" : { | 41 | "style" : { |
| 36 | "navigationBarTitleText": "我的订单"} | 42 | "navigationBarTitleText": "我的订单"} |
| 37 | }, | 43 | }, |
| 38 | { | 44 | { |
| 39 | "path": "pages/addArddess/addArddess", | 45 | "path": "pages/addArddess/addArddess", |
| 40 | "style": { | 46 | "style": { |
| 41 | "navigationBarTitleText": "新增地址" | 47 | "navigationBarTitleText": "新增地址" |
| 42 | } | 48 | } |
| 43 | }, | 49 | }, |
| 44 | { | 50 | { |
| 45 | "path" : "pages/confirmOrder/confirmOrder", | 51 | "path" : "pages/confirmOrder/confirmOrder", |
| 46 | "style" : { | 52 | "style" : { |
| 47 | "navigationBarTitleText": "确认订单"} | 53 | "navigationBarTitleText": "确认订单"} |
| 48 | }, | 54 | }, |
| 49 | { | 55 | { |
| 50 | "path": "pages/cart/cart", | ||
| 51 | "style": { | ||
| 52 | "navigationBarTitleText": "购物车" | ||
| 53 | } | ||
| 54 | }, | ||
| 55 | { | ||
| 56 | "path": "pages/user/user", | 56 | "path": "pages/user/user", |
| 57 | "style": { | 57 | "style": { |
| 58 | "navigationBarTitleText": "我的" | 58 | "navigationBarTitleText": "我的" |
| 59 | } | 59 | } |
| 60 | }, | 60 | }, |
| 61 | { | 61 | { |
| 62 | "path": "pages/refundment/Refundways" | 62 | "path": "pages/refundment/Refundways" |
| 63 | }, | 63 | }, |
| 64 | { | 64 | { |
| 65 | "path": "pages/refundment/refundment" | 65 | "path": "pages/refundment/refundment" |
| 66 | }, | 66 | }, |
| 67 | { | 67 | { |
| 68 | "path": "pages/Predelivery/Predelivery" | 68 | "path": "pages/predelivery/predelivery" |
| 69 | }, | 69 | }, |
| 70 | { | 70 | { |
| 71 | "path": "pages/customerService/customerService" | 71 | "path": "pages/customerService/customerService" |
| 72 | }, | 72 | }, |
| 73 | { | 73 | { |
| 74 | "path": "pages/myorder-paying/myorder-paying" | 74 | "path": "pages/myorder-paying/myorder-paying" |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | ], | 77 | ], |
| 78 | "globalStyle": { | 78 | "globalStyle": { |
| 79 | "navigationBarTextStyle": "black", | 79 | "navigationBarTextStyle": "black", |
| 80 | "navigationBarTitleText": "uni-app", | 80 | "navigationBarTitleText": "uni-app", |
| 81 | "navigationBarBackgroundColor": "#F8F8F8", | 81 | "navigationBarBackgroundColor": "#F8F8F8", |
| 82 | "backgroundColor": "#F8F8F8" | 82 | "backgroundColor": "#F8F8F8" |
| 83 | }, | 83 | }, |
| 84 | "tabBar": { | 84 | "tabBar": { |
| 85 | "color": "#C0C4CC", | 85 | "color": "#C0C4CC", |
| 86 | "selectedColor": "#fa436a", | 86 | "selectedColor": "#fa436a", |
| 87 | "borderStyle": "black", | 87 | "borderStyle": "black", |
| 88 | "backgroundColor": "#ffffff", | 88 | "backgroundColor": "#ffffff", |
| 89 | "list": [{ | 89 | "list": [{ |
| 90 | "pagePath": "pages/index/index", | 90 | "pagePath": "pages/index/index", |
| 91 | "iconPath": "static/tab-home.png", | 91 | "iconPath": "static/tab-home.png", |
| 92 | "selectedIconPath": "static/tab-home-current.png", | 92 | "selectedIconPath": "static/tab-home-current.png", |
| 93 | "text": "首页" | 93 | "text": "首页" |
| 94 | }, | 94 | }, |
| 95 | { | 95 | { |
| 96 | "pagePath": "pages/cart/cart", | 96 | "pagePath": "pages/cart/cart", |
| 97 | "iconPath": "static/tab-cart.png", | 97 | "iconPath": "static/tab-cart.png", |
| 98 | "selectedIconPath": "static/tab-cart-current.png", | 98 | "selectedIconPath": "static/tab-cart-current.png", |
| 99 | "text": "购物车" | 99 | "text": "购物车" |
| 100 | }, | 100 | }, |
| 101 | { | 101 | { |
| 102 | "pagePath": "pages/user/user", | 102 | "pagePath": "pages/user/user", |
| 103 | "iconPath": "static/tab-my.png", | 103 | "iconPath": "static/tab-my.png", |
| 104 | "selectedIconPath": "static/tab-my-current.png", | 104 | "selectedIconPath": "static/tab-my-current.png", |
src/pages/addArddess/addArddess.vue
| 1 | <template> | 1 | <template> |
| 2 | <view class="wrap"> | 2 | <view class="wrap"> |
| 3 | <view class="content"> | 3 | <view class="content"> |
| 4 | <view class="item,name" > | 4 | <view class="item,name" > |
| 5 | <text class="itemText">姓名</text> | 5 | <text class="itemText">姓名</text> |
| 6 | <input placeholder="收货人姓名(真实姓名)" placeholder-style="color:#B8B8B8"/> | 6 | <input placeholder="收货人姓名(真实姓名)" placeholder-style="color:#B8B8B8"/> |
| 7 | </view> | 7 | </view> |
| 8 | <view class="item,phone"> | 8 | <view class="item,phone"> |
| 9 | <text class="itemText">电话</text> | 9 | <text class="itemText">电话</text> |
| 10 | <input placeholder="手机号" type="digit" placeholder-style="color:#B8B8B8"/> | 10 | <input placeholder="手机号" type="digit" placeholder-style="color:#B8B8B8"/> |
| 11 | </view> | 11 | </view> |
| 12 | <view class="item,area" > | 12 | <view class="item,area" > |
| 13 | <text class="itemText">地区</text> | 13 | <text class="itemText">地区</text> |
| 14 | <view class="btn" v-if="pickerText===''" @tap="openAddres">选择省/市/区</view> | 14 | <view class="btn" v-if="pickerText===''" @tap="openAddres">选择省/市/区</view> |
| 15 | <view class="btn" v-else @tap="openAddres">{{pickerText}}</view> | 15 | <view class="btn" v-else @tap="openAddres">{{pickerText}}</view> |
| 16 | <simple-address ref="SimpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm" themeColor="#007AFF"></simple-address> | 16 | <simple-address ref="SimpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm" themeColor="#007AFF"></simple-address> |
| 17 | </view> | 17 | </view> |
| 18 | <view class="item,address" > | 18 | <view class="item,address" > |
| 19 | <text class="itemText">详细地址</text> | 19 | <text class="itemText">详细地址</text> |
| 20 | <input placeholder="街道、小区门牌等详细地址"/> | 20 | <input placeholder="街道、小区门牌等详细地址"/> |
| 21 | </view> | 21 | </view> |
| 22 | <view class="item,check" > | 22 | <view class="item,check" > |
| 23 | <text class="itemText">设为默认地址</text> | 23 | <text class="itemText">设为默认地址</text> |
| 24 | <switch checked="isDefalutAddress" color="#FF6B4A" style="transform:scale(0.6)" @change="changeDefalutAddress" /> | 24 | <switch checked="isDefalutAddress" color="#FF6B4A" style="transform:scale(0.6)" @change="changeDefalutAddress" /> |
| 25 | </view> | 25 | </view> |
| 26 | <input /> | 26 | <input /> |
| 27 | </view> | 27 | </view> |
| 28 | <view class="button">保存并使用</view> | 28 | <view class="button">保存并使用</view> |
| 29 | </view> | 29 | </view> |
| 30 | </template> | 30 | </template> |
| 31 | 31 | ||
| 32 | <script> | 32 | <script> |
| 33 | import SimpleAddress from '@/components/Simple-address/simple-address.vue'; | 33 | import SimpleAddress from '@/components/Simple-address/Simple-address.vue'; |
| 34 | export default { | 34 | export default { |
| 35 | data() { | 35 | data() { |
| 36 | return { | 36 | return { |
| 37 | cityPickerValueDefault: [0, 0, 1], | 37 | cityPickerValueDefault: [0, 0, 1], |
| 38 | pickerText: '', | 38 | pickerText: '', |
| 39 | isDefalutAddress:true | 39 | isDefalutAddress:true |
| 40 | 40 | ||
| 41 | }; | 41 | }; |
| 42 | }, | 42 | }, |
| 43 | components: { | 43 | components: { |
| 44 | SimpleAddress | 44 | SimpleAddress |
| 45 | }, | 45 | }, |
| 46 | methods: { | 46 | methods: { |
| 47 | openAddres() { | 47 | openAddres() { |
| 48 | this.cityPickerValueDefault = [0,0,1] | 48 | this.cityPickerValueDefault = [0,0,1] |
| 49 | this.$refs.SimpleAddress.open(); | 49 | this.$refs.SimpleAddress.open(); |
| 50 | }, | 50 | }, |
| 51 | onConfirm(e) { | 51 | onConfirm(e) { |
| 52 | this.pickerText = e.label; | 52 | this.pickerText = e.label; |
| 53 | }, | 53 | }, |
| 54 | changeDefalutAddress(e){ | 54 | changeDefalutAddress(e){ |
| 55 | this.isDefalutAddress = e.target.value | 55 | this.isDefalutAddress = e.target.value |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | </script> | 59 | </script> |
| 60 | 60 | ||
| 61 | <style lang="scss"> | 61 | <style lang="scss"> |
| 62 | .wrap{ | 62 | .wrap{ |
| 63 | height: 100vh; | 63 | height: 100vh; |
| 64 | background-color:#F2F2F2 ; | 64 | background-color:#F2F2F2 ; |
| 65 | font-family: PingFangSC-Regular; | 65 | font-family: PingFangSC-Regular; |
| 66 | letter-spacing: -0.23px; | 66 | letter-spacing: -0.23px; |
| 67 | padding-top: 19rpx; | 67 | padding-top: 19rpx; |
| 68 | } | 68 | } |
| 69 | .content{ | 69 | .content{ |
| 70 | background-color: #FFFFFF; | 70 | background-color: #FFFFFF; |
| 71 | border-radius: 8px; | 71 | border-radius: 8px; |
| 72 | border-radius: 8px; | 72 | border-radius: 8px; |
| 73 | padding: 40rpx 56rpx; | 73 | padding: 40rpx 56rpx; |
| 74 | margin-left: 40rpx; | 74 | margin-left: 40rpx; |
| 75 | width: 670rpx; | 75 | width: 670rpx; |
| 76 | box-sizing: border-box; | 76 | box-sizing: border-box; |
| 77 | .item{ | 77 | .item{ |
| 78 | display: flex; | 78 | display: flex; |
| 79 | justify-content: flex-start; | 79 | justify-content: flex-start; |
| 80 | font-size: 14px; | 80 | font-size: 14px; |
| 81 | align-items: center; | 81 | align-items: center; |
| 82 | height: 112rpx; | 82 | height: 112rpx; |
| 83 | border-bottom: 1rpx solid #E9E9E9; | 83 | border-bottom: 1rpx solid #E9E9E9; |
| 84 | .itemText{ | 84 | .itemText{ |
| 85 | width: 162rpx; | 85 | width: 162rpx; |
| 86 | font-family: PingFangSC-Regular; | 86 | font-family: PingFangSC-Regular; |
| 87 | letter-spacing: -0.26px; | 87 | letter-spacing: -0.26px; |
| 88 | } | 88 | } |
| 89 | .btn{ | 89 | .btn{ |
| 90 | color: #333333 !important; | 90 | color: #333333 !important; |
| 91 | } | 91 | } |
| 92 | } | 92 | } |
| 93 | .check{ | 93 | .check{ |
| 94 | justify-content: space-between; | 94 | justify-content: space-between; |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | .button{ | 97 | .button{ |
| 98 | position: fixed; | 98 | position: fixed; |
| 99 | bottom: 0; | 99 | bottom: 0; |
| 100 | left: 0; | 100 | left: 0; |
| 101 | height: 112rpx; | 101 | height: 112rpx; |
| 102 | width: 100%; | 102 | width: 100%; |
| 103 | background: #FF6B4A; | 103 | background: #FF6B4A; |
| 104 | display: flex; | 104 | display: flex; |
| 105 | justify-content: center; | 105 | justify-content: center; |
| 106 | align-items: center; | 106 | align-items: center; |
| 107 | font-size: 16px; | 107 | font-size: 16px; |
| 108 | color: #FFFFFF; | 108 | color: #FFFFFF; |
| 109 | letter-spacing: -0.3px; | 109 | letter-spacing: -0.3px; |
| 110 | } | 110 | } |
| 111 | </style> | 111 | </style> |
| 112 | 112 |
src/pages/cart/cart.vue
| 1 | <template> | 1 | <template> |
| 2 | <view class="content"> | 2 | <view class="content"> |
| 3 | <image class="logo" src="/static/logo.png"></image> | 3 | <checkbox-group name=""> |
| 4 | <view class="text-area"> | 4 | <label> |
| 5 | <text class="title">{{title}}</text> | 5 | <view class="card"> |
| 6 | <view class="cardHeader"> | ||
| 7 | <checkbox color="#FF6B4A" :value="totalPrice" style="transform:scale(0.7)"/> | ||
| 8 | <image src="../../static/customerService-btn.png" mode="aspectFill"></image> | ||
| 9 | <text>非常戴镜</text> | ||
| 10 | </view> | ||
| 11 | <view class="cardBody"> | ||
| 12 | <checkbox color="#FF6B4A" :value="totalPrice" style="transform:scale(0.7)" /> | ||
| 13 | <view class="goodInfo"> | ||
| 14 | <view class="imageWrap"> | ||
| 15 | <image src="../../static/img/detail/d1.png" mode="aspectFill" style="width: 188rpx;height: 168rpx;"></image> | ||
| 16 | </view> | ||
| 17 | <view class="infoRight"> | ||
| 18 | <text class="goodName">商品名称商品名称商品名称名称名称商品名称名商品名称名</text> | ||
| 19 | <view class="describ"><text>支持7天无理由退货 顺丰发货支持7天无理由退货 顺丰发货支持7天无理由退货 顺丰发货</text> | ||
| 20 | <!-- <text class="icon">></text> --> | ||
| 21 | </view> | ||
| 22 | <view class="priceBox"> | ||
| 23 | <view class="price">¥198</view> | ||
| 24 | <text>(限购{{maxCount}}副)</text> | ||
| 25 | <view class="counter"> | ||
| 26 | <view class="btn" disabled="this.addDisabled" type="default" @click="counter(false)">-</view> | ||
| 27 | <text>{{count}}</text> | ||
| 28 | <view class="btn" disabled="this.desDisabled" type="default" @click="counter(true)">+</view> | ||
| 29 | </view> | ||
| 30 | </view> | ||
| 31 | </view> | ||
| 32 | </view> | ||
| 33 | </view> | ||
| 34 | </view> | ||
| 35 | </label> | ||
| 36 | </checkbox-group> | ||
| 37 | |||
| 38 | |||
| 39 | <view class="footer"> | ||
| 40 | <view class="footerLeft">实付金额:<text>¥{{totalPrice}}</text></view> | ||
| 41 | <view class="footerRight"> | ||
| 42 | <view class="paybtn">立即支付</view> | ||
| 43 | </view> | ||
| 6 | </view> | 44 | </view> |
| 7 | </view> | 45 | </view> |
| 8 | </template> | 46 | </template> |
| 9 | 47 | ||
| 10 | <script> | 48 | <script> |
| 11 | export default { | 49 | export default { |
| 12 | data() { | 50 | data() { |
| 13 | return { | 51 | return { |
| 14 | title: 'Hello' | 52 | totalPrice: 360, |
| 53 | count:1, | ||
| 54 | maxCount:20, | ||
| 15 | } | 55 | } |
| 16 | }, | 56 | }, |
| 17 | onLoad() { | 57 | onLoad() { |
| 18 | 58 | ||
| 19 | }, | 59 | }, |
| 20 | methods: { | 60 | methods: { |
| 21 | 61 | counter(isadd){ | |
| 62 | if(isadd){ | ||
| 63 | this.count >= this.maxCount? this.addDisabled = true:this.count++; | ||
| 64 | }else{ | ||
| 65 | this.count <= 1? this.desDisabled = true:this.count--; | ||
| 66 | } | ||
| 67 | }, | ||
| 22 | } | 68 | } |
| 23 | } | 69 | } |
| 24 | </script> | 70 | </script> |
| 25 | 71 | ||
| 26 | <style> | 72 | <style lang="scss"> |
| 27 | .content { | 73 | .content { |
| 74 | min-height: 100vh; | ||
| 75 | background-color: #F7F6F6; | ||
| 28 | display: flex; | 76 | display: flex; |
| 29 | flex-direction: column; | 77 | flex-direction: column; |
| 30 | align-items: center; | 78 | align-items: center; |
| 31 | justify-content: center; | 79 | justify-content: space-between; |
| 32 | } | 80 | padding: 20rpx 40rpx; |
| 33 | 81 | box-sizing: border-box; | |
| 34 | .logo { | 82 | |
| 35 | height: 200rpx; | 83 | .card{ |
| 36 | width: 200rpx; | 84 | background-color: #FFFFFF; |
| 37 | margin-top: 200rpx; | 85 | border-radius: 16rpx; |
| 38 | margin-left: auto; | 86 | box-sizing: border-box; |
| 39 | margin-right: auto; | 87 | padding: 36rpx 36rpx 36rpx 18rpx; |
| 40 | margin-bottom: 50rpx; | 88 | display: flex; |
| 41 | } | 89 | flex-direction: column; |
| 42 | 90 | align-items: center; | |
| 43 | .text-area { | 91 | justify-content: space-between; |
| 44 | display: flex; | 92 | .cardHeader{ |
| 45 | justify-content: center; | 93 | width: 100%; |
| 46 | } | 94 | height: 36rpx; |
| 47 | 95 | display: flex; | |
| 48 | .title { | 96 | align-items: center; |
| 49 | font-size: 36rpx; | 97 | justify-content: flex-start; |
| 50 | color: #8f8f94; | 98 | image{ |
| 99 | height: 32rpx; | ||
| 100 | width: 32rpx; | ||
| 101 | } | ||
| 102 | } | ||
| 103 | .cardBody{ | ||
| 104 | width: 100%; | ||
| 105 | height: 300rpx; | ||
| 106 | display: flex; | ||
| 107 | align-items: center; | ||
| 108 | justify-content: space-between; | ||
| 109 | .goodInfo{ | ||
| 110 | width: 95%; | ||
| 111 | display: flex; | ||
| 112 | flex-direction: row; | ||
| 113 | justify-content: flex-start; | ||
| 114 | .imageWrap{ | ||
| 115 | height: 188rpx; | ||
| 116 | width: 188rpx; | ||
| 117 | margin-right: 28rpx; | ||
| 118 | image{ | ||
| 119 | height: 188rpx; | ||
| 120 | width: 188rpx; | ||
| 121 | } | ||
| 122 | } | ||
| 123 | .infoRight{ | ||
| 124 | display: flex; | ||
| 125 | flex-direction: column; | ||
| 126 | align-items: flex-start; | ||
| 127 | justify-content: space-between; | ||
| 128 | height: 220rpx; | ||
| 129 | .goodName{ | ||
| 130 | font-size: 28rpx; | ||
| 131 | color: #333333; | ||
| 132 | } | ||
| 133 | .describ{ | ||
| 134 | width: 100%; | ||
| 135 | height: 80rpx; | ||
| 136 | box-sizing: border-box; | ||
| 137 | padding: 10rpx; | ||
| 138 | font-size: 20rpx; | ||
| 139 | color: #999999; | ||
| 140 | background: #F2F2F2; | ||
| 141 | text{ | ||
| 142 | text-overflow: -o-ellipsis-lastline; | ||
| 143 | overflow: hidden; | ||
| 144 | text-overflow: ellipsis; | ||
| 145 | display: -webkit-box; | ||
| 146 | -webkit-line-clamp: 2; | ||
| 147 | line-clamp: 2; | ||
| 148 | -webkit-box-orient: vertical; | ||
| 149 | } | ||
| 150 | // .icon{ | ||
| 151 | // transform: rotate(90deg); | ||
| 152 | // } | ||
| 153 | } | ||
| 154 | .priceBox{ | ||
| 155 | display: flex; | ||
| 156 | justify-content: space-between; | ||
| 157 | align-items: center; | ||
| 158 | width: 100%; | ||
| 159 | font-size: 14px; | ||
| 160 | color: #999999; | ||
| 161 | .price{ | ||
| 162 | color: #FF6B4A; | ||
| 163 | font-size: 28rpx; | ||
| 164 | } | ||
| 165 | .counter{ | ||
| 166 | display: flex; | ||
| 167 | flex-direction: row; | ||
| 168 | justify-content: space-between; | ||
| 169 | align-items: center; | ||
| 170 | font-size: 28rpx; | ||
| 171 | color: #333333; | ||
| 172 | width: 122rpx; | ||
| 173 | .btn{ | ||
| 174 | display: flex; | ||
| 175 | justify-content: center; | ||
| 176 | line-height: 32rpx; | ||
| 177 | height: 32rpx; | ||
| 178 | width: 32rpx; | ||
| 179 | background-color: #F2F2F2; | ||
| 180 | color: #CFCFCF; | ||
| 181 | } | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | } | ||
| 187 | } | ||
| 188 | |||
| 189 | .footer{ | ||
| 190 | position: fixed; | ||
| 191 | left: 0; | ||
| 192 | bottom: 0; | ||
| 193 | height: 112rpx; | ||
| 194 | width: 100%; | ||
| 195 | background-color: #FFFFFF; | ||
| 196 | font-size: 16px; | ||
| 197 | display: flex; | ||
| 198 | justify-content: space-between; | ||
| 199 | align-items: center; | ||
| 200 | .footerLeft{ | ||
| 201 | display: flex; | ||
| 202 | justify-content: center; | ||
| 203 | align-items: center; | ||
| 204 | width: 50%; | ||
| 205 | color: #333333; | ||
| 206 | text{ | ||
| 207 | color: #FF6B4A; | ||
| 208 | } | ||
| 209 | } | ||
| 210 | .footerRight{ | ||
| 211 | display: flex; | ||
| 212 | justify-content: flex-end; | ||
| 213 | align-items: center; | ||
| 214 | width: 50%; | ||
| 215 | margin-right: 26rpx; | ||
| 216 | .paybtn{ | ||
| 217 | display: flex; | ||
| 218 | justify-content: center; | ||
| 219 | align-items: center; | ||
| 220 | background: #FF6B4A; | ||
| 221 | border-radius: 20px; | ||
| 222 | border-radius: 20px; | ||
| 223 | color: #FFFFFF; | ||
| 224 | width: 204rpx; | ||
| 225 | height: 80rpx; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 229 | } | ||
| 51 | } | 230 | } |
| 231 | |||
| 52 | </style> | 232 | </style> |
| 53 | 233 |
src/pages/index/index.vue
| 1 | <template> | 1 | <template> |
| 2 | <view class="content"> | 2 | <view class="content"> |
| 3 | <view class="header"> | 3 | <view class="header"> |
| 4 | <!-- 搜索--> | 4 | <!-- 搜索--> |
| 5 | <view class="searchBar"> | 5 | <view class="searchBar"> |
| 6 | <icon class="searchIcon" type="search" size="14"></icon> | 6 | <icon class="searchIcon" type="search" size="14"></icon> |
| 7 | <input class="searchIpt" placeholder="老花镜" confirm-type="search" /> | 7 | <input class="searchIpt" placeholder="老花镜" confirm-type="search" /> |
| 8 | </view> | 8 | </view> |
| 9 | 9 | ||
| 10 | <!-- 筛选栏--> | 10 | <!-- 筛选栏--> |
| 11 | <view class="screenBar"> | 11 | <view class="screenBar"> |
| 12 | <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)"> | 12 | <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)"> |
| 13 | <view | 13 | <view |
| 14 | class="screenItem" | 14 | class="screenItem" |
| 15 | v-bind:class="{ active: current === item.current }" | 15 | v-bind:class="{ active: current === item.current }" |
| 16 | v-if="item.current === 2" | 16 | v-if="item.current === 2" |
| 17 | @click="dropDown" | 17 | @click="dropDown" |
| 18 | > | 18 | > |
| 19 | {{ item.text }} | 19 | {{ item.text }} |
| 20 | <icon type="info" size="14"></icon> | 20 | <icon type="info" size="14"></icon> |
| 21 | </view> | 21 | </view> |
| 22 | <view | 22 | <view |
| 23 | class="screenItem" | 23 | class="screenItem" |
| 24 | v-bind:class="{ active: current === item.current }" | 24 | v-bind:class="{ active: current === item.current }" |
| 25 | v-if="item.current === 4" | 25 | v-if="item.current === 4" |
| 26 | @click="showDrawer('showRight')" | 26 | @click="showDrawer('showRight')" |
| 27 | > | 27 | > |
| 28 | {{ item.text }} | 28 | {{ item.text }} |
| 29 | <icon type="info" size="14"></icon> | 29 | <icon type="info" size="14"></icon> |
| 30 | </view> | 30 | </view> |
| 31 | <view v-if="item.current !== 2&&item.current!==4"> | 31 | <view v-if="item.current !== 2&&item.current!==4"> |
| 32 | <view | 32 | <view |
| 33 | class="screenItem" | 33 | class="screenItem" |
| 34 | v-bind:class="{ active: current === item.current }" | 34 | v-bind:class="{ active: current === item.current }" |
| 35 | >{{ item.text }}</view> | 35 | >{{ item.text }}</view> |
| 36 | </view> | 36 | </view> |
| 37 | </view> | 37 | </view> |
| 38 | </view> | 38 | </view> |
| 39 | </view> | 39 | </view> |
| 40 | <Uni-drawer | 40 | <Uni-drawer |
| 41 | ref="showRight" | 41 | ref="showRight" |
| 42 | mask="true" | 42 | mask="true" |
| 43 | maskClick="true" | 43 | maskClick="true" |
| 44 | mode="right" | 44 | mode="right" |
| 45 | :width="320" | 45 | :width="320" |
| 46 | @change="change($event,'showRight')" | 46 | @change="change($event,'showRight')" |
| 47 | > | 47 | > |
| 48 | <view class="close"> | 48 | <view class="close"> |
| 49 | <view @click="closeDrawer('showRight')"> | 49 | <view @click="closeDrawer('showRight')"> |
| 50 | <text class="word-btn-white">关闭</text> | 50 | <text class="word-btn-white">关闭</text> |
| 51 | </view> | 51 | </view> |
| 52 | </view> | 52 | </view> |
| 53 | </Uni-drawer> | 53 | </Uni-drawer> |
| 54 | 54 | ||
| 55 | <!-- 筛选菜单--> | 55 | <!-- 筛选菜单--> |
| 56 | <view class="content-wrap"> | 56 | <view class="content-wrap"> |
| 57 | <view> | 57 | <view> |
| 58 | <HMfilterDropdown | 58 | <HMfilterDropdown |
| 59 | :filterData="filterData" | 59 | :filterData="filterData" |
| 60 | :defaultSelected="filterDropdownValue" | 60 | :defaultSelected="filterDropdownValue" |
| 61 | :updateMenuName="true" | 61 | :updateMenuName="true" |
| 62 | @confirm="confirm" | 62 | @confirm="confirm" |
| 63 | data-format="Object" | 63 | data-format="Object" |
| 64 | ></HMfilterDropdown> | 64 | ></HMfilterDropdown> |
| 65 | <!-- 商品列表 --> | 65 | <!-- 商品列表 --> |
| 66 | <view class="goods-list"> | 66 | <view class="goods-list"> |
| 67 | <view class="product-list"> | 67 | <view class="product-list"> |
| 68 | <view class="product" v-for="(goods) in goodsList" :key="goods.id"> | 68 | <view class="product" v-for="(goods) in goodsList" :key="goods.id"> |
| 69 | <Card :goods="goods"></Card> | 69 | <Card :goods="goods"></Card> |
| 70 | </view> | 70 | </view> |
| 71 | </view> | 71 | </view> |
| 72 | <view class="loading-text">{{loadingText}}</view> | 72 | <view class="loading-text">{{loadingText}}</view> |
| 73 | </view> | 73 | </view> |
| 74 | </view> | 74 | </view> |
| 75 | </view> | 75 | </view> |
| 76 | </view> | 76 | </view> |
| 77 | </template> | 77 | </template> |
| 78 | 78 | ||
| 79 | <script> | 79 | <script> |
| 80 | import UniDrawer from "../../components/uni-drawer/uni-drawer.vue"; | 80 | import UniDrawer from "../../components/Uni-drawer/Uni-drawer.vue"; |
| 81 | import Card from "../../components/Card/Card.vue"; | 81 | import Card from "../../components/Card/Card.vue"; |
| 82 | import HMfilterDropdown from "../../components/HM-filterDropdown/HM-filterDropdown.vue"; | 82 | import HMfilterDropdown from "../../components/HM-filterDropdown/HM-filterDropdown.vue"; |
| 83 | import data from "@/common/data.js"; //筛选菜单数据 | 83 | import data from "@/common/data.js"; //筛选菜单数据 |
| 84 | import store from '@/store'; | 84 | import store from '@/store'; |
| 85 | 85 | ||
| 86 | export default { | 86 | export default { |
| 87 | components: { | 87 | components: { |
| 88 | UniDrawer: UniDrawer, | 88 | UniDrawer: UniDrawer, |
| 89 | HMfilterDropdown: HMfilterDropdown, | 89 | HMfilterDropdown: HMfilterDropdown, |
| 90 | Card: Card | 90 | Card: Card |
| 91 | }, | 91 | }, |
| 92 | data() { | 92 | data() { |
| 93 | return { | 93 | return { |
| 94 | screenItems: [ | 94 | screenItems: [ |
| 95 | { current: 0, text: "全部", hasIcon: false }, | 95 | { current: 0, text: "全部", hasIcon: false }, |
| 96 | { current: 1, text: "销量", hasIcon: false }, | 96 | { current: 1, text: "销量", hasIcon: false }, |
| 97 | { current: 2, text: "价格", hasIcon: true }, | 97 | { current: 2, text: "价格", hasIcon: true }, |
| 98 | { current: 3, text: "折扣", hasIcon: false }, | 98 | { current: 3, text: "折扣", hasIcon: false }, |
| 99 | { current: 4, text: "筛选", hasIcon: true } | 99 | { current: 4, text: "筛选", hasIcon: true } |
| 100 | ], | 100 | ], |
| 101 | current: 0, | 101 | current: 0, |
| 102 | showRight: false, | 102 | showRight: false, |
| 103 | indexArr: "", | 103 | indexArr: "", |
| 104 | valueArr: "", | 104 | valueArr: "", |
| 105 | // //商品数据 | 105 | // //商品数据 |
| 106 | // goodsList: [ | 106 | // goodsList: [ |
| 107 | // { | 107 | // { |
| 108 | // // goods_id: 0, | 108 | // // goods_id: 0, |
| 109 | // // img: "/static/img/goods/p1.jpg", | 109 | // // img: "/static/img/goods/p1.jpg", |
| 110 | // // name: "商品名称", | 110 | // // name: "商品名称", |
| 111 | // // originCost: "¥198", | 111 | // // originCost: "¥198", |
| 112 | // // price: "¥168", | 112 | // // price: "¥168", |
| 113 | // // slogan: "1235人浏览" | 113 | // // slogan: "1235人浏览" |
| 114 | // } | 114 | // } |
| 115 | // ], | 115 | // ], |
| 116 | loadingText: "正在加载...", | 116 | loadingText: "正在加载...", |
| 117 | filterDropdownValue: [], | 117 | filterDropdownValue: [], |
| 118 | filterData: [] | 118 | filterData: [] |
| 119 | }; | 119 | }; |
| 120 | }, | 120 | }, |
| 121 | computed: { | 121 | computed: { |
| 122 | goodsList() { | 122 | goodsList() { |
| 123 | // 也可以从 getters 获取 | 123 | // 也可以从 getters 获取 |
| 124 | console.log(this.$store.getters.list); | 124 | console.log(this.$store.getters.list); |
| 125 | return this.$store.state.test.list; | 125 | return this.$store.state.test.list; |
| 126 | } | 126 | } |
| 127 | }, | 127 | }, |
| 128 | filters: { | 128 | filters: { |
| 129 | outData(value) { | 129 | outData(value) { |
| 130 | return JSON.stringify(value); | 130 | return JSON.stringify(value); |
| 131 | } | 131 | } |
| 132 | }, | 132 | }, |
| 133 | onLoad: function() { | 133 | onLoad: function() { |
| 134 | store.dispatch('test/fetch'); | 134 | store.dispatch('test/fetch'); |
| 135 | // uni.request({ | 135 | // uni.request({ |
| 136 | // url: "https://api.glass.xiuyetang.com/app/prod/list", | 136 | // url: "https://api.glass.xiuyetang.com/app/prod/list", |
| 137 | // method: "post", | 137 | // method: "post", |
| 138 | // data: { | 138 | // data: { |
| 139 | // // text: 'uni.request' | 139 | // // text: 'uni.request' |
| 140 | // }, | 140 | // }, |
| 141 | // header: { | 141 | // header: { |
| 142 | // // 'custom-header': 'hello', //自定义请求头信息 | 142 | // // 'custom-header': 'hello', //自定义请求头信息 |
| 143 | // "Content-Type": "application/x-www-form-urlencoded" | 143 | // "Content-Type": "application/x-www-form-urlencoded" |
| 144 | // // 'Content-Type':'multipart/form-data' | 144 | // // 'Content-Type':'multipart/form-data' |
| 145 | // // 'Content-Type':'ext/plain' | 145 | // // 'Content-Type':'ext/plain' |
| 146 | // }, | 146 | // }, |
| 147 | // timeout: 3000, | 147 | // timeout: 3000, |
| 148 | // // dataType:'json' | 148 | // // dataType:'json' |
| 149 | // // responseType:'text', | 149 | // // responseType:'text', |
| 150 | // // sslVerify: true,//验证 ssl 证书 | 150 | // // sslVerify: true,//验证 ssl 证书 |
| 151 | // withCredentials: false, //跨域请求时是否携带凭证(cookies) | 151 | // withCredentials: false, //跨域请求时是否携带凭证(cookies) |
| 152 | // success: res => { | 152 | // success: res => { |
| 153 | // console.error("success status === > ", res); | 153 | // console.error("success status === > ", res); |
| 154 | // this.goodsList = res.data.data; | 154 | // this.goodsList = res.data.data; |
| 155 | // // console.log('res.data', res.data); | 155 | // // console.log('res.data', res.data); |
| 156 | // // this.text = 'request success'; | 156 | // // this.text = 'request success'; |
| 157 | // }, | 157 | // }, |
| 158 | // fail: res => { | 158 | // fail: res => { |
| 159 | // console.log("fail status === > ", res); | 159 | // console.log("fail status === > ", res); |
| 160 | // }, | 160 | // }, |
| 161 | // complete: res => { | 161 | // complete: res => { |
| 162 | // console.log("complete status === > ", res); | 162 | // console.log("complete status === > ", res); |
| 163 | // } | 163 | // } |
| 164 | // }); | 164 | // }); |
| 165 | //定时器模拟ajax异步请求数据 | 165 | //定时器模拟ajax异步请求数据 |
| 166 | // setTimeout(()=>{ | 166 | // setTimeout(()=>{ |
| 167 | // //传入defaultSelected的结构不能错,错了就报错运行异常。 不选中的项目传入null | 167 | // //传入defaultSelected的结构不能错,错了就报错运行异常。 不选中的项目传入null |
| 168 | // this.filterDropdownValue = [ | 168 | // this.filterDropdownValue = [ |
| 169 | // [1,1,0], //第0个菜单选中 一级菜单的第1项,二级菜单的第1项,三级菜单的第3项 | 169 | // [1,1,0], //第0个菜单选中 一级菜单的第1项,二级菜单的第1项,三级菜单的第3项 |
| 170 | // [null,null], //第1个菜单选中 都不选中 | 170 | // [null,null], //第1个菜单选中 都不选中 |
| 171 | // [1], //第2个菜单选中 一级菜单的第1项 | 171 | // [1], //第2个菜单选中 一级菜单的第1项 |
| 172 | // [[0],[1,2,7],[1,0]], //筛选菜单选中 第一个筛选的第0项,第二个筛选的第1,2,7项,第三个筛选的第1,0项 | 172 | // [[0],[1,2,7],[1,0]], //筛选菜单选中 第一个筛选的第0项,第二个筛选的第1,2,7项,第三个筛选的第1,0项 |
| 173 | // [[0],[1],[1]], //单选菜单选中 第一个筛选的第0项,第二个筛选的第1项,第三个筛选的第1项 | 173 | // [[0],[1],[1]], //单选菜单选中 第一个筛选的第0项,第二个筛选的第1项,第三个筛选的第1项 |
| 174 | // ]; | 174 | // ]; |
| 175 | // this.filterData = data; | 175 | // this.filterData = data; |
| 176 | // },100); | 176 | // },100); |
| 177 | // 模拟ajax请求子菜单数据。 | 177 | // 模拟ajax请求子菜单数据。 |
| 178 | // setTimeout(()=>{ | 178 | // setTimeout(()=>{ |
| 179 | // console.log('发起请求','ddddddd'); | 179 | // console.log('发起请求','ddddddd'); |
| 180 | // // this.filterData[1].submenu[0].submenu = [{"name": "附近","value": "附近"},{"name": "1km","value": "1km"},{"name": "2km","value": "2km"},{"name": "3km","value": "3km"},{"name": "4km","value": "4km"},{"name": "5km","value": "5km"}]; | 180 | // // this.filterData[1].submenu[0].submenu = [{"name": "附近","value": "附近"},{"name": "1km","value": "1km"},{"name": "2km","value": "2km"},{"name": "3km","value": "3km"},{"name": "4km","value": "4km"},{"name": "5km","value": "5km"}]; |
| 181 | // },3000); | 181 | // },3000); |
| 182 | }, | 182 | }, |
| 183 | methods: { | 183 | methods: { |
| 184 | showDrawer(e) { | 184 | showDrawer(e) { |
| 185 | this.$refs[e].open(); | 185 | this.$refs[e].open(); |
| 186 | }, | 186 | }, |
| 187 | closeDrawer(e) { | 187 | closeDrawer(e) { |
| 188 | this.$refs[e].close(); | 188 | this.$refs[e].close(); |
| 189 | }, | 189 | }, |
| 190 | change(e, type) { | 190 | change(e, type) { |
| 191 | this[type] = e; | 191 | this[type] = e; |
| 192 | }, | 192 | }, |
| 193 | onClickItem(e) { | 193 | onClickItem(e) { |
| 194 | if (this.current !== e) { | 194 | if (this.current !== e) { |
| 195 | this.current = e; | 195 | this.current = e; |
| 196 | } | 196 | } |
| 197 | }, | 197 | }, |
| 198 | dropDown() { | 198 | dropDown() { |
| 199 | console.log("下拉"); | 199 | console.log("下拉"); |
| 200 | }, | 200 | }, |
| 201 | //接收菜单结果 | 201 | //接收菜单结果 |
| 202 | confirm(e) { | 202 | confirm(e) { |
| 203 | this.indexArr = e.index; | 203 | this.indexArr = e.index; |
| 204 | this.valueArr = e.value; | 204 | this.valueArr = e.value; |
| 205 | return; | 205 | return; |
| 206 | console.log("修改菜单"); | 206 | console.log("修改菜单"); |
| 207 | this.filterData[4].submenu[1] = { | 207 | this.filterData[4].submenu[1] = { |
| 208 | name: "项目2", | 208 | name: "项目2", |
| 209 | submenu: [] | 209 | submenu: [] |
| 210 | }; | 210 | }; |
| 211 | } | 211 | } |
| 212 | }, | 212 | }, |
| 213 | onNavigationBarButtonTap(e) { | 213 | onNavigationBarButtonTap(e) { |
| 214 | this.showRight = !this.showRight; | 214 | this.showRight = !this.showRight; |
| 215 | }, | 215 | }, |
| 216 | //上拉加载, | 216 | //上拉加载, |
| 217 | onReachBottom() { | 217 | onReachBottom() { |
| 218 | console.log("到底加载"); | 218 | console.log("到底加载"); |
| 219 | let len = this.goodsList.length; | 219 | let len = this.goodsList.length; |
| 220 | if (len >= 30) { | 220 | if (len >= 30) { |
| 221 | this.loadingText = "~~到底了~~"; | 221 | this.loadingText = "~~到底了~~"; |
| 222 | return false; | 222 | return false; |
| 223 | } else { | 223 | } else { |
| 224 | this.loadingText = "正在加载..."; | 224 | this.loadingText = "正在加载..."; |
| 225 | } | 225 | } |
| 226 | let end_goods_id = this.goodsList[len - 1].goods_id; | 226 | let end_goods_id = this.goodsList[len - 1].goods_id; |
| 227 | for (let i = 1; i <= 10; i++) { | 227 | for (let i = 1; i <= 10; i++) { |
| 228 | let goods_id = end_goods_id + i; | 228 | let goods_id = end_goods_id + i; |
| 229 | let p = { | 229 | let p = { |
| 230 | goods_id: goods_id, | 230 | goods_id: goods_id, |
| 231 | img: | 231 | img: |
| 232 | "/static/img/goods/p" + | 232 | "/static/img/goods/p" + |
| 233 | (goods_id % 10 == 0 ? 10 : goods_id % 10) + | 233 | (goods_id % 10 == 0 ? 10 : goods_id % 10) + |
| 234 | ".jpg", | 234 | ".jpg", |
| 235 | name: "商品名称", | 235 | name: "商品名称", |
| 236 | originCost: "¥198", | 236 | originCost: "¥198", |
| 237 | price: "¥168", | 237 | price: "¥168", |
| 238 | slogan: "1235人付款" | 238 | slogan: "1235人付款" |
| 239 | }; | 239 | }; |
| 240 | this.goodsList.push(p); | 240 | this.goodsList.push(p); |
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| 243 | }; | 243 | }; |
| 244 | </script> | 244 | </script> |
| 245 | 245 | ||
| 246 | <style lang="scss"> | 246 | <style lang="scss"> |
| 247 | .content { | 247 | .content { |
| 248 | display: flex; | 248 | display: flex; |
| 249 | flex-direction: column; | 249 | flex-direction: column; |
| 250 | align-items: center; | 250 | align-items: center; |
| 251 | justify-content: center; | 251 | justify-content: center; |
| 252 | background-color: #f7f6f6; | 252 | background-color: #f7f6f6; |
| 253 | } | 253 | } |
| 254 | .header { | 254 | .header { |
| 255 | display: flex; | 255 | display: flex; |
| 256 | flex-direction: column; | 256 | flex-direction: column; |
| 257 | align-items: center; | 257 | align-items: center; |
| 258 | justify-content: center; | 258 | justify-content: center; |
| 259 | background-color: #f7f6f6; | 259 | background-color: #f7f6f6; |
| 260 | height: 178rpx; | 260 | height: 178rpx; |
| 261 | width: 100%; | 261 | width: 100%; |
| 262 | z-index: 999; | 262 | z-index: 999; |
| 263 | position: fixed; | 263 | position: fixed; |
| 264 | top: 0; | 264 | top: 0; |
| 265 | left: 0; | 265 | left: 0; |
| 266 | } | 266 | } |
| 267 | .searchBar { | 267 | .searchBar { |
| 268 | width: 670rpx; | 268 | width: 670rpx; |
| 269 | display: flex; | 269 | display: flex; |
| 270 | justify-content: center; | 270 | justify-content: center; |
| 271 | align-items: center; | 271 | align-items: center; |
| 272 | box-sizing: border-box; | 272 | box-sizing: border-box; |
| 273 | padding: 0rpx 16rpx; | 273 | padding: 0rpx 16rpx; |
| 274 | border: 1px solid #ff6b4a; | 274 | border: 1px solid #ff6b4a; |
| 275 | border-radius: 8rpx; | 275 | border-radius: 8rpx; |
| 276 | background-color: #ffffff; | 276 | background-color: #ffffff; |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | .searchIpt { | 279 | .searchIpt { |
| 280 | height: 68rpx; | 280 | height: 68rpx; |
| 281 | width: 670rpx; | 281 | width: 670rpx; |
| 282 | padding: 16rpx; | 282 | padding: 16rpx; |
| 283 | font-size: 28rpx; | 283 | font-size: 28rpx; |
| 284 | box-sizing: border-box; | 284 | box-sizing: border-box; |
| 285 | } | 285 | } |
| 286 | .screenBar { | 286 | .screenBar { |
| 287 | width: 670rpx; | 287 | width: 670rpx; |
| 288 | height: 110rpx; | 288 | height: 110rpx; |
| 289 | display: flex; | 289 | display: flex; |
| 290 | flex-direction: row; | 290 | flex-direction: row; |
| 291 | justify-content: space-between; | 291 | justify-content: space-between; |
| 292 | align-items: center; | 292 | align-items: center; |
| 293 | color: #333333; | 293 | color: #333333; |
| 294 | font-size: 32rpx; | 294 | font-size: 32rpx; |
| 295 | } | 295 | } |
| 296 | .active { | 296 | .active { |
| 297 | color: #ff6b4a; | 297 | color: #ff6b4a; |
| 298 | } | 298 | } |
| 299 | .screenItem { | 299 | .screenItem { |
| 300 | display: flex; | 300 | display: flex; |
| 301 | justify-content: center; | 301 | justify-content: center; |
| 302 | align-items: center; | 302 | align-items: center; |
| 303 | } | 303 | } |
| 304 | .content-wrap { | 304 | .content-wrap { |
| 305 | width: 100%; | 305 | width: 100%; |
| 306 | background-color: #ffffff; | 306 | background-color: #ffffff; |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | .HMfilterDropdown { | 309 | .HMfilterDropdown { |
| 310 | top: 178rpx !important; | 310 | top: 178rpx !important; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | .goods-list { | 313 | .goods-list { |
| 314 | padding-top: 286rpx; | 314 | padding-top: 286rpx; |
| 315 | .loading-text { | 315 | .loading-text { |
| 316 | width: 100%; | 316 | width: 100%; |
| 317 | display: flex; | 317 | display: flex; |
| 318 | justify-content: center; | 318 | justify-content: center; |
| 319 | align-items: center; | 319 | align-items: center; |
| 320 | height: 30px; | 320 | height: 30px; |
| 321 | color: #979797; | 321 | color: #979797; |
| 322 | font-size: 12px; | 322 | font-size: 12px; |
| 323 | } | 323 | } |
| 324 | .product-list { | 324 | .product-list { |
| 325 | width: 92%; | 325 | width: 92%; |
| 326 | padding: 0 4% 3vw 4%; | 326 | padding: 0 4% 3vw 4%; |
| 327 | display: flex; | 327 | display: flex; |
| 328 | justify-content: space-between; | 328 | justify-content: space-between; |
| 329 | flex-wrap: wrap; | 329 | flex-wrap: wrap; |
| 330 | .product { | 330 | .product { |
| 331 | width: 48%; | 331 | width: 48%; |
| 332 | margin: 0 0 20rpx 0; | 332 | margin: 0 0 20rpx 0; |
| 333 | background: #ffffff; | 333 | background: #ffffff; |
| 334 | border: 1px solid #f2f2f2; | 334 | border: 1px solid #f2f2f2; |
| 335 | } | 335 | } |
| 336 | } | 336 | } |
| 337 | } | 337 | } |
| 338 | </style> | 338 | </style> |
| 339 | 339 |
src/pages/myOrder/myOrder.vue
| 1 | <template> | 1 | <template> |
| 2 | <view class="content"> | 2 | <view class="content"> |
| 3 | <view class="header"> | 3 | <view class="header"> |
| 4 | <!-- 搜索--> | 4 | <!-- 搜索--> |
| 5 | <view class="searchBar"> | 5 | <view class="searchBar"> |
| 6 | <icon class="searchIcon" type="search" size="14"></icon> | 6 | <icon class="searchIcon" type="search" size="14"></icon> |
| 7 | <input class="searchIpt" placeholder="搜索订单关键字..." confirm-type="search"/> | 7 | <input class="searchIpt" placeholder="搜索订单关键字..." confirm-type="search"/> |
| 8 | </view> | 8 | </view> |
| 9 | <view class="screenBar"> | 9 | <view class="screenBar"> |
| 10 | <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)" > | 10 | <view v-for="item in screenItems" :key="item.current" @click="onClickItem(item.current)" > |
| 11 | <view class="screenItem" v-bind:class="{ active: current === item.current }">{{ item.text }}</view> | 11 | <view class="screenItem" v-bind:class="{ active: current === item.current }">{{ item.text }}</view> |
| 12 | </view> | 12 | </view> |
| 13 | </view> | 13 | </view> |
| 14 | </view> | 14 | </view> |
| 15 | <view class="orderList" > | 15 | <view class="orderList" > |
| 16 | <view v-for="(order) in orderList" :key="order.orderId"> | 16 | <view v-for="(order) in orderList" :key="order.orderId"> |
| 17 | <OrderCard :order = "order" :current="current"></OrderCard> | 17 | <OrderCard :order = "order" :current="current"></OrderCard> |
| 18 | </view> | 18 | </view> |
| 19 | </view> | 19 | </view> |
| 20 | <view class="footer">已显示全部</view> | 20 | <view class="footer">已显示全部</view> |
| 21 | </view> | 21 | </view> |
| 22 | </template> | 22 | </template> |
| 23 | <script> | 23 | <script> |
| 24 | import OrderCard from './orderCard.vue' | 24 | import OrderCard from './OrderCard.vue' |
| 25 | export default { | 25 | export default { |
| 26 | components:{ | 26 | components:{ |
| 27 | 'OrderCard':OrderCard | 27 | 'OrderCard':OrderCard |
| 28 | }, | 28 | }, |
| 29 | data() { | 29 | data() { |
| 30 | return { | 30 | return { |
| 31 | screenItems: [ | 31 | screenItems: [ |
| 32 | {current:0,text:'全部'}, | 32 | {current:0,text:'全部'}, |
| 33 | {current:1,text:'待付款'}, | 33 | {current:1,text:'待付款'}, |
| 34 | {current:2,text:'待发货'}, | 34 | {current:2,text:'待发货'}, |
| 35 | {current:3,text:'待收货'}, | 35 | {current:3,text:'待收货'}, |
| 36 | {current:4,text:'退款售后'}, | 36 | {current:4,text:'退款售后'}, |
| 37 | ], | 37 | ], |
| 38 | current: 0, | 38 | current: 0, |
| 39 | //订单数据 | 39 | //订单数据 |
| 40 | orderList:[ | 40 | orderList:[ |
| 41 | { orderId: 0, img: '/static/img/goods/p1.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, | 41 | { orderId: 0, img: '/static/img/goods/p1.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, |
| 42 | { orderId: 2, img: '/static/img/goods/p3.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, | 42 | { orderId: 2, img: '/static/img/goods/p3.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:1 ,buyNum:1}, |
| 43 | { orderId: 3, img: '/static/img/goods/p4.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:2 ,buyNum:1}, | 43 | { orderId: 3, img: '/static/img/goods/p4.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:2 ,buyNum:1}, |
| 44 | { orderId: 4, img: '/static/img/goods/p5.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, | 44 | { orderId: 4, img: '/static/img/goods/p5.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, |
| 45 | { orderId: 5, img: '/static/img/goods/p6.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, | 45 | { orderId: 5, img: '/static/img/goods/p6.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:3 ,buyNum:1}, |
| 46 | { orderId: 6, img: '/static/img/goods/p7.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, | 46 | { orderId: 6, img: '/static/img/goods/p7.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, |
| 47 | { orderId: 7, img: '/static/img/goods/p8.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, | 47 | { orderId: 7, img: '/static/img/goods/p8.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:4 ,buyNum:1}, |
| 48 | { orderId: 8, img: '/static/img/goods/p9.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1}, | 48 | { orderId: 8, img: '/static/img/goods/p9.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1}, |
| 49 | { orderId: 9, img: '/static/img/goods/p10.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1} | 49 | { orderId: 9, img: '/static/img/goods/p10.jpg', name: '商品名称',originCost:'¥198',price: '¥168', orderType:5 ,buyNum:1} |
| 50 | ], | 50 | ], |
| 51 | 51 | ||
| 52 | }; | 52 | }; |
| 53 | }, | 53 | }, |
| 54 | methods:{ | 54 | methods:{ |
| 55 | onClickItem(e) { | 55 | onClickItem(e) { |
| 56 | if (this.current !== e) { | 56 | if (this.current !== e) { |
| 57 | this.current = e; | 57 | this.current = e; |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | } | 61 | } |
| 62 | </script> | 62 | </script> |
| 63 | 63 | ||
| 64 | <style lang="scss"> | 64 | <style lang="scss"> |
| 65 | .content { | 65 | .content { |
| 66 | display: flex; | 66 | display: flex; |
| 67 | flex-direction: column; | 67 | flex-direction: column; |
| 68 | align-items: center; | 68 | align-items: center; |
| 69 | background-color: #F7F6F6; | 69 | background-color: #F7F6F6; |
| 70 | min-height: 100vh; | 70 | min-height: 100vh; |
| 71 | .header{ | 71 | .header{ |
| 72 | background-color: #ffffff; | 72 | background-color: #ffffff; |
| 73 | width: 100%; | 73 | width: 100%; |
| 74 | height: 232rpx; | 74 | height: 232rpx; |
| 75 | padding: 40rpx 40rpx 36rpx 40rpx; | 75 | padding: 40rpx 40rpx 36rpx 40rpx; |
| 76 | box-sizing: border-box; | 76 | box-sizing: border-box; |
| 77 | position: fixed; | 77 | position: fixed; |
| 78 | top: 0; | 78 | top: 0; |
| 79 | left: 0; | 79 | left: 0; |
| 80 | .searchBar { | 80 | .searchBar { |
| 81 | width: 670rpx; | 81 | width: 670rpx; |
| 82 | display: flex; | 82 | display: flex; |
| 83 | justify-content: center; | 83 | justify-content: center; |
| 84 | align-items: center; | 84 | align-items: center; |
| 85 | box-sizing: border-box; | 85 | box-sizing: border-box; |
| 86 | padding: 0rpx 16rpx; | 86 | padding: 0rpx 16rpx; |
| 87 | border: 1px solid #FF6B4A; | 87 | border: 1px solid #FF6B4A; |
| 88 | border-radius: 8rpx; | 88 | border-radius: 8rpx; |
| 89 | background-color: #ffffff; | 89 | background-color: #ffffff; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | .screenBar{ | 92 | .screenBar{ |
| 93 | width: 670rpx; | 93 | width: 670rpx; |
| 94 | height: 110rpx; | 94 | height: 110rpx; |
| 95 | display: flex; | 95 | display: flex; |
| 96 | flex-direction: row; | 96 | flex-direction: row; |
| 97 | justify-content: space-between; | 97 | justify-content: space-between; |
| 98 | align-items: center; | 98 | align-items: center; |
| 99 | color: #333333; | 99 | color: #333333; |
| 100 | font-size: 32rpx; | 100 | font-size: 32rpx; |
| 101 | } | 101 | } |
| 102 | .screenItem{ | 102 | .screenItem{ |
| 103 | height: 50rpx; | 103 | height: 50rpx; |
| 104 | font-size: 32rpx; | 104 | font-size: 32rpx; |
| 105 | color: #333333; | 105 | color: #333333; |
| 106 | display: flex; | 106 | display: flex; |
| 107 | justify-content: center; | 107 | justify-content: center; |
| 108 | align-items: center; | 108 | align-items: center; |
| 109 | transition:all 0.2s; | 109 | transition:all 0.2s; |
| 110 | } | 110 | } |
| 111 | .active{ | 111 | .active{ |
| 112 | // font-size: 34rpx; | 112 | // font-size: 34rpx; |
| 113 | color: #EC5D3B; | 113 | color: #EC5D3B; |
| 114 | } | 114 | } |
| 115 | .searchIpt { | 115 | .searchIpt { |
| 116 | height: 68rpx; | 116 | height: 68rpx; |
| 117 | width: 670rpx; | 117 | width: 670rpx; |
| 118 | padding: 16rpx; | 118 | padding: 16rpx; |
| 119 | font-size: 28rpx; | 119 | font-size: 28rpx; |
| 120 | box-sizing: border-box; | 120 | box-sizing: border-box; |
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| 123 | .orderList{ | 123 | .orderList{ |
| 124 | margin-top: 232rpx; | 124 | margin-top: 232rpx; |
| 125 | } | 125 | } |
| 126 | .footer{ | 126 | .footer{ |
| 127 | font-size: 14px; | 127 | font-size: 14px; |
| 128 | color: #B8B8B8; | 128 | color: #B8B8B8; |
| 129 | margin: 40rpx 0; | 129 | margin: 40rpx 0; |
| 130 | } | 130 | } |
| 131 | } | 131 | } |
| 132 | </style> | 132 | </style> |
| 133 | 133 |