footprint.vue 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <div>
  3. <use-table ref="tbl"></use-table>
  4. <div class="container use-table">
  5. <el-table ref="eltbl" :height="tblHeight" :data="tableDatas" highlight-current-row>
  6. <el-table-column label="商品" align="center">
  7. <template slot-scope="scope">
  8. <div class="dflex_vertical_c">
  9. <el-image style="width: 100px;height: 80px;" :src="scope.row.goods.img" :preview-src-list="scope.row.imgs" fit="contain"></el-image>
  10. <div class="left_just">
  11. <div class="ellipsis">{{ scope.row.goods.name }}</div>
  12. <div class="ellipsis">{{ scope.row.goods.name_pw }}</div>
  13. </div>
  14. </div>
  15. </template>
  16. </el-table-column>
  17. <el-table-column label="价格" align="center">
  18. <template slot-scope="scope">
  19. <div class="price">{{ scope.row.goods.price / 100}}</div>
  20. <div class="m_price">{{ scope.row.goods.market_price / 100}}</div>
  21. </template>
  22. </el-table-column>
  23. <el-table-column property="visit_cnt" label="访问数" align="center"></el-table-column>
  24. <el-table-column property="last_modify_time" label="浏览时间" align="center"></el-table-column>
  25. </el-table>
  26. <el-pagination
  27. :current-page="req.page"
  28. :page-sizes="[10, 20, 30, 50, 100]"
  29. :page-size="req.rows"
  30. layout="total, sizes, prev, pager, next, jumper"
  31. :total="tableTotal"
  32. @size-change="sizeChange"
  33. @current-change="currentChange"
  34. ></el-pagination>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. const __name = 'usemall-goods-history, usemall-goods';
  40. export default {
  41. data() {
  42. return {
  43. dataId: '',
  44. req: {
  45. page: 1,
  46. rows: 10,
  47. orderby: 'last_modify_time desc'
  48. },
  49. tblHeight: 0,
  50. tableDatas: [],
  51. tableTotal: 0
  52. };
  53. },
  54. methods: {
  55. async loadData() {
  56. this.$db[__name]
  57. .where({ create_uid: this.dataId })
  58. .field('visit_cnt, last_modify_time, goods.name, goods.name_pw, goods.img, goods.price, goods.market_price')
  59. .totable(this.req)
  60. .then(res => {
  61. if (res.code == 200) {
  62. res.datas.rows.forEach(x => {
  63. x.goods = x.goods[0] || {};
  64. x.imgs = [x.goods.img];
  65. x.last_modify_time = new Date(x.last_modify_time).format();
  66. });
  67. this.tableDatas = res.datas.rows;
  68. this.tableTotal = res.datas.total;
  69. }
  70. });
  71. },
  72. sizeChange(size) {
  73. this.req.rows = size;
  74. this.loadData();
  75. },
  76. currentChange(current) {
  77. this.req.page = current;
  78. this.loadData();
  79. }
  80. },
  81. created() {
  82. this.dataId = this.$route.query.id || '';
  83. this.loadData();
  84. },
  85. updated() {
  86. if (!this.tblHeight) {
  87. this.tblHeight = this.$refs.tbl.tblHeight;
  88. }
  89. }
  90. };
  91. </script>
  92. <style></style>