时空网前端
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.

213 lines
5.7 KiB

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="@/static/tu.png" 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. 网红辣椒棒 魔鬼辣椒挑战全网第一辣 网红优惠季
  13. </view>
  14. <view class="flex justify-between">
  15. <text class="block margin-top-sm text-gray text-sm">网红辣椒棒 500g</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(19.90*num || 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">请认真阅读并同意时空网协议在小程序下单购买即表示您已默认同意时空网协议的所有条款</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(total || 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. area: '币种地址',
  75. base64Img: '', //
  76. skeletonLoading: true,
  77. payCur: 0, //支付方式下标
  78. loading: false,
  79. address: {},
  80. shopData: {},
  81. payPwd: '',
  82. price: '', //价格
  83. checkbox: [{
  84. value: 'A',
  85. checked: true
  86. }, {
  87. value: 'B',
  88. checked: true
  89. }, {
  90. value: 'C',
  91. checked: false
  92. }],
  93. }
  94. },
  95. computed: {
  96. disabled() {
  97. // 必须输入 邮箱和验证码 才能点击下一步
  98. // if (this.payPwd) return false
  99. return true
  100. },
  101. total(){
  102. return this.num * this.price
  103. }
  104. },
  105. onLoad(e) {
  106. setTimeout(()=>{
  107. this.skeletonLoading = false
  108. this.mescroll.endSuccess(); // 请求成功,隐藏加载状态
  109. },1000)
  110. },
  111. methods: {
  112. reduce() {
  113. if (this.num === 1) return
  114. this.num--
  115. },
  116. add() {
  117. this.num++
  118. },
  119. CheckboxChange(e) {
  120. var items = this.checkbox,
  121. values = e.detail.value;
  122. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  123. items[i].checked = false;
  124. for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
  125. if (items[i].value == values[j]) {
  126. items[i].checked = true;
  127. break
  128. }
  129. }
  130. }
  131. },
  132. //二维码回调
  133. qrR(data) {
  134. this.base64Img = data;
  135. },
  136. // 点击复制
  137. copy(text) {
  138. //app的复制方法
  139. // #ifdef APP-PLUS
  140. uni.setClipboardData({
  141. data: text
  142. });
  143. // #endif
  144. //html的复制方法
  145. // #ifdef H5
  146. this.$copyText(text)
  147. .then(res => {
  148. uni.showToast({
  149. title: '复制成功'
  150. });
  151. })
  152. .catch(err => {
  153. uni.showToast({
  154. icon: 'none',
  155. title: '复制失败,您的浏览器不支持'
  156. });
  157. });
  158. // #endif
  159. },
  160. submit(){
  161. this.$routerGo('/pages/order/pay-success')
  162. },
  163. //下拉刷新
  164. downCallback() {
  165. setTimeout(()=>{
  166. this.mescroll.endSuccess(); // 请求成功,隐藏加载状态
  167. this.mescroll.endErr(); // 请求失败,隐藏加载状态
  168. },1000)
  169. },
  170. }
  171. }
  172. </script>
  173. <style lang="scss" scoped>
  174. .address-box {
  175. // background-image: url(../../static/images/shop/envelope.png);
  176. background-repeat: repeat-x;
  177. background-position: left bottom;
  178. background-size: auto 8rpx;
  179. }
  180. .self-img-sm {
  181. width: 40rpx;
  182. height: 40rpx;
  183. }
  184. .bref-box {
  185. text-overflow: -o-ellipsis-lastline;
  186. overflow: hidden;
  187. text-overflow: ellipsis;
  188. display: -webkit-box;
  189. -webkit-line-clamp: 2;
  190. -webkit-box-orient: vertical;
  191. }
  192. .order-bottom {
  193. position: relative;
  194. .cuIcon-fold {
  195. position: absolute;
  196. right: 50rpx;
  197. top: -19rpx;
  198. color: rgba(0, 0, 0, 0.1)
  199. }
  200. }
  201. </style>