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

270 lines
8.9 KiB

6 months ago
6 months ago
6 months ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 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. detail : {},
  78. customStyle: {
  79. color: '#FF5858'
  80. },
  81. num: 1,
  82. code: '',//邀请码
  83. }
  84. },
  85. onLoad(e) {
  86. this.orderId = e.id
  87. this.getorderInfo()
  88. },
  89. computed: {
  90. orderStatus() {
  91. let state = this.dataInfo.state
  92. const statusKeys = [
  93. 'pages_order.pay_order.status.unpaid', // 未付款
  94. 'pages_order.pay_order.status.pending', // 待参加
  95. 'pages_order.pay_order.status.completed', // 已完成
  96. 'pages_order.pay_order.status.cancelled' // 已取消
  97. ]
  98. return this.$t(statusKeys[state] || statusKeys[3])
  99. },
  100. ticketName() {
  101. const typeIndex = this.dataInfo.typePrice || 0
  102. const typeKeys = [
  103. 'pages_order.pay_order.ticket_types.early_bird', // 早鸟票
  104. 'pages_order.pay_order.ticket_types.single_ticket', // 单人票
  105. 'pages_order.pay_order.ticket_types.premium_ticket' // 尊享票
  106. ]
  107. return this.$t(typeKeys[typeIndex] || typeKeys[0])
  108. },
  109. showOrderId() {//0活动 1旅行
  110. let id = ""
  111. if (this.dataInfo.type == 0) {
  112. id = this.dataInfo.activityOrderId
  113. } else {
  114. id = this.dataInfo.travelOrderId
  115. }
  116. return id
  117. },
  118. images() {
  119. return this.dataInfo.image && this.dataInfo.image.split(',')[0]
  120. },
  121. },
  122. methods: {
  123. getTitle() {
  124. if (!this.detail) return ''
  125. return this.dataInfo.type == 0
  126. ? this.$ot(this.detail.activity, 'active', 'title')
  127. : this.$ot(this.detail.travel, 'travel', 'title')
  128. },
  129. getAddress() {
  130. if (!this.detail) return ''
  131. return this.dataInfo.type == 0
  132. ? this.$ot(this.detail.activity, 'active', 'address')
  133. : this.$ot(this.detail.travel, 'travel', 'address')
  134. },
  135. getorderInfo() {
  136. this.$api('orderInfo', { orderId: this.orderId }, res => {
  137. if (res.code == 200) {
  138. this.dataInfo = res.result.orderDetails
  139. this.detail = res.result
  140. }
  141. })
  142. },
  143. confirmClick(typePrice) {
  144. this.$api('createOrderPay', {
  145. id: this.orderId,
  146. num: this.num,
  147. code: this.code,
  148. }, res => {
  149. if (res.code === 200) {
  150. uni.requestPaymentWxPay(res)
  151. .then(res => {
  152. uni.showToast({
  153. title: this.$t('pages_order.pay_order.payment_success'), // 支付成功
  154. icon: 'none'
  155. })
  156. setTimeout(uni.switchTab, 800, {
  157. url: '/pages/index/cart'
  158. })
  159. }).catch(n => {
  160. setTimeout(uni.navigateBack, 800, -1)
  161. })
  162. }
  163. })
  164. }
  165. }
  166. }
  167. </script>
  168. <style scoped lang="scss">
  169. .orderDetails {
  170. padding-bottom: 80rpx;
  171. }
  172. .details {
  173. padding: 50rpx 40rpx;
  174. /deep/.uv-cell {
  175. .uv-cell__body {
  176. padding: 0rpx;
  177. padding-bottom: 30rpx;
  178. }
  179. &:last-child {
  180. .uv-cell__body {
  181. padding-bottom: 0rpx;
  182. }
  183. }
  184. .uv-cell__body__content {
  185. .uv-cell__title-text {
  186. color: $uni-text-color-grey !important;
  187. font-size: 28rpx
  188. }
  189. }
  190. .uv-cell__value {
  191. color: #DCDCDC !important;
  192. font-size: 28rpx
  193. }
  194. }
  195. }
  196. .orderDetails {
  197. margin-top: 40rpx;
  198. /deep/.uv-navbar__content__title {
  199. color: #fff;
  200. }
  201. .content {
  202. padding: 0 35rpx;
  203. color: #fff;
  204. padding-top: calc(var(--status-bar-height) + 110rpx);
  205. .baseInfo {
  206. .statusBox {
  207. display: flex;
  208. align-items: center;
  209. padding: 33rpx 47rpx 24rpx;
  210. i {
  211. background: url('@/static/image/cart/U-status.png') no-repeat;
  212. background-size: 100% 100%;
  213. display: block;
  214. width: 39rpx;
  215. height: 34rpx;
  216. margin-right: 15rpx;
  217. }
  218. .status {
  219. font-size: 32rpx;
  220. }
  221. }
  222. }
  223. .orderInfo,
  224. .tips {
  225. .title {
  226. font-size: 29rpx;
  227. padding-bottom: 26rpx;
  228. margin-top: 36rpx;
  229. }
  230. .details {
  231. background-color: $uni-color-card-background;
  232. border-radius: 26rpx;
  233. }
  234. }
  235. .tips {
  236. .details {
  237. p {
  238. color: #CCC;
  239. font-size: 25rpx;
  240. line-height: 50rpx;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. </style>