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

200 lines
5.7 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view>
  3. <!-- 商品信息 -->
  4. <self-line/>
  5. <view class="bg-white padding-tb-sm">
  6. <skeleton :loading="skeletonLoading" :row="2" :showAvatar="false" :showTitle="true">
  7. <view class="flex justify-between align-start padding-top-sm padding-lr">
  8. <image v-if="orderDetails.goods.cover" :src="orderDetails.goods.cover" mode="aspectFill" style="width: 150rpx; height: 150rpx;"></image>
  9. <view class="flex-sub padding-left-sm">
  10. <view class="bref-box margin-top-xs">
  11. {{orderDetails.goods.name}}
  12. </view>
  13. <view class="flex justify-between">
  14. <text class="block margin-top-sm text-gray text-sm">数量</text>
  15. <view class="flex align-center margin-top-sm">
  16. <text class="cuIcon-move" @tap="reduce"></text>
  17. <input type="number" v-model="num" class="text-center margin-lr-sm radius" style="width: 60rpx; height: 50rpx;background-color: #f7f7fb;" />
  18. <text class="cuIcon-add" @tap="add"></text>
  19. </view>
  20. </view>
  21. <view class="flex justify-between margin-top-sm">
  22. <view class="text-red text-price text-lg">
  23. {{Number(orderDetails.goods.specs[0].selling_price || 0)}}
  24. </view>
  25. <!-- <view>
  26. <button v-if="true" class="cu-btn line-orange round margin-left-sm text-sm">申请退款</button>
  27. <button v-else class="cu-btn line-gray bg-gray round margin-left-sm text-sm">退款中</button>
  28. </view> -->
  29. </view>
  30. </view>
  31. </view>
  32. </skeleton>
  33. </view>
  34. <self-line/>
  35. <skeleton :loading="skeletonLoading" :row="1" :showAvatar="false" :showTitle="true">
  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. </skeleton>
  43. <self-line/>
  44. <skeleton :loading="skeletonLoading" :row="13" :showAvatar="false" :showTitle="true">
  45. <view class="btn-bottom">
  46. <view class="padding flex justify-around align-center" v-if="orderDetails.agreement.tips">
  47. <checkbox-group class="block" @change="CheckboxChange">
  48. <view class="margin-right">
  49. <checkbox @change="CheckboxChange" :class="checkbox[0].checked?'checked':''" :checked="checkbox[0].checked?true:false" value="A"></checkbox>
  50. </view>
  51. </checkbox-group>
  52. <view class="text-sm text-gray">{{orderDetails.agreement.tips}}</view>
  53. </view>
  54. <self-line/>
  55. <view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top shadow">
  56. <view class="flex align-center">
  57. <text class="">应付款</text>
  58. <view class="text-lg text-price text-red">
  59. {{Number(orderDetails.goods.specs[0].selling_price*num || 0)}}
  60. </view>
  61. </view>
  62. <button class="cu-btn block bg-orange round shadow" @tap="submit">
  63. <text class="cuIcon-loading2 cuIconfont-spin margin-right-xs text-white" v-if="loading"></text>
  64. <text class="text-df text-white">{{ loading ? '支付中...' : '下单付款' }}</text>
  65. </button>
  66. </view>
  67. </view>
  68. </skeleton>
  69. </view>
  70. </template>
  71. <script>
  72. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  73. export default {
  74. mixins: [MescrollMixin], // 使用mixin
  75. data() {
  76. return {
  77. num: 1,
  78. base64Img: '', //
  79. skeletonLoading: true,
  80. loading: false,
  81. checkbox: [{
  82. value: 'A',
  83. checked: true
  84. }],
  85. goods_id: 1,
  86. goods_specs_id: 1,
  87. orderDetails: {},
  88. ifchoose: true
  89. }
  90. },
  91. computed: {
  92. total(){
  93. return this.num * this.price
  94. }
  95. },
  96. onLoad(e) {
  97. this.goods_id = e.goods_id
  98. this.goods_specs_id = e.goods_specs_id
  99. },
  100. methods: {
  101. getConfirmOrder() {
  102. this.$http(this.API.API_COFIRMORDER_DETAILS, {goods_id: this.goods_id,goods_specs_id: this.goods_specs_id}).then(res => {
  103. if(res.code == 0) {
  104. this.orderDetails = res.data
  105. this.skeletonLoading = false
  106. this.mescroll.endSuccess(); // 请求成功,隐藏加载状态
  107. }else {
  108. this.$msg(res.msg)
  109. }
  110. }).catch(err => {
  111. // this.mescroll.endErr();
  112. });
  113. },
  114. reduce() {
  115. if (this.num === 1) return
  116. this.num--
  117. },
  118. add() {
  119. this.num++
  120. },
  121. CheckboxChange(e) {
  122. if(e.detail.value != '') {
  123. this.ifchoose = true
  124. }else {
  125. this.ifchoose = false
  126. }
  127. },
  128. // 点击复制
  129. copy(text) {
  130. uni.setClipboardData({
  131. data: text
  132. });
  133. },
  134. submit(){
  135. if(this.ifchoose == true) {
  136. this.$http(this.API.API_PRPAID, {
  137. goods_id: this.goods_id,
  138. goods_specs_id: this.goods_specs_id,
  139. number: this.num,
  140. token: 'fdf12000e774e48bc60c6b6d42055602'
  141. }).then(res => {
  142. console.log(res)
  143. // let nonceStr = res.data.nonceStr
  144. // appId: "wxb35ef055a4dd8ad4"
  145. // nonceStr: "60d3125d138af"
  146. // order_num: "2842855348400816128"
  147. // package: "prepay_id=wx23185213000285e14ea77ac97acc670000"
  148. // paySign: "6DC330CBDF6C29BEDD4D254D9DA97364"
  149. // signType: "MD5"
  150. // timeStamp: "1624445533"
  151. uni.requestPayment({
  152. orderInfo: res.data.order_num,
  153. timeStamp: res.data.timeStamp,
  154. nonceStr: res.data.nonceStr,
  155. package: res.data.package,
  156. signType: res.data.signType,
  157. paySign: res.data.paySign,
  158. complete: result => {
  159. console.log(result)
  160. }
  161. })
  162. })
  163. return
  164. this.$routerGo('/pages/order/pay-success')
  165. }else {
  166. this.$msg('请认真阅读并同意协议!')
  167. return
  168. }
  169. },
  170. //下拉刷新
  171. downCallback() {
  172. this.getConfirmOrder()
  173. },
  174. },
  175. created() {
  176. this.getConfirmOrder()
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .bref-box {
  182. text-overflow: -o-ellipsis-lastline;
  183. overflow: hidden;
  184. text-overflow: ellipsis;
  185. display: -webkit-box;
  186. -webkit-line-clamp: 2;
  187. -webkit-box-orient: vertical;
  188. }
  189. </style>