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

262 lines
5.1 KiB

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