Order.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <el-row class="movie-list">
  3. <el-col>
  4. <el-row>
  5. <el-table
  6. ref="multipleTable"
  7. :data="dataList"
  8. :show-header="true"
  9. border
  10. style="width: 100%"
  11. @selection-change="handleSelectionChange"
  12. >
  13. <el-table-column
  14. type="selection"
  15. />
  16. <el-table-column
  17. fixed="left"
  18. label="商品信息"
  19. >
  20. <template slot-scope="scope">
  21. <el-row>
  22. <el-col :md="4">
  23. <el-image :src="scope.row.picUrl" min-width="30" height="20" />
  24. </el-col>
  25. <el-col :md="20">
  26. <router-link target="_blank" style="text-decoration-line: none" :to="`/mall/item?id=${scope.row.itemId}`">
  27. <span>{{scope.row.title}}</span>
  28. </router-link>
  29. </el-col>
  30. </el-row>
  31. </template>
  32. </el-table-column>
  33. <el-table-column
  34. prop="sku"
  35. label="sku"
  36. />
  37. <el-table-column
  38. label="单价"
  39. >
  40. <template slot-scope="scope">
  41. <span style="color: red">¥{{scope.row.price}}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column
  45. label="数量"
  46. >
  47. <template slot-scope="scope">
  48. <el-input-number v-model="scope.row.num" @change="handleChange" :min="1" :max="10" label="描述文字"></el-input-number>
  49. </template>
  50. </el-table-column>
  51. <el-table-column
  52. label="操作"
  53. >
  54. <template slot-scope="scope">
  55. <el-button
  56. size="mini"
  57. @click="collect(scope.row)"
  58. >移入关注</el-button>
  59. <el-button
  60. size="mini"
  61. @click="deleteOne(scope.row)"
  62. >删除</el-button>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <el-pagination
  67. background
  68. :small="screenWidth <= 768"
  69. layout="prev, pager, next"
  70. :page-size="pageSize"
  71. :current-page="currentPage"
  72. :total="totalSize"
  73. @current-change="handleCurrentChange"
  74. @prev-click="handleCurrentChange"
  75. @next-click="handleCurrentChange"
  76. />
  77. </el-row>
  78. </el-col>
  79. </el-row>
  80. </template>
  81. <script>
  82. import {getOrders} from "@/api/mall";
  83. export default {
  84. name: 'Order',
  85. data() {
  86. return {
  87. // 屏幕宽度, 为了控制分页条的大小
  88. screenWidth: document.body.clientWidth,
  89. currentPage: 1,
  90. pageSize: 10,
  91. totalSize: 0,
  92. dataList: [],
  93. checked: false,
  94. searchForm: {
  95. page: 1,
  96. path: '/',
  97. fileType: '0',
  98. filename: null
  99. },
  100. multipleSelection: [],
  101. totalSelected: 0,
  102. totalPrice: '0.00',
  103. productId: null
  104. }
  105. },
  106. created() {
  107. const path = this.$route.query.productId
  108. if (path !== undefined && path !== null) {
  109. this.searchForm.path = path
  110. }
  111. document.title = '我的订单'
  112. this.getData(this.searchForm)
  113. },
  114. methods: {
  115. handleCurrentChange(pageNumber) {
  116. this.currentPage = pageNumber
  117. this.searchForm.page = this.currentPage
  118. this.getData(this.searchForm)
  119. },
  120. getData() {
  121. getOrders(1).then(resp => {
  122. if (resp.code === 0) {
  123. this.dataList = resp.data
  124. } else {
  125. this.$notify({
  126. title: '提示',
  127. message: resp.msg,
  128. type: 'warning',
  129. duration: 3000
  130. })
  131. }
  132. }).catch(error => {
  133. this.$notify({
  134. title: '提示',
  135. message: error.message,
  136. type: 'error',
  137. duration: 3000
  138. })
  139. })
  140. },
  141. getDetail(fileId) {
  142. },
  143. cache(row) {
  144. },
  145. search() {
  146. this.currentPage = 1
  147. this.searchForm.page = this.currentPage
  148. this.getData(this.searchForm)
  149. },
  150. handleSelectionChange(val) {
  151. this.multipleSelection = val
  152. },
  153. deleteMultiple() {
  154. if (this.multipleSelection.length === 0) {
  155. this.$notify({
  156. message: '至少应选中一行',
  157. type: 'warning',
  158. duration: 3000
  159. })
  160. return
  161. }
  162. var fileIds = []
  163. for (const item of this.multipleSelection) {
  164. fileIds.push(item.fileId)
  165. }
  166. this.$confirm('确定要删除文件?', '提示', {
  167. confirmButtonText: '确定',
  168. cancelButtonText: '取消',
  169. type: 'warning'
  170. }).then(() => {
  171. console.log('')
  172. }).catch(() => {
  173. this.$message({
  174. type: 'info',
  175. message: '已取消'
  176. })
  177. })
  178. },
  179. handleChange(value) {
  180. console.log(value);
  181. }
  182. }
  183. }
  184. </script>
  185. <style scoped>
  186. /*处于手机屏幕时*/
  187. @media screen and (max-width: 768px) {
  188. .movie-list {
  189. padding-top: 8px;
  190. padding-left: 0.5%;
  191. padding-right: 0.5%;
  192. }
  193. }
  194. .movie-list {
  195. padding-top: 15px;
  196. padding-left: 6%;
  197. padding-right: 6%;
  198. }
  199. </style>