customer-management.vue 6.5 KB

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