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

268 lines
8.8 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="orderDetails">
  3. <Navbar :title="$t('pages_order.pay_order.title')" :autoBack="true" :bgColor="bgColor" leftIconSize="18px"
  4. height="100rpx" :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">{{ $t('pages_order.pay_order.pending_payment') }}</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">{{ getTitle() }}</view>
  18. <view class="date">{{ dataInfo.startTime }}</view>
  19. <view class="address">{{ getAddress() }}</view>
  20. </view>
  21. <view class="price"><text>{{ $t('pages_order.pay_order.price') }}</text>¥{{ dataInfo.payPrice }}
  22. </view><!-- 价格 -->
  23. </view>
  24. </view>
  25. </view>
  26. <view class="orderInfo">
  27. <view class="title">{{ $t('pages_order.pay_order.order_info') }}</view><!-- 订单信息 -->
  28. <view class="details">
  29. <uv-cell :border="false" :title="$t('pages_order.pay_order.ticket_quantity')"><!-- 购票数量 -->
  30. <template #value>
  31. <uv-number-box v-model="num" />
  32. </template>
  33. </uv-cell>
  34. <uv-cell :border="false" :title="$t('pages_order.pay_order.ticket_content')"
  35. :value="ticketName" /><!-- 购票内容 -->
  36. <uv-cell :border="false" :title="$t('pages_order.pay_order.order_total')"
  37. :value="'¥' + (dataInfo.payPrice * num)"></uv-cell><!-- -->
  38. <uv-cell :border="false" :title="$t('pages_order.pay_order.order_status')"
  39. :value="orderStatus"></uv-cell><!-- -->
  40. <uv-cell :border="false" v-if="dataInfo.type == 0"
  41. :title="$t('pages_order.pay_order.invitation_code')"><!-- 邀请码 -->
  42. <template #value>
  43. <input type="text" style="color: #fff;"
  44. :placeholder="$t('pages_order.pay_order.enter_invitation_code')"
  45. v-model="code" /><!-- 请输入邀请码 -->
  46. </template>
  47. </uv-cell>
  48. </view>
  49. </view>
  50. <view class="tips">
  51. <view class="title">{{ $t('pages_order.pay_order.payment_notice') }}</view><!-- 支付须知 -->
  52. <view class="details">
  53. <uv-parse :content="configList.recharge_instructions"></uv-parse>
  54. </view>
  55. </view>
  56. </view>
  57. <view style="padding: 65rpx 35rpx;">
  58. <uv-button :custom-style="customStyle" type="primary" shape="circle" color="#381615" @click="confirmClick"
  59. :text="$t('pages_order.pay_order.pay_order')"></uv-button><!-- -->
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import Navbar from '@/pages/components/Navbar.vue'
  65. import {
  66. globalMixin
  67. } from '../pages/mixins/globalMixin';
  68. export default {
  69. mixins: [globalMixin],
  70. components: {
  71. Navbar
  72. },
  73. data() {
  74. return {
  75. orderId: '',
  76. dataInfo: {},
  77. customStyle: {
  78. color: '#FF5858'
  79. },
  80. num: 1,
  81. code: '',//邀请码
  82. }
  83. },
  84. onLoad(e) {
  85. this.orderId = e.id
  86. this.getorderInfo()
  87. },
  88. computed: {
  89. orderStatus() {
  90. let state = this.dataInfo.state
  91. const statusKeys = [
  92. 'pages_order.pay_order.status.unpaid', // 未付款
  93. 'pages_order.pay_order.status.pending', // 待参加
  94. 'pages_order.pay_order.status.completed', // 已完成
  95. 'pages_order.pay_order.status.cancelled' // 已取消
  96. ]
  97. return this.$t(statusKeys[state] || statusKeys[3])
  98. },
  99. ticketName() {
  100. const typeIndex = this.dataInfo.typePrice || 0
  101. const typeKeys = [
  102. 'pages_order.pay_order.ticket_types.early_bird', // 早鸟票
  103. 'pages_order.pay_order.ticket_types.single_ticket', // 单人票
  104. 'pages_order.pay_order.ticket_types.premium_ticket' // 尊享票
  105. ]
  106. return this.$t(typeKeys[typeIndex] || typeKeys[0])
  107. },
  108. showOrderId() {//0活动 1旅行
  109. let id = ""
  110. if (this.dataInfo.type == 0) {
  111. id = this.dataInfo.activityOrderId
  112. } else {
  113. id = this.dataInfo.travelOrderId
  114. }
  115. return id
  116. },
  117. images() {
  118. return this.dataInfo.image && this.dataInfo.image.split(',')[0]
  119. },
  120. },
  121. methods: {
  122. getTitle() {
  123. if (!this.dataInfo) return ''
  124. return this.dataInfo.type == 0
  125. ? this.$ot(this.dataInfo.activity, 'active', 'title')
  126. : this.$ot(this.dataInfo.travel, 'travel', 'title')
  127. },
  128. getAddress() {
  129. if (!this.dataInfo) return ''
  130. return this.dataInfo.type == 0
  131. ? this.$ot(this.dataInfo.activity, 'active', 'address')
  132. : this.$ot(this.dataInfo.travel, 'travel', 'address')
  133. },
  134. getorderInfo() {
  135. this.$api('orderInfo', { orderId: this.orderId }, res => {
  136. if (res.code == 200) {
  137. this.dataInfo = res.result.orderDetails
  138. }
  139. })
  140. },
  141. confirmClick(typePrice) {
  142. this.$api('createOrderPay', {
  143. id: this.orderId,
  144. num: this.num,
  145. code: this.code,
  146. }, res => {
  147. if (res.code === 200) {
  148. uni.requestPaymentWxPay(res)
  149. .then(res => {
  150. uni.showToast({
  151. title: this.$t('pages_order.pay_order.payment_success'), // 支付成功
  152. icon: 'none'
  153. })
  154. setTimeout(uni.switchTab, 800, {
  155. url: '/pages/index/cart'
  156. })
  157. }).catch(n => {
  158. setTimeout(uni.navigateBack, 800, -1)
  159. })
  160. }
  161. })
  162. }
  163. }
  164. }
  165. </script>
  166. <style scoped lang="scss">
  167. .orderDetails {
  168. padding-bottom: 80rpx;
  169. }
  170. .details {
  171. padding: 50rpx 40rpx;
  172. /deep/.uv-cell {
  173. .uv-cell__body {
  174. padding: 0rpx;
  175. padding-bottom: 30rpx;
  176. }
  177. &:last-child {
  178. .uv-cell__body {
  179. padding-bottom: 0rpx;
  180. }
  181. }
  182. .uv-cell__body__content {
  183. .uv-cell__title-text {
  184. color: $uni-text-color-grey !important;
  185. font-size: 28rpx
  186. }
  187. }
  188. .uv-cell__value {
  189. color: #DCDCDC !important;
  190. font-size: 28rpx
  191. }
  192. }
  193. }
  194. .orderDetails {
  195. margin-top: 40rpx;
  196. /deep/.uv-navbar__content__title {
  197. color: #fff;
  198. }
  199. .content {
  200. padding: 0 35rpx;
  201. color: #fff;
  202. padding-top: calc(var(--status-bar-height) + 110rpx);
  203. .baseInfo {
  204. .statusBox {
  205. display: flex;
  206. align-items: center;
  207. padding: 33rpx 47rpx 24rpx;
  208. i {
  209. background: url('@/static/image/cart/U-status.png') no-repeat;
  210. background-size: 100% 100%;
  211. display: block;
  212. width: 39rpx;
  213. height: 34rpx;
  214. margin-right: 15rpx;
  215. }
  216. .status {
  217. font-size: 32rpx;
  218. }
  219. }
  220. }
  221. .orderInfo,
  222. .tips {
  223. .title {
  224. font-size: 29rpx;
  225. padding-bottom: 26rpx;
  226. margin-top: 36rpx;
  227. }
  228. .details {
  229. background-color: $uni-color-card-background;
  230. border-radius: 26rpx;
  231. }
  232. }
  233. .tips {
  234. .details {
  235. p {
  236. color: #CCC;
  237. font-size: 25rpx;
  238. line-height: 50rpx;
  239. }
  240. }
  241. }
  242. }
  243. }
  244. </style>