customer-management.vue 6.7 KB

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