order.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <div>
  3. <scroller >
  4. <div style="padding: 15px;">
  5. <button-tab>
  6. <button-tab-item selected @on-item-click="consoleIndex(1)">预约中</button-tab-item>
  7. <button-tab-item :selected="isComplete" @on-item-click="consoleIndex(3)" >已完成</button-tab-item>
  8. <button-tab-item @on-item-click="consoleIndex(2)">已取消</button-tab-item>
  9. </button-tab>
  10. </div>
  11. <div style="padding-bottom: 16%;">
  12. <div class="order-block" v-for="order in orderList">
  13. <div class="row_first order-line">
  14. <span >订单时间</span>
  15. <span >{{order.booking_time_str}}</span>
  16. <span >{{order.status_str}}</span>
  17. </div>
  18. <div class="row_second order-left-img" @click="checkOrderDetail(order.id,isShow)">
  19. <div>
  20. <span>编号</span>
  21. <span>{{order.order_num}}</span>
  22. </div>
  23. <div>
  24. <span>服务</span>
  25. <span>{{order.products_str}}</span>
  26. </div>
  27. <div>
  28. <span>价格</span>
  29. <span>{{order.price}}元</span>
  30. </div>
  31. </div>
  32. <div class="order-line-button-top"></div>
  33. <div class="order-three" v-if="order.status == 0">
  34. <span></span>
  35. <span @click="del(order.id)">取消订单</span>
  36. <span>立即支付</span>
  37. </div>
  38. <div class="order-three order-three-else" v-else-if="order.status == 1 || order.status == 2 || order.status == 3 || order.status == 4 || order.status == 5">
  39. <span></span>
  40. <span @click="completeOrder(false,order.id)">确认完成</span>
  41. </div>
  42. <div class="order-three order-three-else order-three-else-color" v-else-if="order.status == 6">
  43. <span></span>
  44. <span>立即评价</span>
  45. </div>
  46. </div>
  47. </div>
  48. </scroller>
  49. <div v-transfer-dom>
  50. <x-dialog v-model="showScrollBox" class="dialog-demo">
  51. <span class="dialog-title">确认服务已完成?</span>
  52. <span @click="completeOrder(true)" class="vux-confirm">确认</span>
  53. <span @click="showScrollBox=false" class="vux-close">取消</span>
  54. </x-dialog>
  55. </div>
  56. <div v-transfer-dom>
  57. <x-dialog v-model="showScrollBox1" class="dialog-demo">
  58. <span class="dialog-title">取消订单成功</span>
  59. <span class="vux-confirm" @click="flush()">完成</span>
  60. </x-dialog>
  61. </div>
  62. <navigation></navigation>
  63. </div>
  64. </template>
  65. <script>
  66. import { ButtonTab, ButtonTabItem, Divider, XDialog, TransferDomDirective as TransferDom } from 'vux'
  67. import axios from 'axios'
  68. import qs from 'qs'
  69. import config from '../config/config'
  70. export default {
  71. directives: {
  72. TransferDom
  73. },
  74. components: {
  75. ButtonTab,
  76. ButtonTabItem,
  77. Divider,
  78. XDialog
  79. },
  80. created () {
  81. if (this.$route.query.type !== undefined) {
  82. this.consoleIndex(this.$route.query.type)
  83. this.isComplete = true
  84. } else {
  85. this.consoleIndex(1)
  86. }
  87. },
  88. methods: {
  89. consoleIndex (index) {
  90. this.isShow = index
  91. console.log('click demo01', index)
  92. let orderList = {user_id: config.userId, type: index, page: 1}
  93. orderList = qs.stringify(orderList)
  94. axios.post('o2o/order/list', orderList).then(res => {
  95. this.orderList = res.data.data
  96. console.log(this.orderList)
  97. })
  98. },
  99. flush () {
  100. this.showScrollBox1 = false
  101. this.$router.go(0)
  102. },
  103. completeOrder (isConfirm, id) {
  104. if (!isConfirm) {
  105. this.orderId = id
  106. }
  107. if (isConfirm) {
  108. console.log('修改订单状态')
  109. axios.get('o2o/order/confirmComplete&user_id=' + config.userId + '&order_id=' + this.orderId).then(res => {
  110. if (res.data.success === true) {
  111. this.$router.push({path: '/completeOrder'})
  112. }
  113. })
  114. // order_id user_id
  115. // this.$router.push({path: '/completeOrder', query: {id: this.orderId, type: 1}})
  116. }
  117. this.showScrollBox = true
  118. },
  119. checkOrderDetail (id, type) {
  120. this.$router.push({path: '/orderInfo', query: {id: id, type: type}})
  121. },
  122. del (id) {
  123. axios.get('o2o/order/del&user_id=' + config.userId + '&order_id=' + id).then(res => {
  124. if (res.data.success) {
  125. this.showScrollBox1 = true
  126. }
  127. })
  128. }
  129. },
  130. data () {
  131. return {
  132. isShow: 1,
  133. showScrollBox: false,
  134. showScrollBox1: false,
  135. isComplete: false,
  136. orderId: '',
  137. orderList: {}
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="less" scoped>
  143. .order-block {
  144. border-top:1px solid silver;
  145. border-bottom:1px solid silver;
  146. margin-top: 15px;
  147. }
  148. .row_first {
  149. font-size: .5rem;
  150. display: flex;
  151. span{
  152. display: block;
  153. float: left;
  154. padding: 20px 0;
  155. margin-left: 20px;
  156. &:nth-child(1){
  157. width:20%;
  158. padding-left: 5px;
  159. text-align: left;
  160. }
  161. &:nth-child(3){
  162. width: 20%;
  163. text-align: right;
  164. padding-right: 10px;
  165. }
  166. }
  167. }
  168. .row_second {
  169. font-size: .5rem;
  170. text-align: left;
  171. margin-left: 10px;
  172. margin-bottom: 5px;
  173. div {
  174. margin-top: 5px;
  175. &:nth-child(3) {
  176. margin-bottom: 10px;
  177. }
  178. span {
  179. margin-left: 10px;
  180. }
  181. }
  182. }
  183. .order-line-button-top {
  184. border-top:1px #dfdfdf solid;
  185. width: 90%;
  186. margin-left: 5%;
  187. }
  188. .order-three {
  189. font-size: .5rem;
  190. display: flex;
  191. span{
  192. display: block;
  193. float: right;
  194. padding: 3px 0;
  195. margin-left: 20px;
  196. margin-bottom: 10px;
  197. margin-top: 10px;
  198. &:nth-child(1){
  199. width:60%;
  200. }
  201. &:nth-child(2){
  202. width:20%;
  203. padding: 2px;
  204. border:1px #D3D3D3 solid;
  205. color:#D3D3D3;
  206. text-align: center;
  207. }
  208. &:nth-child(3){
  209. width: 20%;
  210. text-align: center;
  211. border:1px #E16E00 solid;
  212. color:#E16E00;
  213. margin-right: 8px;
  214. padding: 2px 2px 2px 2px;
  215. }
  216. }
  217. }
  218. .order-three-else {
  219. span{
  220. display: block;
  221. float: right;
  222. padding: 3px 0;
  223. margin-left: 20px;
  224. margin-bottom: 10px;
  225. &:nth-child(1){
  226. width:80%;
  227. }
  228. &:nth-child(2){
  229. width: 20%;
  230. text-align: right;
  231. color:#E16E00;
  232. border:1px #E16E00 solid;
  233. margin-right: 8px;
  234. padding: 2px 5px 2px 2px;
  235. }
  236. }
  237. }
  238. .order-three-else-color {
  239. span{
  240. display: block;
  241. float: right;
  242. padding: 3px 0;
  243. margin-left: 20px;
  244. margin-bottom: 10px;
  245. &:nth-child(1){
  246. width:80%;
  247. }
  248. &:nth-child(2){
  249. width: 20%;
  250. text-align: right;
  251. color:#e3ddc4;
  252. border:1px #8F7625 solid;
  253. background-color: #8F7625;
  254. margin-right: 8px;
  255. padding: 2px 5px 2px 2px;
  256. }
  257. }
  258. }
  259. .order-line {
  260. background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='90%' height='1'><rect fill='#c8c7cc' x='0' y='0' width='90%' height='0.5'/></svg>");
  261. background-repeat: no-repeat;
  262. background-position: 20px 50px;
  263. border-bottom: 0;
  264. }
  265. .order-left-img {
  266. width: 90%;
  267. /*height: 100px;*/
  268. margin: 0 auto;
  269. position: relative;
  270. background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAAWdEVYdENyZWF0aW9uIFRpbWUAMjAxNy4zLjXW1e4OAAAA7klEQVRYhc2XwQ3CMAxFXxADsAmHegA2gRHKJDACbMIAyYFNukG5VKhCCkmKXeNboqj/yU6/nTCOI56xcVX/B4CtxkdCCMQYewARuZbOz8seNO5ASqkHLtPyCRxEZKgBsCjBHnjEGHc1h1UyMJXgBhxn29lMmGRARE7AfbZVlQnVEiyBUL8DrRAmPtACYWZEtRCmTpiDSCm9IcytuASh5gOlyPnEagAZiLN7N3QvwSoZyIl3XTeYA3wTB+PfsCRuClDbnk0AWmYDdYAWcXWAVnFVgCXiagDTSN4srgbwEdXioDsV+z1Mfgn3bugO8AJZSqO192KiLQAAAABJRU5ErkJggg==') no-repeat 100% 5%;
  271. background-size: .8rem;
  272. }
  273. .dialog-demo {
  274. font-size: .5rem;
  275. .vux-confirm {
  276. background-color: #2c7cf6;
  277. display: inline-block;
  278. color: white;
  279. border:1px solid;
  280. padding: 10px 0 ;
  281. margin: 10px 0 ;
  282. border-radius: 5px;
  283. width: 40%;
  284. }
  285. .vux-close {
  286. background-color: #f7f7f7;
  287. display: inline-block;
  288. color: #939393;
  289. border:1px solid #c9c9c9;
  290. padding: 10px 0 ;
  291. margin: 10px 0 ;
  292. border-radius: 5px;
  293. width: 40%;
  294. }
  295. .weui-dialog{
  296. border-radius: 8px;
  297. padding-bottom: 8px;
  298. }
  299. .dialog-title {
  300. font-size: .8rem;
  301. line-height: 55px;
  302. text-align: center;
  303. height: 50px;
  304. display: block;
  305. color: #666;
  306. }
  307. .img-box {
  308. height: 350px;
  309. overflow: hidden;
  310. }
  311. .vux-close {
  312. margin-top: 8px;
  313. margin-bottom: 8px;
  314. }
  315. }
  316. </style>