orderInfo.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div class="order-info">
  3. <!--:footer-buttons="buttons1"-->
  4. <div class="order-detail">
  5. <form-preview :body-items="list"></form-preview>
  6. </div>
  7. <div class="order-detail-show">
  8. <group>
  9. <cell title="订单明细" value-align="left" ></cell>
  10. <cell :title="product.name + ' x' + product.count" value-align="left" >
  11. <span slot="value">
  12. {{ userInfo.price }}
  13. </span>
  14. </cell>
  15. <cell title="总价" value-align="left" >
  16. <span slot="value" >
  17. {{ userInfo.price }}
  18. </span>
  19. </cell>
  20. <cell title="订单状态" value-align="left" >
  21. <span slot="value" >
  22. {{ userInfo.status_str }}
  23. </span>
  24. </cell>
  25. <cell v-if="type != 2" title="支付方式" value-align="left" >
  26. <span slot="value" >
  27. 微信
  28. </span>
  29. </cell>
  30. </group>
  31. </div>
  32. <div class="order-detail-show">
  33. <group>
  34. <cell title="订单备注" value-align="left" >
  35. <span slot="value" >
  36. {{ userInfo.memo }}
  37. </span>
  38. </cell>
  39. <cell v-if="!(status == -1 || status == -2)">
  40. <span slot="value" v-if="status == 6">
  41. <span class="order-info-operation_6">立即评价</span>
  42. </span>
  43. <span slot="value" v-else-if="status == 1 || status == 2|| status == 3|| status == 4|| status == 5">
  44. <span class="order-info-operation_1" @click="completeOrder(false,userInfo.id)">确认完成</span>
  45. </span>
  46. <span slot="value" v-else-if="status == 0" class="order-info-operation_0">
  47. <span>立即支付</span>
  48. <span @click="del(userInfo.id)">取消订单</span>
  49. </span>
  50. </cell>
  51. </group>
  52. </div>
  53. <div v-transfer-dom>
  54. <x-dialog v-model="showScrollBox" class="dialog-demo">
  55. <span class="dialog-title">确认服务已完成?</span>
  56. <span @click="completeOrder(true)" class="vux-confirm">确认</span>
  57. <span @click="showScrollBox=false" class="vux-close">取消</span>
  58. </x-dialog>
  59. </div>
  60. <div v-transfer-dom>
  61. <x-dialog v-model="showScrollBox1" class="dialog-demo">
  62. <span class="dialog-title">取消订单成功</span>
  63. <span class="vux-confirm" @click="flush()">完成</span>
  64. </x-dialog>
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. import { Cell, CellBox, CellFormPreview, FormPreview, Group, Badge, XDialog, TransferDomDirective as TransferDom } from 'vux'
  70. import axios from 'axios'
  71. import config from '../config/config'
  72. export default {
  73. directives: {
  74. TransferDom
  75. },
  76. mounted () {
  77. setTimeout(() => {
  78. this.money = -1024
  79. }, 2000)
  80. },
  81. components: {
  82. Group,
  83. Cell,
  84. CellFormPreview,
  85. CellBox,
  86. Badge,
  87. FormPreview,
  88. XDialog
  89. },
  90. created () {
  91. let id = this.$route.query.id
  92. let type = this.$route.query.type
  93. this.type = type
  94. axios.get('o2o/order/detail&order_id=' + id + '&user_id=' + config.userId).then(res => {
  95. this.userInfo = res.data.data
  96. this.product = this.userInfo.products[0].product
  97. this.status = this.userInfo.status
  98. console.log(this.status)
  99. this.list[0].label = '订单状态'
  100. this.list[0].value = this.userInfo.status_str
  101. this.list[1].label = '订单编号'
  102. this.list[1].value = this.userInfo.order_num
  103. this.list[2].label = '服务地点'
  104. this.list[2].value = this.userInfo.address.city + this.userInfo.address.area + this.userInfo.address.detail + this.userInfo.address.poi.name
  105. this.list[3].label = '联系电话'
  106. this.list[3].value = this.userInfo.address.mobile
  107. this.list[4].label = '预约时间'
  108. this.list[4].value = this.userInfo.booking_time_str
  109. this.list[5].label = '下单时间'
  110. this.list[5].value = this.userInfo.order_time_str
  111. if (this.userInfo.cancel_time_str !== '') {
  112. this.list[6].label = '取消时间'
  113. this.list[6].value = this.userInfo.status_str
  114. }
  115. if (this.userInfo.finish_time_str !== '') {
  116. this.list[7].label = '完成时间'
  117. this.list[7].value = this.userInfo.finish_time_str
  118. }
  119. })
  120. },
  121. watch: {
  122. userInfo: function (val, oldVal) {
  123. this.userInfo = val
  124. }
  125. },
  126. methods: {
  127. del (id) {
  128. axios.get('o2o/order/del&user_id=' + config.userId + '&order_id=' + id).then(res => {
  129. if (res.data.success) {
  130. this.showScrollBox1 = true
  131. }
  132. })
  133. },
  134. onClick () {
  135. console.log('on click')
  136. },
  137. flush () {
  138. this.showScrollBox1 = false
  139. this.$router.go(0)
  140. },
  141. completeOrder (isConfirm, id) {
  142. console.log(id)
  143. if (!isConfirm) {
  144. this.orderId = id
  145. }
  146. if (isConfirm) {
  147. console.log('修改订单状态')
  148. axios.get('o2o/order/confirmComplete&user_id=' + config.userId + '&order_id=' + this.orderId).then(res => {
  149. if (res.data.success === true) {
  150. this.$router.push({path: '/completeOrder'})
  151. }
  152. })
  153. // order_id user_id
  154. // this.$router.push({path: '/completeOrder', query: {id: this.orderId, type: 1}})
  155. }
  156. this.showScrollBox = true
  157. }
  158. },
  159. computed: {
  160. },
  161. data () {
  162. return {
  163. userInfo: {},
  164. product: {},
  165. showScrollBox: false,
  166. showScrollBox1: false,
  167. status: 0,
  168. type: 1,
  169. list: [{
  170. label: '',
  171. value: ''
  172. }, {
  173. label: '',
  174. value: ''
  175. }, {
  176. label: '',
  177. value: ''
  178. }, {
  179. label: '',
  180. value: ''
  181. }, {
  182. label: '',
  183. value: ''
  184. }, {
  185. label: '',
  186. value: ''
  187. }, {
  188. label: '',
  189. value: ''
  190. }, {
  191. label: '',
  192. value: ''
  193. }, {
  194. label: '',
  195. value: ''
  196. }, {
  197. label: '',
  198. value: ''
  199. }],
  200. buttons1: [{
  201. style: 'default',
  202. text: '辅助操作'
  203. }, {
  204. style: 'primary',
  205. text: '跳转到首页',
  206. link: '/'
  207. }]
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang="less" scoped>
  213. .order-info {
  214. font-size: .8rem;
  215. background-color: #fafafa;
  216. }
  217. .order-detail {
  218. }
  219. .order-detail-show {
  220. background-color: #ffffff;
  221. margin-top: 10px;
  222. span {
  223. float:right;
  224. }
  225. }
  226. .order-info-operation_6 {
  227. font-size: .8rem;
  228. color:#e3ddc4;
  229. border:1px #8F7625 solid;
  230. background-color: #8F7625;
  231. padding: 2px 5px;
  232. border-radius: 5px;
  233. }
  234. .order-info-operation_1 {
  235. font-size: .8rem;
  236. color:#E16E00;
  237. border:1px #E16E00 solid;
  238. padding: 2px 5px;
  239. border-radius: 5px;
  240. }
  241. .order-info-operation_0 {
  242. span {
  243. font-size: .8rem;
  244. padding: 2px 5px;
  245. border-radius: 5px;
  246. &:nth-child(2) {
  247. margin-right: 10px;
  248. color:#D3D3D3;
  249. border:1px #D3D3D3 solid;
  250. }
  251. &:nth-child(1) {
  252. color:#E16E00;
  253. border:1px #E16E00 solid;
  254. }
  255. }
  256. }
  257. .dialog-demo {
  258. font-size: .5rem;
  259. .vux-confirm {
  260. background-color: #2c7cf6;
  261. display: inline-block;
  262. color: white;
  263. border:1px solid;
  264. padding: 10px 0 ;
  265. margin: 10px 0 ;
  266. border-radius: 5px;
  267. width: 40%;
  268. }
  269. .vux-close {
  270. background-color: #f7f7f7;
  271. display: inline-block;
  272. color: #939393;
  273. border:1px solid #c9c9c9;
  274. padding: 10px 0 ;
  275. margin: 10px 0 ;
  276. border-radius: 5px;
  277. width: 40%;
  278. }
  279. .weui-dialog{
  280. border-radius: 8px;
  281. padding-bottom: 8px;
  282. }
  283. .dialog-title {
  284. font-size: .8rem;
  285. line-height: 55px;
  286. text-align: center;
  287. height: 50px;
  288. display: block;
  289. color: #666;
  290. }
  291. .img-box {
  292. height: 350px;
  293. overflow: hidden;
  294. }
  295. .vux-close {
  296. margin-top: 8px;
  297. margin-bottom: 8px;
  298. }
  299. }
  300. </style>