Order.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <el-row class="movie-list">
  3. <el-col>
  4. <el-row>
  5. <el-table
  6. :data="dataList"
  7. :show-header="true"
  8. border
  9. style="width: 100%"
  10. >
  11. <el-table-column
  12. prop="createAt"
  13. label="创建时间"
  14. />
  15. <el-table-column
  16. label="商品信息"
  17. >
  18. <template slot-scope="scope">
  19. <el-row>
  20. <el-col :md="4">
  21. <el-image :src="scope.row.picUrl" min-width="30" height="20" />
  22. </el-col>
  23. <el-col :md="20">
  24. <router-link target="_blank" style="text-decoration-line: none" :to="`/mall/item?id=${scope.row.itemId}`">
  25. <span>{{ scope.row.title }}</span>
  26. </router-link>
  27. </el-col>
  28. </el-row>
  29. </template>
  30. </el-table-column>
  31. <el-table-column
  32. prop="sku"
  33. label="sku"
  34. />
  35. <el-table-column
  36. label="单价"
  37. >
  38. <template slot-scope="scope">
  39. <span style="color: red">¥{{ scope.row.price }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column
  43. prop="amount"
  44. label="数量"
  45. />
  46. <el-table-column
  47. label="操作"
  48. >
  49. <template slot-scope="scope">
  50. <el-row>
  51. <el-button
  52. size="mini"
  53. @click="getDetail(scope.row)"
  54. >详情</el-button>
  55. <el-button
  56. size="mini"
  57. @click="handleStatus(scope.row)"
  58. >
  59. {{ scope.row.statusText }}
  60. </el-button>
  61. <el-button
  62. size="mini"
  63. @click="deleteOrder(scope.row)"
  64. >删除</el-button>
  65. </el-row>
  66. <el-row>
  67. <el-button
  68. size="mini"
  69. @click="handleLogistics(scope.row)"
  70. >发货</el-button>
  71. <el-button
  72. size="mini"
  73. @click="handleProgress(scope.row)"
  74. >进度</el-button>
  75. </el-row>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <el-pagination
  80. background
  81. :small="screenWidth <= 768"
  82. layout="prev, pager, next"
  83. :page-size="pageSize"
  84. :current-page="currentPage"
  85. :total="totalSize"
  86. @current-change="handleCurrentChange"
  87. @prev-click="handleCurrentChange"
  88. @next-click="handleCurrentChange"
  89. />
  90. </el-row>
  91. </el-col>
  92. <el-dialog
  93. title="支付"
  94. append-to-body
  95. :visible.sync="payDialog"
  96. width="30%"
  97. center
  98. />
  99. <el-dialog
  100. title="物流"
  101. append-to-body
  102. :visible.sync="logisticsDialog"
  103. width="30%"
  104. center
  105. >
  106. <el-timeline :reverse="false">
  107. <el-timeline-item
  108. v-for="(item, index) in logisticsList"
  109. :key="index"
  110. :timestamp="item.createAt"
  111. placement="top"
  112. >
  113. <span>{{ item.current }}</span>
  114. </el-timeline-item>
  115. </el-timeline>
  116. </el-dialog>
  117. <el-dialog
  118. title="订单发货"
  119. append-to-body
  120. :visible.sync="orderLogisticsDialog"
  121. width="30%"
  122. center
  123. >
  124. <el-form :model="orderLogisticsForm">
  125. <el-form-item label="物流" label-width="120px" prop="tpl">
  126. <el-select v-model="logisticsProgressForm.tpl">
  127. <el-option value="顺丰" label="顺丰" />
  128. <el-option value="中通" label="中通" />
  129. <el-option value="韵达" label="韵达" />
  130. </el-select>
  131. </el-form-item>
  132. <el-form-item label="物流订单号" label-width="120px">
  133. <el-input
  134. v-model="orderLogisticsForm.logisticsId"
  135. style="margin-left: 5px"
  136. />
  137. </el-form-item>
  138. <el-button style="float: right; padding: 10px" type="text" @click="submitLogistics">发货</el-button>
  139. </el-form>
  140. </el-dialog>
  141. <el-dialog
  142. title="物流进度"
  143. append-to-body
  144. :visible.sync="logisticsProgressDialog"
  145. width="30%"
  146. center
  147. >
  148. <el-form :model="logisticsProgressForm">
  149. <el-form-item label="状态" label-width="120px" prop="subjectId">
  150. <el-select v-model="logisticsProgressForm.status">
  151. <el-option value="3" label="运输中" />
  152. <el-option value="4" label="派送中" />
  153. <el-option value="5" label="待取件" />
  154. </el-select>
  155. </el-form-item>
  156. <el-form-item label="详情" label-width="120px">
  157. <el-input
  158. v-model="logisticsProgressForm.current"
  159. style="margin-left: 5px"
  160. type="textarea"
  161. :rows="5"
  162. />
  163. </el-form-item>
  164. <el-button style="float: right; padding: 10px" type="text" @click="putProgress">提交进度</el-button>
  165. </el-form>
  166. </el-dialog>
  167. </el-row>
  168. </template>
  169. <script>
  170. import { getOrderLogistics, getOrders, putLogisticsProgress, putOrderLogistics } from '@/api/mall'
  171. export default {
  172. name: 'Order',
  173. data() {
  174. return {
  175. // 屏幕宽度, 为了控制分页条的大小
  176. screenWidth: document.body.clientWidth,
  177. currentPage: 1,
  178. pageSize: 10,
  179. totalSize: 0,
  180. dataList: [],
  181. checked: false,
  182. searchForm: {
  183. page: 1,
  184. path: '/',
  185. fileType: '0',
  186. filename: null
  187. },
  188. multipleSelection: [],
  189. totalSelected: 0,
  190. totalPrice: '0.00',
  191. productId: null,
  192. payDialog: false,
  193. logisticsDialog: false,
  194. logisticsList: [],
  195. logisticsProgressDialog: false,
  196. logisticsProgressForm: {
  197. orderId: null,
  198. status: null,
  199. current: null
  200. },
  201. orderLogisticsDialog: false,
  202. orderLogisticsForm: {
  203. orderId: null,
  204. tpl: null,
  205. logisticsId: null
  206. }
  207. }
  208. },
  209. created() {
  210. const path = this.$route.query.productId
  211. if (path !== undefined && path !== null) {
  212. this.searchForm.path = path
  213. }
  214. document.title = '我的订单'
  215. this.getData(this.searchForm)
  216. },
  217. methods: {
  218. handleCurrentChange(pageNumber) {
  219. this.currentPage = pageNumber
  220. this.searchForm.page = this.currentPage
  221. this.getData(this.searchForm)
  222. },
  223. getData() {
  224. getOrders(1).then(resp => {
  225. if (resp.code === 0) {
  226. this.dataList = resp.data
  227. } else {
  228. this.$notify({
  229. title: '提示',
  230. message: resp.msg,
  231. type: 'warning',
  232. duration: 3000
  233. })
  234. }
  235. }).catch(error => {
  236. this.$notify({
  237. title: '提示',
  238. message: error.message,
  239. type: 'error',
  240. duration: 3000
  241. })
  242. })
  243. },
  244. getDetail(row) {
  245. this.$message.info('订单 ' + row.orderId + ' 详情')
  246. },
  247. deleteOrder(row) {
  248. this.$message.info(row.orderId)
  249. },
  250. handleStatus(row) {
  251. const status = row.status
  252. if (status === 1) {
  253. this.payDialog = true
  254. } else if (status === 2) {
  255. getOrderLogistics(row.orderId).then(resp => {
  256. if (resp.code === 0) {
  257. this.logisticsDialog = true
  258. this.logisticsList = resp.data
  259. }
  260. })
  261. } else if (status === 3) {
  262. this.$message.info('待确认')
  263. }
  264. },
  265. search() {
  266. this.currentPage = 1
  267. this.searchForm.page = this.currentPage
  268. this.getData(this.searchForm)
  269. },
  270. handleChange(value) {
  271. },
  272. handleLogistics(row) {
  273. this.orderLogisticsForm.orderId = row.orderId
  274. this.orderLogisticsDialog = true
  275. },
  276. submitLogistics() {
  277. putOrderLogistics(this.orderLogisticsForm).then(resp => {
  278. if (resp.code !== 0) {
  279. this.$notify.warning({
  280. message: resp.msg,
  281. duration: 3000
  282. })
  283. }
  284. })
  285. this.orderLogisticsForm.orderId = null
  286. this.orderLogisticsForm.tpl = null
  287. this.orderLogisticsForm.logisticsId = null
  288. this.orderLogisticsDialog = false
  289. },
  290. handleProgress(row) {
  291. this.logisticsProgressForm.orderId = row.orderId
  292. this.logisticsProgressDialog = true
  293. },
  294. putProgress() {
  295. putLogisticsProgress(this.logisticsProgressForm).then(resp => {
  296. if (resp.code !== 0) {
  297. this.$notify.warning({
  298. message: resp.msg,
  299. duration: 3000
  300. })
  301. }
  302. })
  303. this.logisticsProgressDialog = false
  304. this.logisticsProgressForm.orderId = null
  305. }
  306. }
  307. }
  308. </script>
  309. <style scoped>
  310. /*处于手机屏幕时*/
  311. @media screen and (max-width: 768px) {
  312. .movie-list {
  313. padding-top: 8px;
  314. padding-left: 0.5%;
  315. padding-right: 0.5%;
  316. }
  317. }
  318. .movie-list {
  319. padding-top: 15px;
  320. padding-left: 6%;
  321. padding-right: 6%;
  322. }
  323. </style>