customer-management.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">客户管理</text>
  6. </view>
  7. </view>
  8. <view class="t-btn" @click="addCustomer()" v-if="perList.indexOf('tb-costomer-add')!==-1">+添加客户</view>
  9. <u-sticky offset-top="0">
  10. <u-tabs :list="tabs" @change="change" :current="current" :is-scroll="false"></u-tabs>
  11. </u-sticky>
  12. <view class="card-box">
  13. <view class="card" v-for="(customerItem,index) in customerItemList" :key="index">
  14. <view class="t">
  15. <image class="icon" src="../../static/home-icon-01.png"></image>
  16. <text class="title">{{customerItem.name}}</text>
  17. </view>
  18. <view class="c">
  19. <view class="item">
  20. <text class="p1">联系人:</text>
  21. <text class="p2">{{customerItem.dutyPeople}}</text>
  22. </view>
  23. <view class="item">
  24. <text class="p1">联系电话:</text>
  25. <text class="p2">{{customerItem.phone}}</text>
  26. </view>
  27. <view class="item">
  28. <text class="p1">营业执照:</text>
  29. <text class="p2">
  30. <image class="licence" :src="customerItem.businessLicence"></image>
  31. </text>
  32. </view>
  33. <view class="item">
  34. <text class="p1">状态:</text>
  35. <text class="p2">
  36. <text v-if="customerItem.judgeStatus==1">未审核</text>
  37. <text v-if="customerItem.judgeStatus==2">审核通过</text>
  38. <text v-if="customerItem.judgeStatus==3">审核不通过</text>
  39. </text>
  40. </view>
  41. </view>
  42. <view class="b">
  43. <view class="btn b1" v-if="customerItem.btnShow==1 " @click="sh(customerItem.id)">审核</view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- 没有数据时显示noData -->
  48. <noData v-if="customerItemList.length==0"></noData>
  49. <u-loadmore style="margin: 30rpx;" :status="status" />
  50. <uni-popup ref="shpopup" type="center">
  51. <uni-popup-dialog type="success" title="确定审核吗?" :duration="2000" @confirm="shconfirm"></uni-popup-dialog>
  52. </uni-popup>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. current: 0,
  60. pageNo: 1,
  61. pageSize: 3,
  62. dataCount: 0,
  63. status: 'loadmore',
  64. page: 0,
  65. tabs: [{
  66. name: '全部',
  67. },
  68. {
  69. name: '未审核',
  70. },
  71. {
  72. name: '审核通过',
  73. },
  74. {
  75. name: '禁用',
  76. }
  77. ],
  78. customerItemList: [{
  79. name: '',
  80. dutyPeople: '',
  81. phone: '',
  82. businessLicence: '',
  83. judgeStatus: '',
  84. btnShow: 0
  85. }, ],
  86. confirmCustomerId: '',
  87. judgeContent: '',
  88. perList: []
  89. }
  90. },
  91. methods: {
  92. getCustomerList() {
  93. this.$api.getCustomerList({
  94. current: this.current,
  95. pageNo: this.pageNo,
  96. pageSize: this.pageSize,
  97. dataCount: this.dataCount,
  98. }).then(resp => {
  99. let customerList = resp.data;
  100. //todo 还要判断当前用户是否为admin
  101. for (let i in customerList) {
  102. if (customerList[i].judgeStatus == 1) {
  103. customerList[i].btnShow = 1;
  104. }
  105. }
  106. this.dataCount = resp.dataCount;
  107. this.pageNo = resp.pageNo;
  108. this.customerItemList = customerList;
  109. if (this.dataCount < this.pageSize * this.pageNo) this.status = 'nomore';
  110. })
  111. },
  112. confirmCustomer() {
  113. this.$api.confirmCustomer({
  114. customerId: this.confirmCustomerId
  115. }).then(resp => {
  116. if (resp.code == 200) {
  117. this.getCustomerList();
  118. }
  119. })
  120. },
  121. //点击上方切换栏,根据点击项重新加载数据
  122. change(obj) {
  123. console.log(obj);
  124. this.current = obj.index;
  125. this.getCustomerList();
  126. // if(index==0){
  127. // //加载全部
  128. // }
  129. // if(index==1){
  130. // //加载未审核
  131. // }
  132. // if(index==2){
  133. // //只加载审核通过
  134. // }
  135. // if(index==3){
  136. // //只加载禁用
  137. // }
  138. },
  139. //点击按钮
  140. //------------------------------------------
  141. sh(id) {
  142. this.confirmCustomerId = id;
  143. this.$refs.shpopup.open('center')
  144. },
  145. shconfirm(index) {
  146. this.confirmCustomer();
  147. this.$refs.shpopup.close()
  148. },
  149. addCustomer() {
  150. this.$common.to("/pages/enterprise-reg/enterprise-reg");
  151. },
  152. //------------------------------------------
  153. //上拉加载更多,分页模拟数据
  154. onReachBottom() {
  155. this.status = 'loading';
  156. if (this.dataCount > this.pageSize * this.pageNo) {
  157. this.pageSize = parseInt(this.pageSize) + 3;
  158. this.getCustomerList();
  159. } else {
  160. this.status = 'nomore';
  161. }
  162. }
  163. },
  164. onLoad() {
  165. this.getCustomerList();
  166. },
  167. onShow() {
  168. this.perList = uni.getStorageSync('perList');
  169. console.log(this.perList)
  170. },
  171. }
  172. </script>
  173. <style lang="scss">
  174. .card-box {
  175. display: flex;
  176. width: 100%;
  177. flex-direction: column;
  178. .card {
  179. background-color: #fff;
  180. border-radius: 20rpx;
  181. margin: 20rpx 20rpx 0 20rpx;
  182. padding: 30rpx;
  183. box-sizing: border-box;
  184. display: flex;
  185. flex-direction: column;
  186. .t {
  187. width: 100%;
  188. display: flex;
  189. align-items: center;
  190. padding-bottom: 30rpx;
  191. border-bottom: 1rpx solid #f5f5f5;
  192. .icon {
  193. width: 40rpx;
  194. height: 40rpx;
  195. }
  196. .title {
  197. font-size: 30rpx;
  198. font-weight: bold;
  199. margin-left: 20rpx;
  200. }
  201. }
  202. .c {
  203. padding: 15rpx 0 30rpx 0;
  204. display: flex;
  205. flex-wrap: wrap;
  206. border-bottom: 1rpx solid #f5f5f5;
  207. .item {
  208. width: 50%;
  209. padding: 20rpx 0;
  210. display: flex;
  211. .car-num {
  212. background-color: #edf6ff;
  213. color: #0080ff;
  214. font-size: 44rpx;
  215. padding: 15rpx 0;
  216. text-align: center;
  217. width: 100%;
  218. border-radius: 10rpx;
  219. font-weight: bold;
  220. letter-spacing: 20rpx;
  221. }
  222. .p1 {
  223. font-size: 28rpx;
  224. color: #999;
  225. flex: 5;
  226. }
  227. .p2 {
  228. font-size: 28rpx;
  229. color: #191919;
  230. font-weight: bold;
  231. margin-left: 20rpx;
  232. flex: 7;
  233. .licence {
  234. width: 80%;
  235. height: 100rpx;
  236. }
  237. }
  238. }
  239. .car-num-item {
  240. width: 100%;
  241. display: flex;
  242. align-items: center;
  243. justify-content: center;
  244. }
  245. }
  246. .b {
  247. display: flex;
  248. width: 100%;
  249. align-items: center;
  250. justify-content: space-between;
  251. .btn {
  252. height: 70rpx;
  253. display: flex;
  254. align-items: center;
  255. justify-content: center;
  256. //width: calc(50% - 15rpx);
  257. width: 100%;
  258. margin: 30rpx 0 0 0;
  259. border-radius: 10rpx;
  260. border-width: 1rpx;
  261. box-sizing: border-box;
  262. }
  263. .b1 {
  264. background-color: #0080ff;
  265. color: #fff;
  266. }
  267. .b2 {
  268. background-color: #f7f7f7;
  269. color: #191919;
  270. }
  271. .b3 {
  272. background-color: #fff;
  273. color: #0080ff;
  274. border: 1rpx solid #0080ff;
  275. }
  276. }
  277. }
  278. }
  279. .t-btn {
  280. width: 400rpx;
  281. margin: 50rpx auto;
  282. height: 88rpx;
  283. font-weight: bold;
  284. display: flex;
  285. align-items: center;
  286. justify-content: center;
  287. border-radius: 10rpx;
  288. color: #191919;
  289. font-size: 28rpx;
  290. background-color: #fff;
  291. border: 1px solid #eee;
  292. }
  293. .popup-box {
  294. text-align: center;
  295. background-color: #fff;
  296. height: 280rpx;
  297. width: 560rpx;
  298. border-radius: 10rpx;
  299. }
  300. @import '@/common/common.scss'
  301. </style>