customer-management.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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()">+添加客户</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. {
  67. name: '全部',
  68. },
  69. {
  70. name: '未审核',
  71. },
  72. {
  73. name: '审核通过',
  74. },
  75. {
  76. name: '禁用',
  77. }
  78. ],
  79. customerItemList:[
  80. {
  81. name:'',
  82. dutyPeople:'',
  83. phone:'',
  84. businessLicence:'',
  85. judgeStatus:'',
  86. btnShow:0
  87. },
  88. ],
  89. confirmCustomerId: '',
  90. judgeContent: '',
  91. }
  92. },
  93. methods: {
  94. getCustomerList(){
  95. this.$api.getCustomerList({
  96. current: this.current,
  97. pageNo: this.pageNo,
  98. pageSize: this.pageSize,
  99. dataCount: this.dataCount,
  100. }).then(resp => {
  101. let customerList = resp.data;
  102. //todo 还要判断当前用户是否为admin
  103. for (let i in customerList) {
  104. if(customerList[i].judgeStatus == 1){
  105. customerList[i].btnShow = 1;
  106. }
  107. }
  108. this.dataCount = resp.dataCount;
  109. this.pageNo = resp.pageNo;
  110. this.customerItemList = customerList;
  111. if(this.dataCount < this.pageSize * this.pageNo) this.status = 'nomore';
  112. })
  113. },
  114. confirmCustomer(){
  115. this.$api.confirmCustomer({
  116. customerId: this.confirmCustomerId
  117. }).then(resp =>{
  118. if(resp.code == 200){
  119. this.getCustomerList();
  120. }
  121. })
  122. },
  123. //点击上方切换栏,根据点击项重新加载数据
  124. change(index) {
  125. this.current = index;
  126. this.getCustomerList();
  127. // if(index==0){
  128. // //加载全部
  129. // }
  130. // if(index==1){
  131. // //加载未审核
  132. // }
  133. // if(index==2){
  134. // //只加载审核通过
  135. // }
  136. // if(index==3){
  137. // //只加载禁用
  138. // }
  139. },
  140. //点击按钮
  141. //------------------------------------------
  142. sh(id){
  143. this.confirmCustomerId = id;
  144. this.$refs.shpopup.open('center')
  145. },
  146. shconfirm(index) {
  147. this.confirmCustomer();
  148. this.$refs.shpopup.close()
  149. },
  150. addCustomer() {
  151. this.$common.to("/pages/enterprise-reg/enterprise-reg");
  152. },
  153. //------------------------------------------
  154. //上拉加载更多,分页模拟数据
  155. onReachBottom() {
  156. this.status = 'loading';
  157. if(this.dataCount > this.pageSize * this.pageNo){
  158. this.pageSize = parseInt(this.pageSize) + 3;
  159. this.getCustomerList();
  160. }else{
  161. this.status = 'nomore';
  162. }
  163. }
  164. },
  165. onShow() {
  166. this.getCustomerList();
  167. },
  168. }
  169. </script>
  170. <style lang="scss">
  171. .card-box{
  172. display: flex;
  173. width: 100%;
  174. flex-direction: column;
  175. .card{
  176. background-color: #fff;
  177. border-radius: 20rpx;
  178. margin: 20rpx 20rpx 0 20rpx;
  179. padding: 30rpx;
  180. box-sizing: border-box;
  181. display: flex;
  182. flex-direction: column;
  183. .t{
  184. width: 100%;
  185. display: flex;
  186. align-items: center;
  187. padding-bottom: 30rpx;
  188. border-bottom: 1rpx solid #f5f5f5;
  189. .icon{
  190. width: 40rpx;
  191. height: 40rpx;
  192. }
  193. .title{
  194. font-size: 30rpx;
  195. font-weight: bold;
  196. margin-left: 20rpx;
  197. }
  198. }
  199. .c{
  200. padding:15rpx 0 30rpx 0;
  201. display: flex;
  202. flex-wrap: wrap;
  203. border-bottom: 1rpx solid #f5f5f5;
  204. .item{
  205. width: 50%;
  206. padding: 20rpx 0;
  207. display: flex;
  208. .car-num{
  209. background-color: #edf6ff;
  210. color: #0080ff;
  211. font-size: 44rpx;
  212. padding: 15rpx 0;
  213. text-align: center;
  214. width: 100%;
  215. border-radius: 10rpx;
  216. font-weight: bold;
  217. letter-spacing: 20rpx;
  218. }
  219. .p1{
  220. font-size: 28rpx;
  221. color: #999;
  222. flex: 5;
  223. }
  224. .p2{
  225. font-size: 28rpx;
  226. color: #191919;
  227. font-weight: bold;
  228. margin-left: 20rpx;
  229. flex: 7;
  230. .licence{
  231. width: 80%;
  232. height: 100rpx;
  233. }
  234. }
  235. }
  236. .car-num-item{
  237. width: 100%;
  238. display: flex;
  239. align-items: center;
  240. justify-content: center;
  241. }
  242. }
  243. .b{
  244. display: flex;
  245. width: 100%;
  246. align-items: center;
  247. justify-content: space-between;
  248. .btn{
  249. height: 70rpx;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. //width: calc(50% - 15rpx);
  254. width: 100%;
  255. margin: 30rpx 0 0 0;
  256. border-radius: 10rpx;
  257. border-width: 1rpx;
  258. box-sizing: border-box;
  259. }
  260. .b1{
  261. background-color: #0080ff;
  262. color: #fff;
  263. }
  264. .b2{
  265. background-color: #f7f7f7;
  266. color: #191919;
  267. }
  268. .b3{
  269. background-color: #fff;
  270. color: #0080ff;
  271. border: 1rpx solid #0080ff;
  272. }
  273. }
  274. }
  275. }
  276. .t-btn{
  277. width: 400rpx;
  278. margin: 50rpx auto;
  279. height: 88rpx;
  280. font-weight: bold;
  281. display: flex;
  282. align-items: center;
  283. justify-content: center;
  284. border-radius: 10rpx;
  285. color: #191919;
  286. font-size: 28rpx;
  287. background-color: #fff;
  288. border: 1px solid #eee;
  289. }
  290. .popup-box {
  291. text-align: center;
  292. background-color: #fff;
  293. height: 280rpx;
  294. width: 560rpx;
  295. border-radius: 10rpx;
  296. }
  297. @import '@/common/common.scss'
  298. </style>