时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

187 lines
5.2 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <mescroll-body ref="mescrollRef" @down="downCallback" :down="downOpt" style="min-height: 645px;">
  4. <!-- 商品信息 -->
  5. <self-line/>
  6. <view class="bg-white padding-tb-sm">
  7. <skeleton :loading="skeletonLoading" :row="2" :showAvatar="false" :showTitle="true">
  8. <view class="flex justify-between align-start padding-top-sm padding-lr">
  9. <image :src="orderDetails.goods.cover" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image>
  10. <view class="flex-sub padding-left-sm">
  11. <view class="bref-box margin-top-xs">
  12. {{orderDetails.goods.name}}
  13. </view>
  14. <view class="flex justify-between">
  15. <text class="block margin-top-sm text-gray text-sm">数量</text>
  16. <view class="flex align-center margin-top-sm">
  17. <text class="cuIcon-move" @tap="reduce"></text>
  18. <input type="number" v-model="num" class="text-center margin-lr-sm radius" style="width: 60rpx; height: 50rpx;background-color: #f7f7fb;" />
  19. <text class="cuIcon-add" @tap="add"></text>
  20. </view>
  21. </view>
  22. <view class="flex justify-between margin-top-sm">
  23. <view class="text-red text-price text-lg">
  24. <amount :value="Number(orderDetails.goods.specs[0].selling_price || 0)" :is-round-up="false" :precision="2" :duration="800" transition></amount>
  25. </view>
  26. <!-- <view>
  27. <button v-if="true" class="cu-btn line-orange round margin-left-sm text-sm">申请退款</button>
  28. <button v-else class="cu-btn line-gray bg-gray round margin-left-sm text-sm">退款中</button>
  29. </view> -->
  30. </view>
  31. </view>
  32. </view>
  33. </skeleton>
  34. </view>
  35. <self-line/>
  36. <view class="bg-white">
  37. <view class="cu-bar padding-lr solid-bottom">
  38. <text class="text-gray">优惠</text>
  39. <text>暂无优惠</text>
  40. </view>
  41. </view>
  42. <self-line/>
  43. </mescroll-body>
  44. <view class="btn-bottom">
  45. <view class="padding flex justify-around align-center">
  46. <view class="margin-right">
  47. <checkbox :class="checkbox[0].checked?'checked':''" :checked="checkbox[0].checked?true:false" value="A"></checkbox>
  48. </view>
  49. <view class="text-sm text-gray">{{orderDetails.agreement.tips}}</view>
  50. </view>
  51. <self-line/>
  52. <view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top shadow">
  53. <view class="flex align-center">
  54. <text class="">应付款</text>
  55. <view class="text-lg text-price text-red">
  56. <amount :value="Number(orderDetails.goods.specs[0].selling_price*num || 0)" :is-round-up="false" :precision="2" :duration="800" transition></amount>
  57. </view>
  58. </view>
  59. <button class="cu-btn block bg-orange round shadow" @tap="submit">
  60. <text class="cuIcon-loading2 cuIconfont-spin margin-right-xs text-white" v-if="loading"></text>
  61. <text class="text-df text-white">{{ loading ? '支付中...' : '下单付款' }}</text>
  62. </button>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  69. export default {
  70. mixins: [MescrollMixin], // 使用mixin
  71. data() {
  72. return {
  73. num: 1,
  74. base64Img: '', //
  75. skeletonLoading: true,
  76. loading: false,
  77. checkbox: [{
  78. value: 'A',
  79. checked: true
  80. }],
  81. goods_id: 1,
  82. goods_specs_id: 1,
  83. orderDetails: {}
  84. }
  85. },
  86. computed: {
  87. total(){
  88. return this.num * this.price
  89. }
  90. },
  91. onLoad(e) {
  92. this.goods_id = e.goods_id
  93. this.goods_specs_id = e.goods_specs_id
  94. },
  95. methods: {
  96. getConfirmOrder() {
  97. this.$http(this.API.API_COFIRMORDER_DETAILS, {goods_id: this.goods_id,goods_specs_id: this.goods_specs_id}).then(res => {
  98. if(res.code == 0) {
  99. this.orderDetails = res.data
  100. this.skeletonLoading = false
  101. this.mescroll.endSuccess(); // 请求成功,隐藏加载状态
  102. console.log(this.orderDetails)
  103. }
  104. }).catch(err => {
  105. });
  106. },
  107. reduce() {
  108. if (this.num === 1) return
  109. this.num--
  110. },
  111. add() {
  112. this.num++
  113. },
  114. CheckboxChange(e) {
  115. var items = this.checkbox,
  116. values = e.detail.value;
  117. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  118. items[i].checked = false;
  119. for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
  120. if (items[i].value == values[j]) {
  121. items[i].checked = true;
  122. break
  123. }
  124. }
  125. }
  126. },
  127. // 点击复制
  128. copy(text) {
  129. uni.setClipboardData({
  130. data: text
  131. });
  132. },
  133. submit(){
  134. this.$routerGo('/pages/order/pay-success')
  135. },
  136. //下拉刷新
  137. downCallback() {
  138. this.getConfirmOrder()
  139. },
  140. },
  141. created() {
  142. this.getConfirmOrder()
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. .address-box {
  148. // background-image: url(../../static/images/shop/envelope.png);
  149. background-repeat: repeat-x;
  150. background-position: left bottom;
  151. background-size: auto 8rpx;
  152. }
  153. .self-img-sm {
  154. width: 40rpx;
  155. height: 40rpx;
  156. }
  157. .bref-box {
  158. text-overflow: -o-ellipsis-lastline;
  159. overflow: hidden;
  160. text-overflow: ellipsis;
  161. display: -webkit-box;
  162. -webkit-line-clamp: 2;
  163. -webkit-box-orient: vertical;
  164. }
  165. .order-bottom {
  166. position: relative;
  167. .cuIcon-fold {
  168. position: absolute;
  169. right: 50rpx;
  170. top: -19rpx;
  171. color: rgba(0, 0, 0, 0.1)
  172. }
  173. }
  174. </style>