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

272 lines
5.4 KiB

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