时空网前端
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.9 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. <block v-if="isRight(orderDetails)">
  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. {{Number(orderDetails.goods.specs[0].selling_price || 0)}}
  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. <skeleton :loading="skeletonLoading" :row="1" :showAvatar="false" :showTitle="true">
  37. <view class="bg-white">
  38. <view class="cu-bar padding-lr solid-bottom">
  39. <text class="text-gray">优惠</text>
  40. <text>暂无优惠</text>
  41. </view>
  42. </view>
  43. </skeleton>
  44. <self-line/>
  45. <skeleton :loading="skeletonLoading" :row="13" :showAvatar="false" :showTitle="true">
  46. <view class="btn-bottom">
  47. <view class="padding flex justify-around align-center" v-if="orderDetails.agreement.tips">
  48. <checkbox-group class="block" @change="CheckboxChange">
  49. <view class="margin-right">
  50. <checkbox @change="CheckboxChange" :class="checkbox[0].checked?'checked':''" :checked="checkbox[0].checked?true:false" value="A"></checkbox>
  51. </view>
  52. </checkbox-group>
  53. <view class="text-sm text-gray">{{orderDetails.agreement.tips}}</view>
  54. </view>
  55. <self-line/>
  56. <view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top shadow">
  57. <view class="flex align-center">
  58. <text class="">应付款</text>
  59. <view class="text-lg text-price text-red">
  60. {{Number(orderDetails.goods.specs[0].selling_price*num || 0)}}
  61. </view>
  62. </view>
  63. <button class="cu-btn block bg-orange round shadow" @tap="submit">
  64. <text class="cuIcon-loading2 cuIconfont-spin margin-right-xs text-white" v-if="loading"></text>
  65. <text class="text-df text-white">{{ loading ? '支付中...' : '下单付款' }}</text>
  66. </button>
  67. </view>
  68. </view>
  69. </skeleton>
  70. </block>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  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. ifCheck: true
  90. }
  91. },
  92. computed: {
  93. total(){
  94. return this.num * this.price
  95. },
  96. isRight(){
  97. return function(val){
  98. return this.$shared.isRight(val);
  99. }
  100. }
  101. },
  102. onLoad(e) {
  103. this.goods_id = e.goods_id
  104. this.goods_specs_id = e.goods_specs_id
  105. },
  106. methods: {
  107. getConfirmOrder() {
  108. this.$http(this.API.API_COFIRMORDER_DETAILS, {goods_id: this.goods_id,goods_specs_id: this.goods_specs_id}).then(res => {
  109. if(res.code == 0) {
  110. this.orderDetails = res.data
  111. this.skeletonLoading = false
  112. if( Object.keys(res.metal_data).length != 0 ) {
  113. this.ifCheck = false
  114. }else {
  115. this.ifCheck = true
  116. }
  117. }else {
  118. this.$msg(res.msg)
  119. }
  120. }).catch(err => {
  121. // this.mescroll.endErr();
  122. });
  123. },
  124. reduce() {
  125. if (this.num === 1) return
  126. this.num--
  127. },
  128. add() {
  129. this.num++
  130. },
  131. CheckboxChange(e) {
  132. if(e.detail.value != '') {
  133. this.ifchoose = true
  134. }else {
  135. this.ifchoose = false
  136. }
  137. },
  138. // 点击复制
  139. copy(text) {
  140. uni.setClipboardData({
  141. data: text
  142. });
  143. },
  144. submit(){
  145. if(this.ifchoose == true) {
  146. if(this.ifCheck == false) {
  147. uni.showModal({
  148. title: '提示',
  149. content: '是否同意前往手机授权?',
  150. success: e => {
  151. if (!e.confirm) return;
  152. this.$routerGo('/pages/login/index?type=phone')
  153. }
  154. });
  155. }else {
  156. this.$http(this.API.API_PRPAID, {
  157. goods_id: this.goods_id,
  158. goods_specs_id: this.goods_specs_id,
  159. number: this.num,
  160. token: 'fdf12000e774e48bc60c6b6d42055602'
  161. }).then(res => {
  162. console.log(res)
  163. uni.requestPayment({
  164. orderInfo: res.data.order_num,
  165. timeStamp: res.data.timeStamp,
  166. nonceStr: res.data.nonceStr,
  167. package: res.data.package,
  168. signType: res.data.signType,
  169. paySign: res.data.paySign,
  170. success: function (res) {
  171. this.$routerGo('/pages/order/pay-success?ifSuccess='+1)
  172. },
  173. fail: function (err) {
  174. this.$routerGo('/pages/order/pay-success?ifSuccess='+2)
  175. }
  176. })
  177. })
  178. }
  179. }else {
  180. this.$msg('请认真阅读并同意协议!')
  181. return
  182. }
  183. },
  184. //下拉刷新
  185. downCallback() {
  186. this.getConfirmOrder()
  187. },
  188. },
  189. created() {
  190. this.getConfirmOrder()
  191. }
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .bref-box {
  196. text-overflow: -o-ellipsis-lastline;
  197. overflow: hidden;
  198. text-overflow: ellipsis;
  199. display: -webkit-box;
  200. -webkit-line-clamp: 2;
  201. -webkit-box-orient: vertical;
  202. }
  203. </style>