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

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