海南旅游项目 前端仓库
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.

344 lines
9.6 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view>
  3. <!-- 商品信息 -->
  4. <block v-if="isRight(orderDetails)">
  5. <view class="bg-white">
  6. <view class="flex justify-between align-start" style="padding: 32rpx 32rpx 30rpx 32rpx;">
  7. <image :src="orderDetails.picture" mode="aspectFill"
  8. style="width: 240rpx; height: 240rpx;border-radius: 20rpx;"></image>
  9. <view class="flex-sub padding-left-sm">
  10. <view class="bref-box lf-line-2 text-black1 lf-font-28 lf-font-bold"
  11. style="height: 88rpx;line-height: 44rpx;">
  12. {{orderDetails.title}}
  13. </view>
  14. <text class="block lf-color-gray lf-font-28" style="margin-top: 20rpx;line-height: 40rpx;">数量
  15. <text class="margin-left margin-right-xs lf-color-gray">x</text>{{orderDetails.num}}</text>
  16. <view class="flex justify-between" style="margin-top: 28rpx;">
  17. <lf-price :price="orderDetails.price" style="margin-top: 8rpx;" />
  18. <view>
  19. <button v-if="orderDetails.status == 2 || orderDetails.status == 3" class="cu-btn1 lf-color-gray lf-border-gray" @tap="$url('/pages/order/apply_refund?order_id='+orderDetails.id)">申请退款</button>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <self-line />
  26. <!-- 表单 -->
  27. <view class="bg-white">
  28. <view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
  29. <text class="lf-color-555 lf-font-28">订单编号</text>
  30. <view>
  31. <text class="margin-right lf-font-28 text-black1">{{orderDetails.order_no}}</text>
  32. <text class="text-orange lf-font-28" @click="copy(orderDetails.order_no)">复制</text>
  33. </view>
  34. </view>
  35. <view class="cu-bar padding-lr solid-bottom" v-if="orderDetails.created_at">
  36. <text class="lf-color-555 lf-font-28">下单时间</text>
  37. <text class="lf-font-28 text-black1">{{ orderDetails.created_at }}</text>
  38. </view>
  39. <view class="cu-bar padding-lr solid-bottom" v-if="orderDetails.paid_at">
  40. <text class="lf-color-555 lf-font-28">付款时间</text>
  41. <text class="lf-font-28 text-black1" v-if="orderDetails.paid_at == 0">暂未付款</text>
  42. <text class="lf-font-28 text-black1" v-else>{{ orderDetails.paid_at }}</text>
  43. </view>
  44. <view class="cu-bar padding-lr">
  45. <text class="lf-color-555 lf-font-28">支付方式</text>
  46. <text class="lf-font-28 text-black1">微信支付</text>
  47. </view>
  48. </view>
  49. <self-line />
  50. <view class="bg-white">
  51. <view class="cu-bar padding-lr">
  52. <text class="lf-color-555 lf-font-28">优惠</text>
  53. <view v-if="orderDetails.coupon != ''">
  54. <text class="lf-color-price lf-font-28 lf-m-l-10" v-for="(item,index) of orderDetails.coupon">{{item.tag}}</text>
  55. </view>
  56. <view v-else>
  57. <text class="lf-color-price lf-font-28 lf-m-l-10">暂无优惠</text>
  58. </view>
  59. </view>
  60. </view>
  61. <view>
  62. <self-line />
  63. <view class="bg-white flex flex-direction justify-around align-center text-center padding-tb"
  64. style="padding-bottom: 140rpx;">
  65. <view>
  66. <tki-qrcode ref="qrcode" @result="qrR" :val="checkArea" :size="115" unit="px" background="#fff"
  67. foreground="#000" pdground="#000" :onval="true" :loadMake="true" />
  68. </view>
  69. <view style="margin-top: 10rpx;position: relative;top: 26rpx;">
  70. <view class="lf-font-28 text-black1">
  71. {{checkArea}}
  72. <text v-if="checkArea" style="position: relative;left: 172rpx;top: -36rpx;display: inherit;" class="lf-color-blue lf-font-28" @tap="copy(checkArea)">复制</text></view>
  73. </view>
  74. <view class="lf-m-t-32" v-if="checkArea">
  75. <view class="lf-color-green lf-font-28 lf-flex">
  76. <text v-if="orderDetails.status == 3">待使用</text>
  77. <text v-else>{{orderDetails.status_text}}</text>
  78. <!-- <text class="lf-iconfont lf-icon-shuaxin1 lf-font-40"
  79. style="color: #999;position: relative;left: 84rpx;top: -42rpx;display: inherit;"
  80. @tap="refreshCode()"></text> -->
  81. <image src="../../static/center/refresh.png"
  82. style="color: #999;position: relative;left: 28rpx;top: 0rpx;display: inherit; width: 30rpx;height: 30rpx;"
  83. @tap="refreshCode()">
  84. </image>
  85. </view>
  86. </view>
  87. <!-- <view style="margin-top: 44rpx;" v-else>
  88. <view class="lf-color-999 lf-font-28">
  89. </view>
  90. </view> -->
  91. </view>
  92. <view class="padding-lr padding-tb-sm bg-white flex justify-between align-center solid-top1 btn-bottom">
  93. <view class="flex align-center">
  94. <text class="lf-color-555 lf-font-28" style="margin-right: 20rpx;">实付款</text>
  95. <lf-price :price="orderDetails.price" />
  96. </view>
  97. <button class="btn bg-green" v-if="orderDetails.status == 2 || orderDetails.status == 3">
  98. <text class="lf-font-32 text-white">立即使用</text>
  99. </button>
  100. <button class="btn bg-green" v-if="orderDetails.status == 0" @click="payAtonce()">
  101. <text class="lf-font-32 text-white">立即付款</text>
  102. </button>
  103. <button class="btn bg-blue" v-if="orderDetails.status == 16">
  104. <text class="lf-font-32 text-white">已使用</text>
  105. </button>
  106. <button class="btn lf-bg-gray" v-if="orderDetails.status == 6">
  107. <text class="lf-font-32 text-white">等待审核</text>
  108. </button>
  109. <button class="btn lf-bg-gray" v-if="orderDetails.status == 7">
  110. <text class="lf-font-32 text-white">退款成功</text>
  111. </button>
  112. <button class="btn lf-bg-gray" v-if="orderDetails.status == 8">
  113. <text class="lf-font-32 text-white">退款拒绝</text>
  114. </button>
  115. <button class="btn lf-bg-gray" v-if="orderDetails.status == 4">
  116. <text class="lf-font-32 text-white">{{orderDetails.status_text}}</text>
  117. </button>
  118. <button class="btn lf-bg-gray" v-if="orderDetails.status == -1">
  119. <text class="lf-font-32 text-white">已取消</text>
  120. </button>
  121. <!-- <button class="btn lf-bg-gray" v-else>
  122. <text class="lf-font-32 text-white">{{orderDetails.status_text}}</text>
  123. </button> -->
  124. </view>
  125. </view>
  126. </block>
  127. </view>
  128. </template>
  129. <script>
  130. import tkiQrcode from "tki-qrcode" // 二维码生成器
  131. export default {
  132. components: {
  133. tkiQrcode
  134. },
  135. data() {
  136. return {
  137. base64Img: '', //
  138. skeletonLoading: true,
  139. loading: false,
  140. order_id: 1,
  141. orderDetails: {
  142. },
  143. checkArea: ''
  144. }
  145. },
  146. computed: {
  147. total(){
  148. return this.num * this.price
  149. },
  150. isRight(){
  151. return function(val){
  152. return this.$shared.isRight(val);
  153. }
  154. }
  155. },
  156. onLoad(e) {
  157. this.order_id = e.order_id
  158. if (this.order_id) {
  159. this.getOrderDetails()
  160. }
  161. },
  162. methods: {
  163. refreshCode() {
  164. this.getOrderDetails()
  165. this.$msg('刷新成功')
  166. },
  167. payAtonce() {
  168. this.$http(this.API.API_ORDERPAY,{id: this.order_id}).then(res => {
  169. uni.requestPayment({
  170. orderInfo: res.data.order_num,
  171. timeStamp: res.data.timeStamp,
  172. nonceStr: res.data.nonceStr,
  173. package: res.data.package,
  174. signType: res.data.signType,
  175. paySign: res.data.paySign,
  176. success: (res) => {
  177. this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'})
  178. },
  179. fail: (err) => {
  180. this.$url('/pages/payState/paystate?ifSuccess=2&order_id='+this.order_id,{type: 'redirect'})
  181. },
  182. })
  183. }).catch(err => {})
  184. },
  185. //二维码回调
  186. qrR(data) {
  187. this.base64Img = data;
  188. },
  189. getOrderDetails() {
  190. this.$http(this.API.API_ORDER_DETAILS, {
  191. id: this.order_id
  192. }).then(res => {
  193. this.orderDetails = res.data
  194. this.checkArea = res.data.verify_code
  195. this.skeletonLoading = false
  196. console.log(res.data)
  197. }).catch(err => {
  198. setTimeout(() => {
  199. this.$toBack()
  200. }, 1000)
  201. });
  202. },
  203. // 点击复制
  204. copy(text) {
  205. uni.setClipboardData({
  206. data: text
  207. });
  208. },
  209. submit() {
  210. this.$routerGo('/pages/order/order?type=all')
  211. },
  212. },
  213. created() {
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. .btn{
  219. margin: 0;
  220. padding: 0;
  221. width: 212rpx;
  222. height: 82rpx;
  223. background-color: #1998FE;
  224. color: #FFFFFF;
  225. line-height: 80rpx;
  226. font-size: 32rpx;
  227. border-radius: 41rpx;
  228. }
  229. .tag-self {
  230. position: absolute !important;
  231. top: 0 !important;
  232. border-radius: 20rpx 0 20rpx 0 !important;
  233. width: max-content;
  234. height: 32rpx !important;
  235. }
  236. .title {
  237. font-size: 28rpx;
  238. color: $u-content-color;
  239. height: 90rpx;
  240. }
  241. // tab
  242. .ctab {
  243. width: 100%;
  244. margin: 20rpx 0 0rpx 0rpx;
  245. padding: 0 22rpx;
  246. }
  247. // 商品列表
  248. .com {
  249. width: 100%;
  250. overflow: hidden;
  251. .list {
  252. border-radius: 10rpx;
  253. overflow: hidden;
  254. margin: 20rpx 32rpx;
  255. background-color: #FFFFFF;
  256. // box-shadow: 0 0 10px 5px #e5e5e5;
  257. box-shadow: 0 10rpx 20rpx 0 rgba(0, 0, 0, 0.1);
  258. align-items: flex-start;
  259. .left {
  260. overflow: hidden;
  261. image {
  262. width: 186rpx;
  263. height: 186rpx;
  264. margin: 20rpx;
  265. border-radius: 10rpx;
  266. }
  267. }
  268. .right {
  269. overflow: hidden;
  270. width: 64%;
  271. .title {
  272. margin: 0rpx 20rpx 10rpx 0;
  273. color: #222222;
  274. font-size: 32rpx;
  275. }
  276. .tips {
  277. margin: 16rpx 0;
  278. overflow: hidden;
  279. .u-line-progress {
  280. width: 112rpx;
  281. overflow: hidden;
  282. margin-right: 20rpx;
  283. }
  284. .progress {
  285. color: #777777;
  286. font-size: 24rpx;
  287. }
  288. .bought {
  289. color: #777777;
  290. font-size: 24rpx;
  291. margin-right: 20rpx;
  292. }
  293. }
  294. .price {
  295. overflow: hidden;
  296. color: #FF0000;
  297. margin-top: 10rpx;
  298. button {
  299. width: 176rpx;
  300. height: 60rpx;
  301. background: #FE9903;
  302. border-radius: 15px;
  303. font-size: 24rpx;
  304. color: #FFFFFF;
  305. margin: 0rpx 20rpx 0rpx 20rpx;
  306. border: none;
  307. }
  308. }
  309. }
  310. }
  311. }
  312. </style>