orderDetail.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='我的订单' bgColor="transparent"></cus-header>
  4. <image class="top_bg" :src="imgBase+'order_detail_bg.png'" mode="widthFix"></image>
  5. <view class="top adf">
  6. <view class="top-left adfac">
  7. <image :src="imgBase+'order_detail_success.png'"></image>
  8. <view class="top-left-texts adffc">
  9. <view class="text">{{statusCfg[orderInfo.orderStatus]}}</view>
  10. <view class="text tip adfac" v-if="orderInfo.orderStatus===0">
  11. 剩余支付时间<text style="margin: 0 4rpx;"></text>
  12. <u-count-down :time="countDownTime" format="HH:mm:ss" autoStart @finish="finish"></u-count-down>,
  13. 超时将自动取消
  14. </view>
  15. <view class="text tip" v-else>{{statusTip[orderInfo.orderStatus]||''}}</view>
  16. </view>
  17. </view>
  18. <view class="top-right">¥{{orderInfo.payAmount||0}}</view>
  19. </view>
  20. <view class="form">
  21. <view class="form-item adfacjb">
  22. <view class="form-item-title">订单号</view>
  23. <view class="form-item-value">{{orderInfo.orderNo||''}}</view>
  24. </view>
  25. <view class="form-item adfacjb">
  26. <view class="form-item-title">订单类型</view>
  27. <view class="form-item-value">{{typeCfg[orderInfo.type]}} {{orderInfo.totalFrequency}}次</view>
  28. </view>
  29. <view class="form-item adfacjb">
  30. <view class="form-item-title">订单金额</view>
  31. <view class="form-item-value">¥{{orderInfo.payAmount||0}}</view>
  32. </view>
  33. <view class="form-item adfacjb">
  34. <view class="form-item-title">下单时间</view>
  35. <view class="form-item-value">{{orderInfo.createDate||''}}</view>
  36. </view>
  37. <view class="form-item adfacjb">
  38. <view class="form-item-title">有效期至</view>
  39. <view class="form-item-value">{{orderInfo.expirationTime}}</view>
  40. </view>
  41. </view>
  42. <view class="bottom adfacjb">
  43. <template v-if="orderInfo.status!=0">
  44. <view class="bottom-default" @click="buyAgain">再次购买</view>
  45. </template>
  46. <template v-else>
  47. <view class="bottom-default half qx" @click="orderCancel">取消</view>
  48. <view class="bottom-default half" @click="orderPay">去支付</view>
  49. </template>
  50. </view>
  51. <WechatPay ref="wxPay" @confirmPay="toPay" @cancelPay="cancelPay"></WechatPay>
  52. </view>
  53. </template>
  54. <script>
  55. import WechatPay from '@/components/wechatPay/index.vue'
  56. export default {
  57. components:{ WechatPay },
  58. data(){
  59. return {
  60. id:'',
  61. orderInfo:null,
  62. countDownTime:5 * 60 * 1000,
  63. statusCfg:{
  64. '-3':'已退款',
  65. '-2':'已取消',
  66. '-1':'已失效',
  67. '0':'待支付',
  68. '1':'已支付',
  69. '2':'已完成'
  70. },
  71. typeCfg:{
  72. '1':'基础版',
  73. '2':'专业版'
  74. },
  75. statusTip:{
  76. '1':'您的问卷已激活,开始PREILL评估',
  77. '2':'您的问卷已激活,开始PREILL评估',
  78. '-2':'您的订单已取消,可重新购买'
  79. }
  80. }
  81. },
  82. onLoad(options) {
  83. this.id = options.id;
  84. this.id&&this.getDetail()
  85. },
  86. methods:{
  87. getDetail(){
  88. this.$api.get(`/que/order/${this.id}`).then(({data:res})=>{
  89. if(res.code!==0) return this.$showToast(res.msg)
  90. this.orderInfo = res.data;
  91. })
  92. },
  93. finish(){
  94. },
  95. buyAgain(){
  96. uni.navigateTo({
  97. url:'/pagesPublish/rechargeCenter'
  98. })
  99. },
  100. orderCancel(){
  101. uni.showModal({
  102. title:'温馨提示',
  103. content:'确定取消该订单?',
  104. success: (res) => {
  105. if(res.confirm){
  106. this.$api.put(`/que/order/closeOrder/${this.orderInfo.orderNo}`).then(({data:res})=>{
  107. if(res.code!==0) return this.$showToast(res.msg)
  108. this.$showToast('取消成功')
  109. setTimeout(()=>{
  110. uni.redirectTo({
  111. url:'/pagesMy/order'
  112. })
  113. },1500)
  114. })
  115. }
  116. }
  117. })
  118. },
  119. orderPay(){
  120. this.$refs.wxPay.payShow = true;
  121. this.$api.post('/pay/createOrder',{
  122. orderNo:this.orderInfo.orderNo,
  123. openId:JSON.parse(uni.getStorageSync('userInfo')).openId
  124. }).then(({data:res})=>{
  125. if(!res.hasOwnProperty('paySign')) return this.$showToast('支付失败')
  126. this.$refs.wxPay.payShow = false;
  127. this.$wxPay(res).then(result => {
  128. uni.navigateTo({
  129. url:'/pagesPublish/payResult'
  130. })
  131. })
  132. })
  133. },
  134. }
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. .default_page{
  139. padding: 0 24rpx 192rpx;
  140. box-sizing: border-box;
  141. background: #F7F7F7;
  142. .top_bg{
  143. width: 100%;
  144. position: absolute;
  145. left: 0;
  146. top: 0;
  147. }
  148. .top{
  149. margin-top: 54rpx;
  150. padding: 0 24rpx;
  151. position: relative;
  152. justify-content: space-between;
  153. &-left{
  154. image{
  155. width: 69rpx;
  156. height: 69rpx;
  157. }
  158. &-texts{
  159. margin-left: 20rpx;
  160. .text{
  161. font-family: PingFang-SC, PingFang-SC;
  162. font-weight: bold;
  163. font-size: 40rpx;
  164. color: #002846;
  165. line-height: 40rpx;
  166. &.tip{
  167. font-family: PingFangSC, PingFang SC;
  168. font-weight: 400;
  169. font-size: 24rpx;
  170. color: #667E90;
  171. line-height: 26rpx;
  172. margin-top: 24rpx;
  173. }
  174. }
  175. }
  176. }
  177. &-right{
  178. font-family: PingFang-SC, PingFang-SC;
  179. font-weight: bold;
  180. font-size: 36rpx;
  181. color: #002846;
  182. line-height: 30rpx;
  183. text-align: right;
  184. }
  185. }
  186. .form{
  187. background: #FFFFFF;
  188. border-radius: 25rpx;
  189. margin-top: 54rpx;
  190. padding: 0 24rpx;
  191. position: relative;
  192. &-item{
  193. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #EFEFEF;
  194. padding: 34rpx 0;
  195. &-title{
  196. font-family: PingFangSC, PingFang SC;
  197. font-weight: 400;
  198. font-size: 30rpx;
  199. color: #002846;
  200. line-height: 30rpx;
  201. }
  202. &-value{
  203. font-family: PingFangSC, PingFang SC;
  204. font-weight: 400;
  205. font-size: 30rpx;
  206. color: #667E90;
  207. line-height: 30rpx;
  208. text-align: right;
  209. }
  210. }
  211. }
  212. .bottom{
  213. width: calc(100% - 88rpx);
  214. height: 88rpx;
  215. position: fixed;
  216. left: 44rpx;
  217. bottom: 54rpx;
  218. &-default{
  219. width: 100%;
  220. height: 88rpx;
  221. border: 1rpx solid #33A7A7;
  222. background: linear-gradient( 90deg, #33A7A7 0%, #64BBBB 100%);;
  223. border-radius: 44rpx;
  224. font-family: PingFang-SC, PingFang-SC;
  225. font-weight: bold;
  226. font-size: 32rpx;
  227. color: #FFFFFF;
  228. line-height: 88rpx;
  229. text-align: center;
  230. letter-spacing: 2rpx;
  231. &.half{
  232. width: calc(50% - 19rpx);
  233. }
  234. &.qx{
  235. color: #657588;
  236. background: #FFFFFF;
  237. border: 1rpx solid #CCD4DA;
  238. }
  239. }
  240. }
  241. }
  242. </style>