productItem.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <div class="bgcolor productItem">
  3. <div class="navBarTOP">
  4. <van-nav-bar class="navBar" title="产品列表" left-arrow @click-left="onClickLeft">
  5. <template #right v-if="showOrderButton == 'true'">
  6. <span style="color: #0057ba" @click="placeOrderFn"> 去下单 </span>
  7. </template>
  8. </van-nav-bar>
  9. </div>
  10. <div class="lineGrey"></div>
  11. <div class="lineGrey"></div>
  12. <div class="lineGrey"></div>
  13. <div class="lineGrey"></div>
  14. <div class="lineGrey"></div>
  15. <div class="container" style="width: 100%; margin: 0 auto">
  16. <van-tabs class="myTab" type="card" v-model="tabVal" color="#0057ba" @change="tabChange">
  17. <van-tab :title="timeData + '下单SKU'" name="0"></van-tab>
  18. <van-tab title="建议下单SKU" name="1"></van-tab>
  19. </van-tabs>
  20. <div class="tips" v-if="tabVal == '1'">
  21. <p style="font-weight: bold; font-size: 16px">建议下单规则:</p>
  22. <p>①计算该店所在销售部同店型门店:滚动3个月DIS/OMS下单的TOP产品</p>
  23. <p>②已售品项 VS TOP产品,输出未下单产品TOP50如下</p>
  24. </div>
  25. <div
  26. v-for="item in list"
  27. v-if="list.length"
  28. style="display: flex; flex-direction: column; align-items: center">
  29. <p
  30. style="
  31. font-weight: bold;
  32. font-size: 16px;
  33. text-align: center;
  34. background: #d6eaff;
  35. margin: 0;
  36. padding: 10px 0;
  37. width: 94%;
  38. ">
  39. &nbsp;&nbsp;&nbsp;{{ item.m01Name }}
  40. </p>
  41. <el-table class="table-headermd1" :data="item.productDetailList" border>
  42. <el-table-column label="物料名称" prop="productName" align="center" />
  43. <el-table-column label="规格" prop="productSku" align="center" width="120px" />
  44. </el-table>
  45. </div>
  46. <van-empty v-if="list.length == 0" />
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import { getItemList, buryingPoint } from '@/api';
  52. import { getOrderUrlByStoreId } from '@/api/inventory';
  53. export default {
  54. data() {
  55. return {
  56. list: [],
  57. tabVal: '0',
  58. detail: null,
  59. timeData: '',
  60. showOrderButton: 'false',
  61. };
  62. },
  63. activated() {
  64. this.showOrderButton = this.$route.query.showOrderButton || 'false';
  65. this.tabVal = '0';
  66. buryingPoint({
  67. systemModel: '门店列表',
  68. buryingPointType: 6,
  69. buryingPointValue: '门店拜访-下单SKU数',
  70. buryingPointName: this.tabVal == '0' ? '滚动三个月下单SKU' : '建议下单SKU',
  71. buryingPointPosition: '门店ICON',
  72. });
  73. this.getMonth();
  74. this.getMyInventoryList();
  75. },
  76. methods: {
  77. getMonth() {
  78. // 获取当前日期
  79. var currentDate = new Date();
  80. // 获取当前月份
  81. var currentMonth = currentDate.getMonth();
  82. // 获取当前年份
  83. // var currentYear = currentDate.getFullYear();
  84. var previousMonthDate1 = new Date();
  85. if (currentDate.getDate() == 1) {
  86. previousMonthDate1.setMonth(currentMonth - 1);
  87. } else {
  88. }
  89. var previousMonth1 = previousMonthDate1.getMonth();
  90. var previousYear1 = previousMonthDate1.getFullYear();
  91. // 计算前三个月的年份和月份
  92. var previousMonthDate = new Date();
  93. if (currentDate.getDate() == 1) {
  94. previousMonthDate.setMonth(currentMonth - 3);
  95. } else {
  96. previousMonthDate.setMonth(currentMonth - 2);
  97. }
  98. 1;
  99. var previousMonth = previousMonthDate.getMonth();
  100. var previousYear = previousMonthDate.getFullYear();
  101. //前三个月
  102. if (previousYear1 == previousYear) {
  103. var formattedPreviousMonth1 = previousYear1 + '-' + (previousMonth1 + 1);
  104. // 格式化年份和月份
  105. var formattedPreviousMonth = previousYear + '-' + (previousMonth + 1);
  106. this.timeData =
  107. formattedPreviousMonth.split('-')[1] + '-' + formattedPreviousMonth1.split('-')[1] + '月';
  108. } else {
  109. var formattedPreviousMonth1 = previousYear1 + '年' + (previousMonth1 + 1) + '月';
  110. // .toString().padStart(2, '0');
  111. // 格式化年份和月份
  112. var formattedPreviousMonth = previousYear + '年' + (previousMonth + 1) + '月';
  113. this.timeData = formattedPreviousMonth + '-' + formattedPreviousMonth1;
  114. }
  115. },
  116. tabChange(name) {
  117. this.tabVal = name;
  118. buryingPoint({
  119. systemModel: '门店列表',
  120. buryingPointType: 6,
  121. buryingPointValue: '门店拜访-下单SKU数',
  122. buryingPointName: name == '0' ? '滚动三个月下单SKU' : '建议下单SKU',
  123. buryingPointPosition: '门店ICON',
  124. });
  125. this.setListData();
  126. // this.getMyInventoryList();
  127. },
  128. onSelect(action) {
  129. this.$router.push({
  130. path: '/material',
  131. query: {
  132. tabVal: action,
  133. },
  134. });
  135. },
  136. getMyInventoryList() {
  137. let loading1 = this.$toast.loading({
  138. duration: 0,
  139. message: '加载中...',
  140. forbidClick: true,
  141. });
  142. getItemList({ storeCode: this.$route.query.storeCode }).then((res) => {
  143. loading1.clear();
  144. if (res.code == 200) {
  145. this.loading = false;
  146. this.detail = res.data;
  147. this.setListData();
  148. } else {
  149. this.$toast.fail(res.msg);
  150. }
  151. });
  152. },
  153. setListData() {
  154. this.list = this.tabVal == '0' ? this.detail.threeMonthItemList : this.detail.adviceItemList;
  155. },
  156. placeOrderFn() {
  157. buryingPoint({
  158. systemModel: '门店列表',
  159. buryingPointType: 6,
  160. buryingPointValue: '门店拜访-下单SKU数',
  161. buryingPointName: '去下单',
  162. buryingPointPosition: '门店ICON',
  163. });
  164. let loading1 = this.$toast.loading({
  165. duration: 0,
  166. message: '加载中...',
  167. forbidClick: true,
  168. });
  169. getOrderUrlByStoreId({
  170. storeId: this.$route.query.id,
  171. from: this.$route.query.from || '',
  172. }).then((res) => {
  173. loading1.clear();
  174. if (res.code == 200 && res.data) {
  175. window.location.href = res.data;
  176. } else {
  177. this.Toast({
  178. message: res.msg,
  179. duration: 5000,
  180. });
  181. }
  182. });
  183. },
  184. onClickLeft() {
  185. this.$router.go(-1);
  186. },
  187. },
  188. };
  189. </script>
  190. <style lang="scss">
  191. .productItem {
  192. .container {
  193. background-color: #fff;
  194. padding-bottom: 30px;
  195. .myTab {
  196. margin-bottom: 10px;
  197. .van-tabs__nav--card {
  198. margin: 0 !important;
  199. border-left: 0;
  200. border-right: 0;
  201. }
  202. .van-tabs__wrap,
  203. .van-tabs__nav--card {
  204. height: 39px;
  205. }
  206. .van-tab {
  207. line-height: 40px;
  208. }
  209. }
  210. .myList {
  211. .van-cell {
  212. padding: 0;
  213. &:after {
  214. border-bottom: none;
  215. }
  216. }
  217. }
  218. .tips {
  219. width: 94% !important;
  220. margin: 0 auto;
  221. padding-bottom: 10px;
  222. p {
  223. line-height: 25px;
  224. margin: 0;
  225. }
  226. }
  227. }
  228. }
  229. </style>
  230. <style lang="scss">
  231. .productItem {
  232. .table-headermd1 {
  233. font-size: 16px;
  234. text-align: center;
  235. position: initial;
  236. width: 94% !important;
  237. margin: 0 auto;
  238. }
  239. .table-headermd1 .el-table__header,
  240. .table-headermd1 .el-table__body {
  241. width: 100% !important;
  242. }
  243. // .table-headermd1 col {
  244. // width: 5.8rem;
  245. // }
  246. .table-headermd1 col:nth-child(2),
  247. .table-headermd1 col:nth-child(4),
  248. // .table-headermd1 col:nth-child(3) {
  249. // width: 5rem;
  250. // }
  251. .table-headermd1 .van-cell {
  252. padding: 0 4px;
  253. height: 100%;
  254. }
  255. .table-headermd1 th.el-table__cell > .cell {
  256. padding: 0 4px;
  257. }
  258. .table-headermd1 th.el-table__cell {
  259. background-color: #f3f9ff;
  260. color: #000;
  261. }
  262. .table-headermd1 .el-table__cell {
  263. padding: 4px 0;
  264. }
  265. .el-table__body {
  266. .cell {
  267. font-size: 14px;
  268. }
  269. }
  270. }
  271. </style>