index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <view class="cart-pages">
  3. <view class="cart-bar">
  4. <view>
  5. <u-image height="40rpx" width="40rpx" src="/static/position.png"></u-image>
  6. </view>
  7. <view class="position">
  8. <view class="address">陕西省西安市未央区华帝金座A座6楼</view>
  9. <view>王明 1456465455</view>
  10. </view>
  11. <view @click="editAddress">
  12. <u-image height="50rpx" width="50rpx" src="/static/edit.png"></u-image>
  13. </view>
  14. </view>
  15. <view class="goods-list">
  16. <!-- 商品列表 -->
  17. <view class="goods-item" v-for="(item,index) in goodsList" :key="item.id">
  18. <view class="goods-imgs">
  19. <u-image border-radius="12" width="158rpx" height="140rpx" :src="item.goods.homeImage"></u-image>
  20. </view>
  21. <view class="goods-info">
  22. <view class="good-name">{{item.goods.name}}</view>
  23. <view class="goods-price">
  24. <view>
  25. <text>{{item.goods.sellGold}}</text>
  26. <u-image mode="scaleToFill" width="30rpx" height="30rpx" src="/static/ledou.png"></u-image>
  27. </view>
  28. <view>×{{item.buyQty}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 总计 -->
  33. <view class="goods-heji">
  34. <view>
  35. <view>商品合计:</view>
  36. <view class="heji">
  37. <text>{{totalPrice}}</text>
  38. <u-image mode="scaleToFill" width="35rpx" height="35rpx" src="/static/ledou.png"></u-image>
  39. </view>
  40. </view>
  41. <view>
  42. <view>运费:</view>
  43. <view>免运费</view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="cart-submit">
  48. <view>
  49. <view>总计:<text>{{totalPrice}}</text></view>
  50. <u-image mode="scaleToFill" width="40rpx" height="40rpx" src="/static/ledou.png"></u-image>
  51. </view>
  52. <view>
  53. <u-button size="mini" :custom-style="toOrderButton" type="error" @click="toPay">确认支付</u-button>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. findAddressBycustomerNo
  61. } from '@/api/receiveAddress.js'
  62. export default {
  63. data() {
  64. return {
  65. toOrderButton: {
  66. borderRadius:'100rpx',
  67. fontSize:'30rpx',
  68. width: '180rpx',
  69. height: '60rpx'
  70. },
  71. goodsList: []
  72. };
  73. },
  74. onLoad() {
  75. this.goodsList = this.$store.state.vuex_toOrderList
  76. this.getLocation()
  77. },
  78. computed: {
  79. totalPrice() {
  80. let total = 0
  81. this.goodsList.map(item => {
  82. total = total + item.buyQty * item.goods.sellGold
  83. })
  84. return total
  85. }
  86. },
  87. methods: {
  88. // 获取用户位置
  89. getLocation() {
  90. findAddressBycustomerNo({customerNo:'12313'}).then(res => {
  91. console.log(res)
  92. })
  93. },
  94. //修改收货地址信息
  95. editAddress(){
  96. uni.navigateTo({
  97. url:"/pages/toOrder/editAddress"
  98. })
  99. },
  100. // 支付
  101. toPay(){
  102. }
  103. },
  104. }
  105. </script>
  106. <style lang="scss">
  107. page{
  108. height: 100%;
  109. }
  110. .cart-pages{
  111. width: 100%;
  112. height: 100%;
  113. display: flex;
  114. flex-direction: column;
  115. .cart-bar{
  116. background: #FFFFFF;
  117. border-bottom: 1px solid #F8F8F8;
  118. border-top: 10upx solid #F8F8F8;
  119. display: flex;
  120. align-items: center;
  121. padding:15upx 20upx;
  122. .position{
  123. flex-grow: 1;
  124. }
  125. > view{
  126. padding: 10upx;
  127. .address{
  128. padding: 5upx 0;
  129. }
  130. &:last-child{
  131. padding: 0 20upx;
  132. }
  133. }
  134. }
  135. .goods-list{
  136. padding: 20upx 0;
  137. flex-grow: 1;
  138. overflow: auto;
  139. .goods-class-box{
  140. background: #FFFFFF;
  141. box-shadow: 1px 1px 3px #eee;
  142. margin-bottom: 20upx;
  143. }
  144. .goods-item{
  145. padding: 20upx 40upx;
  146. display: flex;
  147. align-items: center;
  148. border-bottom: 1px solid #F8F8F8;
  149. background: #fff;
  150. &:last-child{
  151. border: 0;
  152. }
  153. .goods-imgs{
  154. position: relative;
  155. }
  156. .goods-info{
  157. flex-grow: 1;
  158. padding-left: 20upx;
  159. .good-name{
  160. font-weight: bold;
  161. word-break: break-all;
  162. }
  163. }
  164. .goods-price{
  165. display: flex;
  166. align-items: center;
  167. justify-content: space-between;
  168. padding-top: 20upx;
  169. >view{
  170. &:first-child{
  171. display: flex;
  172. align-items: center;
  173. text{
  174. color: red;
  175. font-size: 35upx;
  176. margin-right: 6upx;
  177. font-weight: bold;
  178. }
  179. }
  180. }
  181. }
  182. }
  183. }
  184. .goods-heji{
  185. padding: 20upx 40upx;
  186. background: #FFFFFF;
  187. box-shadow: 1px 1px 3px #eee;
  188. margin-top: 20upx;
  189. >view{
  190. display: flex;
  191. align-items: center;
  192. justify-content: space-between;
  193. padding: 10upx 0;
  194. .heji{
  195. display: flex;
  196. align-items: center;
  197. text{
  198. color: red;
  199. margin-right: 6upx;
  200. font-size: 35upx;
  201. font-weight: bold;
  202. }
  203. }
  204. }
  205. }
  206. .cart-submit{
  207. padding: 20upx 30upx;
  208. background: #FFFFFF;
  209. box-shadow: 1px 1px 3px #eee;
  210. border-top: 1px solid #eee;
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. > view{
  215. &:first-child{
  216. display: flex;
  217. align-items: center;
  218. text{
  219. color: red;
  220. font-size: 40upx;
  221. margin-right: 6upx;
  222. font-weight: bold;
  223. }
  224. }
  225. }
  226. }
  227. }
  228. </style>