distCustom.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <view class="app-main app-content">
  3. <view class="input-wrap_box">
  4. <view>
  5. <AppSearchModule placeholder="输入拼音首字母搜索" @input="searchFn"/>
  6. </view>
  7. </view>
  8. <block v-if="!$util.isEmpty(list.data)">
  9. <block v-for="(item, index) in list.data" :key="index">
  10. <tui-list-cell :arrow="false">
  11. <view class="tui-msg-box">
  12. <img :src="item.avatar" class="tui-msg-pic" mode="widthFix"/>
  13. <view class="tui-msg-item" style="position:relative;">
  14. <view class="tui-msg-name">
  15. <view class="tui-user-name">
  16. {{ item.name }}
  17. <text v-if="item.level == 2" class="super-man">大客</text>
  18. <text v-if="item.level == 9" class="cost-man">成本</text>
  19. <text v-if="item.level == 0" class="ls-man">零售</text>
  20. </view>
  21. </view>
  22. <view class="tui-msg-content">
  23. <span>{{ item.visitTime.substr(5,11) }}</span>
  24. <text v-if="item.overTimeUnExpend && item.overTimeUnExpend == 10000" style="font-size:24upx;margin-left:20upx;color:green;font-weight:bold;">没有下过</text>
  25. <text v-if="item.overTimeUnExpend && item.overTimeUnExpend == 7" style="font-size:24upx;margin-left:20upx;color:green;font-weight:bold;">1周未下</text>
  26. <text v-if="item.overTimeUnExpend && item.overTimeUnExpend == 30" style="font-size:24upx;margin-left:20upx;color:green;font-weight:bold;">1个月未下</text>
  27. <text v-if="item.overTimeUnExpend && item.overTimeUnExpend == 180" style="font-size:24upx;margin-left:20upx;color:green;font-weight:bold;">半年未下</text>
  28. <text v-if="item.overTimeUnExpend && item.overTimeUnExpend == 365" style="font-size:24upx;margin-left:20upx;color:green;font-weight:bold;">1年未下</text>
  29. <text v-if="item.distName!=''" style="margin-left:30upx;font-size:30upx;font-weight:bold;color:#3385FF;">{{ item.distName }}</text>
  30. </view>
  31. <button class="admin-button-com middle" @click="openDistSelect(item)" style="position: absolute;right:80upx;top:-15upx;">重选</button>
  32. <button class="admin-button-com middle blue" @click="confirmDist(item)" style="position: absolute;right:-50upx;top:-15upx;">确认</button>
  33. </view>
  34. </view>
  35. </tui-list-cell>
  36. </block>
  37. </block>
  38. <block v-else>
  39. <app-wrapper-empty :is-empty="$util.isEmpty(list.data)" />
  40. </block>
  41. <!-- 配送区域选择弹框 -->
  42. <uni-popup ref="distSelectRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
  43. <view style="max-height:90vh;overflow: scroll;">
  44. <view style="margin-left:30upx;margin-top:19upx;font-size:27upx;font-weight:bold;">请选择片区</view>
  45. <view style="display:flex;padding:20upx;height:auto;justify-content: flex-start;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
  46. <view v-for="(item, index) in allDist" :key="index" style="margin-bottom:20upx;margin-left:3upx;">
  47. <button
  48. class="admin-button-com staff-btn"
  49. @click.stop="selectDist(item)"
  50. :class="{'selected': currentDist.id === item.id}"
  51. >
  52. {{ item.name }}
  53. </button>
  54. </view>
  55. </view>
  56. <view style="text-align:center;padding:10upx 0 10upx 0;">
  57. <button class="admin-button-com big blue" style="width:210upx;" @click="cancelDistSelect()">取消</button>
  58. </view>
  59. </view>
  60. </uni-popup>
  61. </view>
  62. </template>
  63. <script>
  64. import TuiListCell from "@/components/plugin/list-cell";
  65. import BadgeModule from "@/components/plugin/badge";
  66. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  67. import appVipModule from "@/components/module/app-vip";
  68. import AppSearchModule from "@/components/module/app-search";
  69. import { list } from "@/mixins";
  70. import { getList } from "@/api/member";
  71. import { getAllDist,changeDist } from "@/api/dist"
  72. import { mapGetters } from "vuex";
  73. export default {
  74. name: "selectCustom",
  75. components: {
  76. TuiListCell,
  77. BadgeModule,
  78. AppWrapperEmpty,
  79. appVipModule,
  80. AppSearchModule
  81. },
  82. mixins: [list],
  83. data() {
  84. return {
  85. tabIndex: 0,
  86. currentDist: {},
  87. currentCustom: {},
  88. couldScan: false,
  89. allDist: []
  90. };
  91. },
  92. computed:{
  93. },
  94. onPullDownRefresh() {
  95. this.resetList();
  96. this.getCustomList().then((res) => {
  97. uni.stopPullDownRefresh();
  98. });
  99. },
  100. onReachBottom() {
  101. if (!this.list.finished) {
  102. this.getCustomList().then((res) => {
  103. uni.stopPullDownRefresh();
  104. });
  105. } else {
  106. uni.stopPullDownRefresh();
  107. }
  108. },
  109. onLoad() {
  110. getAllDist().then(res=>{
  111. if(res.code == 1){
  112. this.allDist = res.data.list?res.data.list:[]
  113. }
  114. })
  115. if(this.option.distName){
  116. uni.setNavigationBarTitle({ title: '设置为'+this.option.distName })
  117. }
  118. },
  119. methods: {
  120. init() {
  121. this.getCustomList()
  122. },
  123. searchFn(e) {
  124. this.resetList();
  125. this.seekVal = e;
  126. this.getCustomList();
  127. },
  128. getCustomList() {
  129. return getList({
  130. search: "",
  131. type:this.tabIndex,
  132. page: this.list.page,
  133. name: this.seekVal,
  134. }).then((res) => {
  135. this.completes(res);
  136. if (this.$util.isEmpty(res.data)){
  137. return false;
  138. }
  139. });
  140. },
  141. // 打开配送区域选择弹框
  142. openDistSelect(item) {
  143. this.currentCustom = item;
  144. this.currentDist = { id: item.distId } || {};
  145. this.$refs.distSelectRef.open('center');
  146. },
  147. confirmDist(custom){
  148. let distId = this.option.distId?this.option.distId:0
  149. let distName = this.option.distName?this.option.distName:''
  150. changeDist({customId:custom.id,distId:distId}).then(res=>{
  151. if(res.code == 1){
  152. this.$msg('设置成功')
  153. custom.distName = distName
  154. }
  155. })
  156. },
  157. // 选择配送区域
  158. selectDist(dist) {
  159. this.$refs.distSelectRef.close();
  160. changeDist({customId:this.currentCustom.id,distId:dist.id}).then(res=>{
  161. if(res.code == 1){
  162. this.$msg('设置成功')
  163. this.currentCustom.distName = dist.name
  164. }
  165. })
  166. },
  167. // 关闭弹框
  168. cancelDistSelect() {
  169. this.$refs.distSelectRef.close();
  170. }
  171. },
  172. };
  173. </script>
  174. <style lang="scss" scoped>
  175. .app-content {
  176. padding-top: 100upx;
  177. padding-bottom: 20upx;
  178. }
  179. .tabs-wrap {
  180. position: fixed;
  181. .tabs-left {
  182. width: 80%;
  183. }
  184. .tabs-right {
  185. width: 19%;
  186. border-left: $borderColor;
  187. @include disFlex(center, center);
  188. }
  189. }
  190. .input-wrap_box {
  191. background-color: #fff;
  192. position: fixed;
  193. top: 0;
  194. z-index: 10;
  195. /* 手机mobile屏幕小于1000px */
  196. @media screen and (max-width: 1100px) {
  197. width: 100%;
  198. }
  199. /* 收银台cashier屏幕大于1000px */
  200. @media screen and (min-width:1100px) {
  201. width: 40%;
  202. }
  203. height: 100upx;
  204. display: flex;
  205. align-items: center;
  206. padding: 0 30upx;
  207. & > view:nth-child(1) {
  208. flex: 1;
  209. }
  210. }
  211. .tui-msg-box {
  212. display: flex;
  213. align-items: center;
  214. .tui-msg-pic {
  215. width: 80upx;
  216. height: 80upx;
  217. border-radius: 50%;
  218. margin-right: 20upx;
  219. }
  220. .tui-msg-item {
  221. max-width:700upx;
  222. min-height:100upx;
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: space-between;
  226. & > div {
  227. @include disFlex(center, flex-start);
  228. & > div:first-child {
  229. margin-right: 8upx;
  230. }
  231. }
  232. .level-img {
  233. ::v-deep.vip-text {
  234. left: 70upx;
  235. top: 8upx;
  236. }
  237. }
  238. .normal-img {
  239. width: 70upx;
  240. padding: 2upx 6upx;
  241. color: #999;
  242. background-color: #f0f2f6;
  243. border-radius: 20upx;
  244. .vip-text {
  245. font-size: 24upx;
  246. transform: scale(0.6);
  247. position: relative;
  248. top: -2upx;
  249. left: -8upx;
  250. }
  251. }
  252. .member-img {
  253. width: 70upx;
  254. padding: 2upx 6upx;
  255. color: green;
  256. background-color: #f0f2f6;
  257. border-radius: 20upx;
  258. .vip-text {
  259. font-size: 24upx;
  260. transform: scale(0.6);
  261. position: relative;
  262. top: -2upx;
  263. left: -8upx;
  264. }
  265. }
  266. .iconfont {
  267. color: #00aaed;
  268. }
  269. }
  270. .tui-msg-name {
  271. overflow: hidden;
  272. white-space: nowrap;
  273. text-overflow: ellipsis;
  274. font-size: 30upx;
  275. line-height: 1;
  276. color: #262b3a;
  277. .tui-user-name {
  278. overflow: hidden;
  279. text-overflow: ellipsis;
  280. white-space: nowrap;
  281. width: 500upx;
  282. font-size: 32upx;
  283. .super-man{
  284. margin-left:30upx;
  285. font-size:24upx;
  286. display:inline-block;
  287. color:white;
  288. border:1upx solid green;
  289. padding:6upx 10upx;
  290. background-color: green;
  291. border-radius: 11upx;
  292. }
  293. .cost-man{
  294. margin-left:30upx;
  295. font-size:24upx;
  296. display:inline-block;
  297. color:white;
  298. border:1upx solid red;
  299. padding:6upx 10upx;
  300. background-color: red;
  301. border-radius: 11upx;
  302. }
  303. .ls-man{
  304. margin-left:30upx;
  305. font-size:24upx;
  306. display:inline-block;
  307. color:#6f756f;
  308. border:1upx solid #6f756f;
  309. padding:6upx 10upx;
  310. border-radius: 11upx;
  311. }
  312. }
  313. }
  314. .tui-msg-content {
  315. width:500upx;
  316. overflow: hidden;
  317. white-space: nowrap;
  318. text-overflow: ellipsis;
  319. font-size: 24upx;
  320. line-height: 1;
  321. color: #9397a4;
  322. .debt-amount{
  323. margin-left:20upx;
  324. .amount_num{
  325. color:red;
  326. margin-left:6upx;
  327. font-weight:bold;
  328. }
  329. }
  330. }
  331. }
  332. .tui-msg-right {
  333. max-width: 120upx;
  334. height: 80upx;
  335. margin-left: auto;
  336. margin-right: 24upx;
  337. text-align: right;
  338. display: flex;
  339. justify-content: space-between;
  340. align-items: center;
  341. }
  342. .user_tag {
  343. border: 1upx solid #cccccc;
  344. padding: 5upx 12upx 5upx 12upx;
  345. border-radius: 25upx;
  346. color: #bbbbbb;
  347. margin-right: 10upx;
  348. margin-bottom: 12upx;
  349. display: inline-block;
  350. font-size: 30upx;
  351. }
  352. .class-popup-style{
  353. z-index:99999;
  354. }
  355. .staff-btn {
  356. min-width: 160upx;
  357. padding: 0 27upx;
  358. height: 80upx;
  359. font-size: 40upx;
  360. font-weight: bold;
  361. margin: 8upx 8upx 0 0;
  362. border-radius: 16upx;
  363. background: #f0f2f6;
  364. color: #333;
  365. border: 2upx solid #e0e0e0;
  366. transition: none;
  367. display: flex;
  368. align-items: center;
  369. justify-content: center;
  370. }
  371. .staff-btn.selected,
  372. .staff-btn:active {
  373. background: #f0f2f6;
  374. color: #333;
  375. border-color: #e0e0e0;
  376. }
  377. </style>