orderDetails.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <app-layout>
  3. <view class="app-order-details">
  4. <app-write-off-code :hidden="hidden" :itemId="item.id" @hiden="hidden = false"></app-write-off-code>
  5. <view v-if="refundBoolean">
  6. <app-prompt-box @click="close" text="是否确认申请退款该订单"></app-prompt-box>
  7. </view>
  8. <view v-if="payBoolean">
  9. <app-prompt-box @click="goPay" text="是否确认支付该订单"></app-prompt-box>
  10. </view>
  11. <view v-if="cancelBoolean"></view>
  12. <view class="app-image-title dir-left-nowrap">
  13. <image class="app-image" :src="item.store.cover_url"></image>
  14. <view class="app-content dir-top-nowrap">
  15. <text class="app-content-title">{{item.store.name}}</text>
  16. <view class="app-prices dir-left-nowrap main-right cross-center">
  17. <text class="app-old-price">{{item.total_goods_original_price}}</text>
  18. <text class="app-new-price">{{item.total_pay_price}}</text>
  19. </view>
  20. </view>
  21. </view>
  22. <text class="app-title">门店信息</text>
  23. <view class="app-store">
  24. <app-store :address="item.store.address" :business_hours="item.store.business_hours" :storeNum="item.store_list.length" :goods_id="item.id" :store_id="item.store.id" :name="item.store.name" :sotreNum="item.store.length" :title="title" :borderStyle="borderStyle" :icon="icon"></app-store>
  25. </view>
  26. <text class="app-title">订单信息</text>
  27. <view class="app-order-information dir-top-nowrap main-left">
  28. <text>姓名: {{item.name}}</text>
  29. <text>手机号: {{item.mobile}}</text>
  30. <text>订单号: {{item.order_no}}</text>
  31. <text>下单时间: {{item.created_at}}</text>
  32. </view>
  33. <text class="app-title" v-if="item.order_form.length > 0">其他信息</text>
  34. <view class="app-other" v-if="item.order_form.length > 0">
  35. <block v-for="(it, index) in item.order_form" :key="index">
  36. <template v-if="it.key === 'img_upload'">
  37. <view class="app-in dir-top-nowrap">
  38. <text class="app-top">{{it.label}}</text>
  39. <image class="app-image" :src="it.value"></image>
  40. </view>
  41. </template>
  42. <template v-else>
  43. <view class="app-in dir-top-nowrap" v-if="it.value" :class="{'app-border': item.order_form.length-1 !== index}" >
  44. <text class="app-top" >{{it.label}}</text>
  45. <text class="app-bottom" >{{it.value}}</text>
  46. </view>
  47. </template>
  48. </block>
  49. </view>
  50. <view class="empty" v-if="item.cancel_status == 0 && item.is_sale == 0"></view>
  51. <view class="app-buttons dir-left-nowrap main-right cross-center" v-if="item.cancel_status == 0 && item.is_sale == 0">
  52. <view class="app-button" v-if="item.is_pay == 0">
  53. <app-form-id >
  54. <button class="app-button app-red" @click="payBoolean = true">去支付</button>
  55. </app-form-id>
  56. </view>
  57. <view class="app-button" v-if="item.is_pay == 0">
  58. <app-form-id >
  59. <button class="app-button app-white">申请取消</button>
  60. </app-form-id>
  61. </view>
  62. <view class="app-button" v-if="item.is_confirm == 1" @click="evaluation">
  63. <app-form-id>
  64. <button class="app-button app-red" >去评价</button>
  65. </app-form-id>
  66. </view>
  67. <view class="app-button" v-if="item.cancel_status != 2 && item.is_pay == 1 && item.is_confirm == 0">
  68. <app-form-id>
  69. <view class="app-button app-red" @click="useImmediately">立即使用</view>
  70. </app-form-id>
  71. </view>
  72. <!-- <view class="app-button" v-if="item.cancel_status != 2 && item.is_pay == 1 && item.is_confirm == 0">
  73. <app-form-id >
  74. <view class="app-button app-white" @click="refundBoolean = true">申请退款</view>
  75. </app-form-id>
  76. </view> -->
  77. <view class="app-button" v-if="item.cancel_status != 2 && item.is_pay == 1 && item.is_confirm == 0">
  78. <app-form-id >
  79. <view class="app-button app-white" @click="to">代付尾款</view>
  80. </app-form-id>
  81. </view>
  82. </view>
  83. </view>
  84. </app-layout>
  85. </template>
  86. <script>
  87. import appStore from '../components/app-store.vue';
  88. import appPromptBox from '../../../components/basic-component/app-prompt-box/app-prompt-box.vue';
  89. import appWriteOffCode from '../components/app-write-off-code.vue';
  90. let borderStyle = false;
  91. let icon = false;
  92. let title = false;
  93. export default {
  94. name: 'orderDetails',
  95. components: {
  96. 'app-store': appStore,
  97. 'app-prompt-box': appPromptBox,
  98. 'app-write-off-code': appWriteOffCode,
  99. },
  100. data() {
  101. return {
  102. item: null,
  103. file_path: '',
  104. hidden: false,
  105. refundBoolean: false,
  106. payBoolean: false,
  107. cancelBoolean: false,
  108. }
  109. },
  110. onLoad(options) {
  111. this.request(options);
  112. },
  113. methods: {
  114. request(options) {
  115. this.$request({
  116. url: this.$api.book.order_detail,
  117. data: {
  118. id: options.id,
  119. }
  120. }).then(response => {
  121. this.item = response.data.detail;
  122. })
  123. },
  124. useImmediately() {
  125. this.hidden = true;
  126. },
  127. close(boolean) {
  128. if (boolean) {
  129. this.$request({
  130. url: this.$api.order.cancel,
  131. data: {
  132. id: this.item.id
  133. }
  134. }).then(response => {
  135. if (response.code === 0) {
  136. this.refundBoolean = false;
  137. this.request({
  138. id: this.item.id
  139. });
  140. }
  141. });
  142. } else {
  143. this.refundBoolean = false;
  144. }
  145. },
  146. goPay(boolean) {
  147. this.payBoolean = false;
  148. if (boolean) {
  149. this.$request({
  150. url: this.$api.order.list_pay_data,
  151. data: {
  152. id: this.item.id
  153. }
  154. }).then(response => {
  155. if (response.code === 0) {
  156. this.$payment.pay(response.data.id).then(msg => {
  157. // 支付成功
  158. this.item.is_pay = 1;
  159. }).catch(msg => {
  160. // 支付失败
  161. });
  162. } else {
  163. }
  164. })
  165. } else {
  166. this.payBoolean = false;
  167. }
  168. },
  169. evaluation() {
  170. uni.navigateTo({
  171. url: `/pages/order/appraise/appraise?id=${this.item.id}`
  172. });
  173. },
  174. to(){
  175. uni.navigateTo({
  176. url:'/plugins/scan_code/index/index'
  177. })
  178. }
  179. }
  180. }
  181. </script>
  182. <style scoped lang="scss">
  183. .app-order-details {
  184. background-color: #f7f7f7;
  185. width: #{750rpx};
  186. padding: #{20rpx} #{24rpx};
  187. .app-title {
  188. display: inline-block;
  189. margin-top: #{32rpx};
  190. margin-bottom: #{24rpx};
  191. color: #999999;
  192. font-size: #{26rpx};
  193. }
  194. >view {
  195. width: #{750-48rpx};
  196. border-radius: #{16rpx};
  197. background-color: white;
  198. }
  199. .app-image-title {
  200. padding: #{24rpx};
  201. .app-image {
  202. width: #{208rpx};
  203. height: #{160rpx};
  204. }
  205. .app-content {
  206. width: #{750-48-48-24-208rpx};
  207. margin-left: #{24rpx};
  208. height: #{160rpx};
  209. .app-content-title {
  210. display: inline-block;
  211. margin-top: #{10rpx};
  212. font-size: #{28rpx};
  213. color: #353535;
  214. word-break: break-all;
  215. text-overflow: ellipsis;
  216. display: -webkit-box;
  217. -webkit-box-orient: vertical;
  218. -webkit-line-clamp: 2;
  219. overflow: hidden;
  220. height: #{64rpx};
  221. width: 100%;
  222. }
  223. .app-prices {
  224. padding-top: #{50rpx};
  225. >text:before {
  226. content: '¥';
  227. }
  228. .app-old-price {
  229. color: #a4a4a4;
  230. font-size: #{24rpx};
  231. text-decoration:line-through;
  232. }
  233. .app-new-price {
  234. margin-left: #{24rpx};
  235. font-size: #{32rpx};
  236. color: #ff4544;
  237. }
  238. }
  239. }
  240. }
  241. .app-order-information {
  242. padding: #{28rpx} #{24rpx} #{12rpx} #{24rpx};
  243. >text {
  244. font-size: #{28rpx};
  245. color: #353535;
  246. margin-bottom: #{16rpx};
  247. }
  248. }
  249. .app-other {
  250. padding: 0 #{24rpx};
  251. .app-in {
  252. padding: #{28rpx} 0;
  253. font-size: #{28rpx};
  254. .app-top {
  255. margin-bottom: #{24rpx};
  256. color: #999999;
  257. }
  258. .app-bottom {
  259. color: #353535;
  260. }
  261. }
  262. .app-border {
  263. border-bottom: #{1rpx} solid #e2e2e2;
  264. }
  265. .app-image {
  266. width: #{150rpx};
  267. height: #{150rpx};
  268. border-radius: #{8rpx};
  269. }
  270. }
  271. .app-buttons {
  272. height: #{102rpx};
  273. width: #{750rpx};
  274. background-color: white;
  275. border-top: #{1rpx} solid #e2e2e2;
  276. position: fixed;
  277. left: 0;
  278. bottom: 0;
  279. >view {
  280. margin-right: #{15rpx};
  281. }
  282. .app-button {
  283. height: #{60rpx};
  284. line-height: #{60rpx};
  285. font-size: #{28rpx};
  286. border-radius: #{25rpx};
  287. display: inline-block;
  288. }
  289. .app-red {
  290. border: #{1rpx} solid #ff4544;
  291. background-color: #fff5f5;
  292. color: #ff4544;
  293. padding: 0 #{30rpx};
  294. }
  295. .app-white {
  296. background-color: white;
  297. border: #{1rpx} solid #d4d4d4;
  298. color: #565656;
  299. padding: 0 #{30rpx};
  300. }
  301. }
  302. }
  303. .empty {
  304. height: #{102rpx};
  305. width: #{750rpx};
  306. background-color: #f7f7f7 !important;
  307. }
  308. </style>