customerList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <view class="content">
  3. <view class="filter-box">
  4. <u-search placeholder="请输入关键字" v-model="filterText" @search="setFilterText" @custom="setFilterText"></u-search>
  5. </view>
  6. <u-tabs-swiper ref="uTabs" :active-color="mainColor" :list="tabList" :current="current" @change="tabsChange"
  7. :is-scroll="false"></u-tabs-swiper>
  8. <swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" class="swiper-box">
  9. <swiper-item class="swiper-item" v-for="(item, index1) in tabList" :key="index1">
  10. <scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
  11. :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
  12. @refresherrestore="onRestore">
  13. <u-card :show-head="false" :foot-border-top="false" margin="10px 15px" borderRadius="40" :foot-style="{padding: '0 10px 5px 0'}" v-for="(site, index2) in item.tableList"
  14. :key="index2" class="card-box" @click="goToOrderList(site)">
  15. <view slot="body" class="card-content">
  16. <view class="student-info">
  17. <view class="info-name">{{site.studentName}}</view>
  18. <!-- <view class="info-type" :class="site.status == 1 ? 'info-type-active' : ''">{{site.status == 0 ? '未报名' : '已报名'}}</view> -->
  19. <view class="info-name" style="width:100px;">{{site.parentName}}</view>
  20. <view class="info-phone">{{site.parentPhone}}</view>
  21. </view>
  22. <!-- <u-image width="28px" height="28px" :src="site.type == 2 ? iconPath1 : iconPath2"></u-image> -->
  23. </view>
  24. <view class="venue-content" slot="foot" style="text-align: right;">
  25. <u-button style="margin-right:10px" type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="checkContract(site.id)">查看合同</u-button>
  26. <u-button v-if="current != 2" type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="handleInvalidClick(site.id,0)">无效</u-button>
  27. <u-button v-else type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="handleInvalidClick(site.id,1)">有效</u-button>
  28. </view>
  29. <!--<view class="venue-content" slot="foot" style="text-align: right;" v-else>
  30. <u-button type="warning" :ripple="true" shape="circle" :custom-style="handleCustomStyle" size="mini" @click="handleInvalidClick(site.id)">查看合同</u-button>
  31. </view>-->
  32. </u-card>
  33. <u-divider v-if="item.isOver" bg-color="transparent" :style="{paddingTop : item.tableList.length == 0 ? '10px' : ''}">没有更多了</u-divider>
  34. </scroll-view>
  35. </swiper-item>
  36. </swiper>
  37. <!-- 新增客户 -->
  38. <u-icon v-if="userId!=274" name="plus-circle-fill" :color="mainColor" size="96" class="fix-add-icon" @click="handleAddApplyClick"></u-icon>
  39. <!-- 无效备注 -->
  40. <u-popup v-model="invalidShow" mode="center" border-radius="30" width="600rpx">
  41. <view class="common-title">备注</view>
  42. <view class="menber-box">
  43. <u-form :model="invalidForm" ref="invalidFormRef" label-width="140">
  44. <u-form-item label="备注" prop="content" required>
  45. <u-input v-model="invalidForm.content" type="text" />
  46. </u-form-item>
  47. </u-form>
  48. <view style="height:20px;"></view>
  49. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="handleConfirmClick">确定</u-button>
  50. </view>
  51. </u-popup>
  52. <u-popup v-model="contractShow" mode="center" border-radius="30" width="600rpx" height="500px">
  53. <view class="common-title">合同列表</view>
  54. <view class="menber-box" style="overflow-y: auto;height:390px;">
  55. <template v-for="(item, index) in contractUrls">
  56. <div v-if="item.payTime!=null">
  57. <view class="orderNumber">
  58. {{item.orderNumber}}
  59. </view>
  60. <view class="card-item" :key="index0" @click="handleContractShowClick(item0)" v-for="(item0, index0) in item.url">
  61. {{ item0.name }}
  62. </view>
  63. </div>
  64. </template>
  65. </view>
  66. <view class="button-box">
  67. <u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="contractShow = false">确定</u-button>
  68. </view>
  69. </u-popup>
  70. <u-top-tips ref="uTips"></u-top-tips>
  71. </view>
  72. </template>
  73. <script>
  74. import {
  75. mapGetters
  76. } from 'vuex'
  77. const NET = require('@/utils/request')
  78. const API = require('@/config/api')
  79. export default {
  80. computed: {
  81. ...mapGetters([
  82. 'mainColor',
  83. 'customStyle',
  84. 'handleCustomStyle',
  85. 'handleDefaultCustomStyle',
  86. ])
  87. },
  88. data() {
  89. return {
  90. userId:'',
  91. contractShow:false,
  92. contractUrls:[
  93. ],
  94. filterText: '',
  95. triggered: false,
  96. tabList: [
  97. {
  98. name: '已报名',
  99. isOver: false,
  100. pageIndex: 1,
  101. filterText: '',
  102. type: 1,
  103. tableList: [],
  104. }, {
  105. name: '已续费',
  106. isOver: false,
  107. pageIndex: 1,
  108. filterText: '',
  109. type: 2,
  110. tableList: [],
  111. }, {
  112. name: '无效',
  113. isOver: false,
  114. pageIndex: 1,
  115. filterText: '',
  116. type: 0,
  117. tableList: [],
  118. }],
  119. current: 0,
  120. swiperCurrent: 0,
  121. iconPath1: API.getServerImg + 'weibaoming.png',
  122. iconPath2: API.getServerImg + 'xianshangkehu.png',
  123. // 无效备注
  124. invalidShow: false,
  125. // 备注
  126. invalidForm: {
  127. customerId: null,
  128. content: '',
  129. joinState: 0
  130. },
  131. // 备注校验规则
  132. invalidRules: {
  133. content: [
  134. {
  135. required: true,
  136. message: '请输入备注',
  137. trigger: 'change'
  138. }],
  139. }
  140. }
  141. },
  142. onShow() {
  143. this.userId=uni.getStorageSync('userData').userId
  144. this.tabList = Object.assign([], this.$options.data().tabList)
  145. this.getTableList(0)
  146. this.getTableList(1)
  147. this.getTableList(2)
  148. },
  149. onReady() {},
  150. methods: {
  151. // 跳转添加信息
  152. handleAddApplyClick() {
  153. uni.navigateTo({
  154. url: '/pagesEnroll/enrolledForm'
  155. });
  156. },
  157. // 备注弹窗显示
  158. handleInvalidClick(id,type) {
  159. this.invalidForm.joinState=type
  160. this.invalidForm.customerId = id
  161. this.$refs.invalidFormRef.setRules(this.invalidRules)
  162. this.invalidShow = true
  163. },
  164. // 无效备注确认
  165. handleConfirmClick(){
  166. this.$refs.invalidFormRef.validate(valid => {
  167. if (valid) {
  168. NET.request(API.updateCustomerState, {...this.invalidForm}, 'POST').then(res => {
  169. if(res.status == 10000) {
  170. this.invalidShow = false
  171. this.tabList = this.$options.data().tabList
  172. this.getTableList(0)
  173. this.getTableList(1)
  174. this.getTableList(2)
  175. } else {
  176. this.invalidShow = false
  177. this.$refs.uTips.show({
  178. title: error.msg,
  179. type: 'warning',
  180. })
  181. }
  182. })
  183. }
  184. })
  185. },
  186. // 设置过滤字段
  187. setFilterText(value) {
  188. this.tabList[this.current].filterText = value
  189. this.onRefresh()
  190. },
  191. // tab页面切换
  192. tabsChange(index) {
  193. this.swiperCurrent = index;
  194. },
  195. // swiper-item左右移动,通知tabs的滑块跟随移动
  196. transition(e) {
  197. let dx = e.detail.dx;
  198. this.$refs.uTabs.setDx(dx);
  199. },
  200. // swiper滑动结束,分别设置tabs和swiper的状态
  201. animationfinish(e) {
  202. let current = e.detail.current;
  203. this.$refs.uTabs.setFinishCurrent(current);
  204. this.swiperCurrent = current;
  205. this.current = current;
  206. },
  207. // 下拉刷新
  208. onRefresh() {
  209. if (!this.triggered) {
  210. this.triggered = true
  211. this.tabList[this.current].isOver = false
  212. this.tabList[this.current].pageIndex = 1
  213. this.tabList[this.current].tableList = []
  214. this.getTableList(this.current, 'refresh')
  215. }
  216. },
  217. // 重置下拉刷新状态
  218. onRestore() {
  219. this.triggered = 'restore'
  220. this.triggered = false
  221. },
  222. // 懒加载
  223. handleLoadMore() {
  224. if (!this.tabList[this.current].isOver) {
  225. this.tabList[this.current].pageIndex++
  226. this.getTableList(this.current)
  227. }
  228. },
  229. // 获取列表数据
  230. getTableList(index) {
  231. NET.request(API.getCustomerList, {
  232. isSignUp: 0,
  233. name: this.tabList[index].filterText,
  234. type: this.tabList[index].type,
  235. page: this.tabList[index].pageIndex,
  236. saleIsMeFlag: true,
  237. size: 10,
  238. }, 'POST').then(res => {
  239. this.triggered = false
  240. this.tabList[index].tableList = this.tabList[index].tableList.concat(res.data.row)
  241. this.tabList[index].isOver = res.data.row.length != 10
  242. }).catch(error => {
  243. this.triggered = false
  244. this.$refs.uTips.show({
  245. title: error.msg,
  246. type: 'warning',
  247. })
  248. })
  249. NET.request(API.getOrderContract, {
  250. customerId: 23185
  251. }, 'GET').then(res => {
  252. }).catch(error => {
  253. this.triggered = false
  254. this.$refs.uTips.show({
  255. title: error.msg,
  256. type: 'warning',
  257. })
  258. })
  259. },
  260. // 跳转到报名详情
  261. goToOrderList(item) {
  262. uni.navigateTo({
  263. url: `/pagesMain/customerInfo?id=${item.id}&title=客户信息`
  264. })
  265. },
  266. checkContract(id) {
  267. this.contractShow = true
  268. this.contractUrls = []
  269. NET.request(API.getOrderContract, {
  270. customerId: id
  271. }, 'GET').then(res => {
  272. this.contractUrls = res.data
  273. }).catch(error => {
  274. this.triggered = false
  275. this.$refs.uTips.show({
  276. title: error.msg,
  277. type: 'warning',
  278. })
  279. })
  280. },
  281. // 查看合同
  282. handleContractShowClick(item) {
  283. console.log(item);
  284. uni.downloadFile({
  285. url: item.url,
  286. success: (res) => {
  287. console.log(res);
  288. uni.openDocument({
  289. filePath: res.tempFilePath,
  290. });
  291. }
  292. })
  293. },
  294. },
  295. }
  296. </script>
  297. <style>
  298. page {
  299. width: 100%;
  300. height: 100%;
  301. background-color: #f7f7f7;
  302. }
  303. </style>
  304. <style lang="scss" scoped>
  305. @import "@/static/css/themes.scss";
  306. .content {
  307. width: 100%;
  308. float: left;
  309. .filter-box {
  310. height: 48px;
  311. padding: 10px 15px;
  312. background-color: #FFFFFF;
  313. }
  314. .swiper-box {
  315. height: calc(100vh - 82px);
  316. .swiper-item {
  317. height: calc(100vh - 82px);
  318. .scroll-box {
  319. width: 100%;
  320. height: calc(100vh - 82px);
  321. .card-box {
  322. .card-content {
  323. display: flex;
  324. align-items: center;
  325. .student-info {
  326. flex: 1;
  327. .info-name {
  328. width: 64px;
  329. float: left;
  330. line-height: 28px;
  331. font-size: 14px;
  332. font-weight: bold;
  333. }
  334. .info-type {
  335. padding: 0 10px;
  336. margin-top: 3px;
  337. border-radius: 20px;
  338. float: left;
  339. line-height: 20px;
  340. font-size: 10px;
  341. color: #FFFFFF;
  342. background-color: #999999;
  343. }
  344. .info-type-active {
  345. background-color: $mainColor;
  346. }
  347. .info-phone {
  348. width: calc(100% - 64px);
  349. float: left;
  350. line-height: 28px;
  351. font-size: 12px;
  352. color: #999999;
  353. }
  354. }
  355. }
  356. }
  357. }
  358. }
  359. }
  360. }
  361. .menber-box {
  362. width: 100%;
  363. // float: left;
  364. padding: 10px 15px;
  365. margin-bottom: 10px;
  366. .menber-col {
  367. width: 100%;
  368. padding: 15px;
  369. margin-bottom: 10px;
  370. display: inline-block;
  371. background-color: #FFFFFF;
  372. border-radius: 15px;
  373. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  374. position: relative;
  375. overflow: hidden;
  376. box-sizing: border-box;
  377. .menber-label {
  378. width: 100%;
  379. margin-bottom: 5px;
  380. float: left;
  381. font-size: 14px;
  382. // line-height: 20px;
  383. }
  384. .menber-num {
  385. width: 100%;
  386. float: left;
  387. font-size: 26px;
  388. line-height: 28px;
  389. color: $mainColor;
  390. }
  391. .menber-icon {
  392. font-size: 100px;
  393. color: $mainColor;
  394. position: absolute;
  395. right: -5px;
  396. bottom: -30px;
  397. opacity: 0.5;
  398. }
  399. }
  400. }
  401. .common-title {
  402. width:100%;
  403. text-align: center;
  404. font-size: 20px;
  405. margin: 10px 0;
  406. }
  407. .fix-add-icon {
  408. position: fixed;
  409. bottom: 15px;
  410. right: 15px;
  411. z-index: 10;
  412. }
  413. .menber-box {
  414. width: 100%;
  415. padding: 10px 15px;
  416. .menber-col {
  417. width: 100%;
  418. padding: 15px;
  419. display: inline-block;
  420. background-color: #FFFFFF;
  421. border-radius: 15px;
  422. box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
  423. position: relative;
  424. overflow: hidden;
  425. box-sizing: border-box;
  426. .menber-label {
  427. width: 100%;
  428. font-size: 14px;
  429. // line-height: 20px;
  430. }
  431. .menber-num {
  432. width: 100%;
  433. font-size: 26px;
  434. line-height: 28px;
  435. color: $mainColor;
  436. }
  437. }
  438. }
  439. .common-title {
  440. width:100%;
  441. text-align: center;
  442. font-size: 20px;
  443. padding: 10px 0;
  444. }
  445. .card-item {
  446. width: 100%;
  447. padding:8px;
  448. border-radius: 10px;
  449. background-color: #ff6e3e;
  450. margin-bottom: 8px;
  451. color: #fff;
  452. }
  453. .orderNumber{
  454. margin-bottom: 6px;
  455. }
  456. </style>