store.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view>
  3. <view class="head">
  4. 请选择门店
  5. </view>
  6. <My_listbox ref="List" @getlist="getList" bottomHeight="70">
  7. <view class="item" v-for="item in list" hover-class="navigator-hover" @click="selectItem(item)"
  8. :key="item.sa_storeid">
  9. <checkbox :checked="selectList.some(v => v == item.sa_storeid)" color="#3874F6"
  10. style="transform:scale(0.7)" />
  11. <view style="flex:1">
  12. <view class="title u-line-1">{{ item.storename || '' }}</view>
  13. <view class="content">
  14. <view class="left">
  15. <view class="tag-box">
  16. <view class="storetype">
  17. {{ item.storetype }}
  18. </view>
  19. <view class="markettype">
  20. {{ item.markettype }}
  21. </view>
  22. </view>
  23. <view class="row">
  24. <text class="iconfont icon-renyuan-hui" />
  25. <text>
  26. {{ item.name }}
  27. </text>
  28. <text style="margin-left: 5px;">
  29. {{ item.phonenumber }}
  30. </text>
  31. </view>
  32. <view class="row">
  33. <text class="iconfont icon-dizhi-hui1" />
  34. {{ getCity(item) }}
  35. </view>
  36. <view class="row">
  37. 状态:<text :style="{ color: item.color }">{{ item.status }}</text>
  38. </view>
  39. </view>
  40. <view class="right">
  41. <u--image :src="item.cover" :width="tovw(100)" :height="tovw(100)" radius="5">
  42. <template v-slot:loading>
  43. <u-loading-icon color="red"></u-loading-icon>
  44. </template>
  45. </u--image>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </My_listbox>
  51. <view class="footer">
  52. <view class="total">
  53. 已选:{{ selectList.length }}
  54. </view>
  55. <view class="confirm" :class="selectList.length ? '' : 'forbidden'" @click="selectList.length ? submit() : ''">
  56. 确定
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. list: [],
  66. "content": {
  67. "where": {
  68. "condition": "",
  69. "storetype": "",
  70. "status": "审核"
  71. }
  72. },
  73. selectList: [],
  74. results: [],
  75. }
  76. },
  77. onLoad(options) {
  78. uni.setNavigationBarTitle({
  79. title: options.title || '选择门店'
  80. });
  81. if (options.alreadySelecteds) {
  82. const alreadySelecteds = JSON.parse(options.alreadySelecteds);
  83. this.selectList = alreadySelecteds.value;
  84. this.results = alreadySelecteds.value.map((v, i) => {
  85. return {
  86. sa_storeid: v,
  87. storename: alreadySelecteds.showValue[i]
  88. }
  89. });
  90. }
  91. this.getList()
  92. },
  93. methods: {
  94. getList(init = false) {
  95. if (this.paging(this.content, init)) return;
  96. this.$Http.basic({
  97. "id": 20240410095602,
  98. content: this.content
  99. }).then(res => {
  100. this.$refs.List.RefreshToComplete()
  101. console.log("获取门店列表", res)
  102. if (this.cutoff(res.msg)) return;
  103. res.data = res.data.map(v => {
  104. v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos[0], 'compressed') || uni.getStorageSync("site").logo : uni.getStorageSync("site").logo
  105. switch (v.status) {
  106. case '提交':
  107. v.color = '#009270'
  108. break;
  109. case '审核':
  110. v.color = '#095DE0'
  111. break;
  112. default:
  113. v.color = '#333333'
  114. break;
  115. }
  116. return v
  117. })
  118. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  119. this.content = this.$refs.List.paging(this.content, res)
  120. })
  121. },
  122. selectItem(item) {
  123. let index = this.selectList.findIndex(v => v == item.sa_storeid);
  124. if (index == -1) {
  125. this.selectList.push(item.sa_storeid)
  126. this.results.push(item)
  127. } else {
  128. this.selectList.splice(index, 1);
  129. this.results.splice(index, 1);
  130. }
  131. },
  132. submit() {
  133. this.$Http.routeSelected({
  134. value: this.selectList,
  135. showValue: this.results.map(v => v.storename)
  136. })
  137. }
  138. },
  139. }
  140. </script>
  141. <style lang="scss" scoped>
  142. .head {
  143. line-height: 17px;
  144. font-family: Source Han Sans SC, Source Han Sans SC;
  145. font-size: 12px;
  146. color: #666666;
  147. padding: 10px;
  148. }
  149. .item {
  150. width: 100vw;
  151. background: #FFFFFF;
  152. padding: 10px;
  153. box-sizing: border-box;
  154. margin-bottom: 10px;
  155. display: flex;
  156. align-items: center;
  157. .title {
  158. line-height: 24px;
  159. font-family: Source Han Sans SC, Source Han Sans SC;
  160. font-weight: bold;
  161. font-size: 16px;
  162. color: #333333;
  163. }
  164. .content {
  165. position: relative;
  166. width: 100%;
  167. .left {
  168. width: 220px;
  169. .tag-box {
  170. display: flex;
  171. .storetype,
  172. .markettype {
  173. font-family: Source Han Sans SC, Source Han Sans SC;
  174. font-size: 12px;
  175. color: #FFFFFF;
  176. height: 24px;
  177. line-height: 24px;
  178. padding: 0 4px;
  179. border-radius: 2px;
  180. margin-top: 5px;
  181. }
  182. .storetype {
  183. background: #095DE0;
  184. }
  185. .markettype {
  186. background: #FC9228;
  187. margin-left: 5px;
  188. }
  189. }
  190. .row {
  191. line-height: 17px;
  192. font-family: Source Han Sans SC, Source Han Sans SC;
  193. font-size: 12px;
  194. color: #888888;
  195. margin-top: 5px;
  196. .iconfont {
  197. margin-right: 5px;
  198. font-size: 12px;
  199. }
  200. }
  201. }
  202. .right {
  203. position: absolute;
  204. right: 0;
  205. bottom: 0;
  206. }
  207. }
  208. }
  209. .footer {
  210. position: fixed;
  211. bottom: 0;
  212. width: 100vw;
  213. height: 65px;
  214. background: #FFFFFF;
  215. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  216. box-sizing: border-box;
  217. padding: 5px 10px;
  218. display: flex;
  219. justify-content: space-between;
  220. .total {
  221. line-height: 45px;
  222. font-family: PingFang SC, PingFang SC;
  223. font-size: 14px;
  224. color: #333333;
  225. }
  226. .confirm {
  227. display: flex;
  228. align-items: center;
  229. justify-content: center;
  230. width: 112px;
  231. height: 45px;
  232. background: #C30D23;
  233. border-radius: 5px;
  234. font-family: PingFang SC, PingFang SC;
  235. font-size: 14px;
  236. color: #FFFFFF;
  237. }
  238. .forbidden {
  239. opacity: .6;
  240. }
  241. }
  242. </style>