store.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view>
  3. <view class="search-box">
  4. <My_search background="#fff" @onSearch="onSearch">
  5. <view class="filtration-but" @click="openFiltrate">
  6. 筛选
  7. <text class="iconfont icon-shaixuan" />
  8. </view>
  9. </My_search>
  10. </view>
  11. <view class="head">
  12. <text>
  13. 门店
  14. </text>
  15. <text>
  16. 共{{ total }}个
  17. </text>
  18. </view>
  19. <filtrate ref="Filtrate" :filtrateList="filtrateList" @onFiltration="onFiltration" />
  20. <My_listbox ref="List" @getlist="getList" bottomHeight="70">
  21. <store-list ref="storeList" :list="list" @onClick="onClick" />
  22. </My_listbox>
  23. <view class="footer">
  24. <navigator class="invite" @click="onInsert" url="/store/insert/store">
  25. 新增门店
  26. </navigator>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import storeList from "../modules/storeList"
  32. export default {
  33. components: { storeList },
  34. data() {
  35. return {
  36. "content": {
  37. "where": {
  38. "condition": ""
  39. }
  40. },
  41. total: 0,
  42. list: [],
  43. uninitialized: true,
  44. filtrateList: []
  45. }
  46. },
  47. methods: {
  48. init() {
  49. this.getList(true)
  50. },
  51. openFiltrate() {
  52. if (this.filtrateList.length == 0) {
  53. Promise.all(['storetype'].map(v => this.getCustomClass(v))).then(res => {
  54. let filtrateList = [{
  55. title: "状态",
  56. key: 'status',
  57. showKey: "remarks",
  58. selected: "value",
  59. value: "",
  60. defaultVal: "",
  61. rang: [{ remarks: "新建", value: "新建" }, { remarks: "提交", value: "提交" }, { remarks: "审核", value: "审核" },],
  62. }, {
  63. title: "门店类型",
  64. key: 'storetype',
  65. showKey: "remarks",
  66. selected: "value",
  67. value: "",
  68. defaultVal: "",
  69. rang: [{ remarks: "直营", value: "直营" }, { remarks: "分销", value: "分销" }],
  70. }, {
  71. title: "门店卖场类型",
  72. key: 'markettype',
  73. showKey: "remarks",
  74. selected: "value",
  75. value: "",
  76. defaultVal: "",
  77. rang: res[0],
  78. }]
  79. this.filtrateList = filtrateList.map(v => {
  80. v.rang.unshift({ remarks: "全部", value: "" })
  81. return v
  82. })
  83. this.$refs.Filtrate.changeShow();
  84. })
  85. } else {
  86. this.$refs.Filtrate.changeShow();
  87. }
  88. },
  89. onFiltration(where) {
  90. this.content.where = {
  91. condition: this.content.where.condition,
  92. ...where
  93. };
  94. this.getList(true);
  95. },
  96. getList(init = false) {
  97. if (this.paging(this.content, init)) return;
  98. this.$Http.basic({
  99. "id": "20240410095602",
  100. content: this.content
  101. }).then(res => {
  102. console.log("门店列表", res)
  103. this.$refs.List.RefreshToComplete()
  104. if (this.cutoff(res.msg)) return;
  105. this.uninitialized = false;
  106. this.$refs.List.setHeight()
  107. res.data = this.$refs.storeList.handleList(res.data)
  108. this.total = res.total;
  109. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data), this.colors;
  110. this.content = this.$refs.List.paging(this.content, res)
  111. })
  112. },
  113. onClick(item) {
  114. this.onInsert();
  115. uni.navigateTo({
  116. url: '/store/center/detail?id=' + item.sa_storeid,
  117. });
  118. },
  119. onInsert() {
  120. this.$Http.uploadStoreList = function () {
  121. if (this.content.pageNumber && this.content.pageNumber >= 2) {
  122. let content = this.paging(this.content, true, true)
  123. this.$Http.basic({
  124. "id": "20240410095602",
  125. content
  126. }).then(res => {
  127. console.log("更新门店列表", res)
  128. if (this.cutoff(res.msg)) return;
  129. this.$refs.List.setHeight()
  130. this.list = this.$refs.storeList.handleList(res.data);
  131. })
  132. }
  133. }.bind(this)
  134. },
  135. onSearch(condition) {
  136. this.content.where.condition = condition;
  137. this.getList(true)
  138. }
  139. },
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .search-box {
  144. margin-top: 10px;
  145. padding: 0 10px;
  146. box-sizing: border-box;
  147. .filtration-but {
  148. display: flex;
  149. align-items: center;
  150. font-family: PingFang SC, PingFang SC;
  151. font-size: 14px;
  152. color: #333333;
  153. padding-left: 10px;
  154. text {
  155. color: #DDDDDD !important;
  156. margin-left: 5px;
  157. }
  158. }
  159. }
  160. .head {
  161. display: flex;
  162. align-items: center;
  163. justify-content: space-between;
  164. height: 37px;
  165. padding: 0 10px;
  166. box-sizing: border-box;
  167. font-family: Source Han Sans SC, Source Han Sans SC;
  168. font-size: 12px;
  169. color: #666666;
  170. }
  171. .footer {
  172. position: fixed;
  173. bottom: 0;
  174. display: flex;
  175. justify-content: space-between;
  176. width: 100vw;
  177. height: 65px;
  178. background: #FFFFFF;
  179. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  180. padding: 5px 10px;
  181. box-sizing: border-box;
  182. .invite {
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. flex: 1;
  187. height: 45px;
  188. background: #C30D23;
  189. border-radius: 5px;
  190. font-family: PingFang SC, PingFang SC;
  191. font-weight: 500;
  192. font-size: 16px;
  193. color: #FFFFFF;
  194. }
  195. }
  196. </style>