推广小程序前端代码
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.

234 lines
4.9 KiB

9 months ago
  1. <template>
  2. <view class="orderDetails">
  3. <Navbar title="支付详情" :autoBack="true" :bgColor="bgColor" leftIconSize="18px" height="100rpx"
  4. :leftIconColor="leftIconColor" :titleStyle="{color:fontColor}" />
  5. <view class="content">
  6. <view class="baseInfo cardBackground_">
  7. <view class="statusBox">
  8. <i></i>
  9. <view class="status">待支付</view>
  10. </view>
  11. <view class="info grayBg cardStyle_">
  12. <view class="left">
  13. <image :src="images" mode="aspectFill">
  14. </view>
  15. <view class="right">
  16. <view class="detailed">
  17. <view class="title">{{dataInfo.title}}</view>
  18. <view class="date">{{dataInfo.startTime}}</view>
  19. <view class="address">{{dataInfo.address}}</view>
  20. </view>
  21. <view class="price"><text>总计</text>¥{{dataInfo.payPrice}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="orderInfo">
  26. <view class="title">订单信息</view>
  27. <view class="details">
  28. <uv-cell :border="false" titleStyle="{color: 'red'}" title="订单编号" :value="showOrderId"></uv-cell>
  29. <uv-cell :border="false" titleStyle="{color: 'red'}" title="下单时间" :value="dataInfo.createTime"></uv-cell>
  30. <uv-cell :border="false" titleStyle="{color: 'red'}" title="订单金额" :value="'¥' + dataInfo.payPrice"></uv-cell>
  31. <uv-cell :border="false" titleStyle="{color: 'red'}" title="订单状态" :value="orderStatus"></uv-cell>
  32. </view>
  33. </view>
  34. <view class="tips">
  35. <view class="title">支付须知</view>
  36. <view class="details">
  37. <uv-parse :content="configList.recharge_instructions"></uv-parse>
  38. </view>
  39. </view>
  40. </view>
  41. <view style="padding: 65rpx 35rpx;">
  42. <uv-button
  43. :custom-style="customStyle"
  44. type="primary"
  45. shape="circle"
  46. color="#381615"
  47. @click="confirmClick"
  48. text="支付订单"></uv-button>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import Navbar from '@/pages/components/Navbar.vue'
  54. import {
  55. globalMixin
  56. } from '../pages/mixins/globalMixin';
  57. export default {
  58. mixins: [globalMixin],
  59. components: {
  60. Navbar
  61. },
  62. data() {
  63. return {
  64. orderId:'',
  65. dataInfo: {},
  66. customStyle:{
  67. color:'#FF5858'
  68. },
  69. num : 0,
  70. }
  71. },
  72. onLoad(e) {
  73. this.orderId = e.id
  74. this.getorderInfo()
  75. },
  76. computed:{
  77. orderStatus() {
  78. let text = ""
  79. let state = this.dataInfo.state
  80. if( state == 0) {
  81. text = '未付款'
  82. }else if(state == 1) {
  83. text = '待参加'
  84. }else if(state == 2) {
  85. text = '已完成'
  86. }else{
  87. text = '已取消'
  88. }
  89. return text
  90. },
  91. showOrderId() {//0活动 1旅行
  92. let id = ""
  93. if(this.dataInfo.type == 0) {
  94. id = this.dataInfo.activityOrderId
  95. }else{
  96. id = this.dataInfo.travelOrderId
  97. }
  98. return id
  99. },
  100. images(){
  101. return this.dataInfo.image && this.dataInfo.image.split(',')[0]
  102. },
  103. },
  104. methods:{
  105. getorderInfo() {
  106. this.$api('orderInfo',{orderId:this.orderId},res=>{
  107. if(res.code == 200) {
  108. this.dataInfo = res.result.orderDetails
  109. }
  110. })
  111. },
  112. confirmClick(typePrice) {
  113. this.$api('createOrderPay',{
  114. id:this.orderId,
  115. num : this.num,
  116. },res=>{
  117. if(res.code === 200) {
  118. uni.requestPaymentWxPay(res)
  119. .then(res => {
  120. uni.showToast({
  121. title: '支付成功',
  122. icon: 'none'
  123. })
  124. setTimeout(uni.switchTab, 800, {
  125. url: '/pages/index/cart'
  126. })
  127. }).catch(n => {
  128. setTimeout(uni.switchTab, 800, {
  129. url: '/pages/index/cart'
  130. })
  131. })
  132. }
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style scoped lang="scss">
  139. .orderDetails {
  140. padding-bottom: 80rpx;
  141. }
  142. .details {
  143. padding: 50rpx 40rpx;
  144. /deep/.uv-cell {
  145. .uv-cell__body {
  146. padding: 0rpx;
  147. padding-bottom: 30rpx;
  148. }
  149. &:last-child {
  150. .uv-cell__body {
  151. padding-bottom: 0rpx;
  152. }
  153. }
  154. .uv-cell__body__content {
  155. .uv-cell__title-text {
  156. color: $uni-text-color-grey !important;
  157. font-size: 28rpx
  158. }
  159. }
  160. .uv-cell__value {
  161. color: #DCDCDC !important;
  162. font-size: 28rpx
  163. }
  164. }
  165. }
  166. .orderDetails {
  167. margin-top: 40rpx;
  168. /deep/.uv-navbar__content__title {
  169. color: #fff;
  170. }
  171. .content {
  172. padding: 0 35rpx;
  173. color: #fff;
  174. padding-top: calc(var(--status-bar-height) + 110rpx);
  175. .baseInfo {
  176. .statusBox {
  177. display: flex;
  178. align-items: center;
  179. padding: 33rpx 47rpx 24rpx;
  180. i {
  181. background: url('@/static/image/cart/U-status.png') no-repeat;
  182. background-size: 100% 100%;
  183. display: block;
  184. width: 39rpx;
  185. height: 34rpx;
  186. margin-right: 15rpx;
  187. }
  188. .status {
  189. font-size: 32rpx;
  190. }
  191. }
  192. }
  193. .orderInfo,
  194. .tips {
  195. .title {
  196. font-size: 29rpx;
  197. padding-bottom: 26rpx;
  198. margin-top: 36rpx;
  199. }
  200. .details {
  201. background-color: $uni-color-card-background;
  202. border-radius: 26rpx;
  203. }
  204. }
  205. .tips {
  206. .details {
  207. p {
  208. color: #CCC;
  209. font-size: 25rpx;
  210. line-height: 50rpx;
  211. }
  212. }
  213. }
  214. }
  215. }
  216. </style>