customer-management.vue 6.5 KB

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