consultation.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="consultation">
  3. <z-date-slide :dataList="headerList" @getDateInfo="getDateInfo" @getDateRange="getDateRange"></z-date-slide>
  4. <scroll-view class="consultation_scroll" scroll-y @scrolltolower="scrolltolower"
  5. :show-scrollbar="false" @scroll="scroll">
  6. <view class="mt-50 mb-20">
  7. <z-card class="mt-10 card_item flex-n fac" v-for="(item,index) in dataList" :key="index" @click.native="gotoDetail(item.id)">
  8. <view class="card_item_level">
  9. <view class="flex-1" :class="item.wantLevel=='01'?'card_item_level_item':''"></view>
  10. <view class="flex-1" :class="(item.wantLevel=='01'||item.wantLevel=='02')?'card_item_level_item':''"></view>
  11. <view class="flex-1" :class="(item.wantLevel=='01'||item.wantLevel=='02'||item.wantLevel=='03')?'card_item_level_item':''"></view>
  12. </view>
  13. <view class="ml-50 flex-1 line-1">
  14. <view class="card_item_text1">{{item.customName}} {{item.wantDate}}</view>
  15. <view class="card_item_text2 line-1">
  16. {{item.wantHouseContent}}
  17. <!-- <text v-for="(itm,idx) in item.wantHouse" :key="idx">
  18. {{itm.houseName}}<template v-if="idx!=item.wantHouse.length-1">、</template>
  19. </text> -->
  20. </view>
  21. </view>
  22. <view class="card_item_state flex-n fac ml-20">
  23. <template v-if="item.follow_state=='01'">
  24. <view class="card_item_state_img iconfont iconjuxing18kaobei"></view>
  25. <view class="card_item_state_text">待跟进</view>
  26. </template>
  27. <template v-if="item.follow_state=='02'">
  28. <view class="card_item_state_img iconfont iconjuxing18"></view>
  29. <view class="card_item_state_text">跟进中</view>
  30. </template>
  31. <template v-if="item.follow_state=='04'">
  32. <view class="card_item_state_img iconfont iconjuxing21kaobei2"></view>
  33. <view class="card_item_state_text">已取消</view>
  34. </template>
  35. </view>
  36. <view class="card_item_tel ml-30 mr-20 iconfont icondianhua-copy" v-if="item.phone" @click.stop="showMakePhone=true;callPhone=item.phone"></view>
  37. <view class="card_item_tel ml-30 mr-20 iconfont icondianhua-copy" style="color: #eee;" v-else></view>
  38. </z-card>
  39. <z-nodata state="nodata" v-if="dataList.length==0"></z-nodata>
  40. <z-loading :showLoading="showLoading" v-else></z-loading>
  41. </view>
  42. </scroll-view>
  43. <z-select-popup :visible.sync="showMakePhone">
  44. <view @click="gotoMakePhone">{{callPhone||'无联系电话'}}</view>
  45. </z-select-popup>
  46. <u-toast ref="uToast"></u-toast>
  47. </view>
  48. </template>
  49. <script>
  50. const app = getApp({
  51. allowDefault: true
  52. });
  53. export default {
  54. props: {
  55. refresh: Boolean
  56. },
  57. data() {
  58. return {
  59. dataList: [],
  60. headerList: [],
  61. showMakePhone: false,
  62. callPhone: '',
  63. daterange: [],
  64. date: '',
  65. total: 0,
  66. pageNum: 1,
  67. scrollTop: 0,
  68. showLoading: false,
  69. }
  70. },
  71. watch: {
  72. '$store.state.tabbarIndex'(newval,oldval){
  73. // console.log('tabbar',newval,this.dataList)
  74. // this.dataList=[];
  75. // console.log('tabbar',newval,this.dataList)
  76. // this.askList(this.date);
  77. // this.askHeader(this.daterange[0].date, this.daterange[6].date)
  78. },
  79. refresh(newval, oldval) {
  80. // console.log('刷新',newval)
  81. if (newval) {
  82. // setTimeout(()=>{
  83. this.dataList=[];
  84. this.askList(this.date);
  85. this.askHeader(this.daterange[0].date, this.daterange[6].date)
  86. // },100)
  87. }
  88. }
  89. },
  90. mounted() {
  91. },
  92. methods: {
  93. //获取咨询表头
  94. askHeader(startTime, endTime) {
  95. var houseTypeIds = uni.getStorageSync('searchField') || [];
  96. this.$axios.post('app/preUserAsk/askAlertList', {
  97. "storeId": uni.getStorageSync('storeId'),
  98. "startTime": startTime,
  99. "endTime": endTime,
  100. "houseTypeIds": houseTypeIds,
  101. }).then(res => {
  102. console.log('咨询表头', res)
  103. var data = res.data.list;
  104. var headerList = [];
  105. for (var i in data) {
  106. headerList.push({
  107. record: data[i].record,
  108. isImportant: data[i].importantDates.length > 0 ? true : false
  109. });
  110. }
  111. this.headerList = headerList;
  112. }).catch(err => {
  113. this.$refs.uToast.error(err.msg)
  114. })
  115. },
  116. //获取咨询列表
  117. askList(date) {
  118. var houseTypeIds = uni.getStorageSync('searchField') || [];
  119. this.$axios.post('app/preUserAsk/askAlertByDate', {
  120. "storeId": uni.getStorageSync('storeId'),
  121. "askDate": date,
  122. "pageNum": this.pageNum,
  123. "houseTypeIds": houseTypeIds,
  124. "pageSize": 10
  125. }).then(res => {
  126. console.log('咨询列表', res)
  127. this.dataList = this.dataList.concat(res.data.list);
  128. for(var i in this.dataList){
  129. var content='';
  130. for(var j in this.dataList[i].wantHouse){
  131. if(this.dataList[i].wantHouse[j]){
  132. content +=this.dataList[i].wantHouse[j].houseName+'、'
  133. }
  134. }
  135. if(content.length>0){
  136. this.$set(this.dataList[i],'wantHouseContent',content.substring(0,content.length-1))
  137. }
  138. }
  139. this.total = res.data.total;
  140. this.showLoading = false;
  141. }).catch(err => {
  142. this.$refs.uToast.error(err.msg)
  143. this.showLoading = false;
  144. })
  145. },
  146. //拨打电话
  147. gotoMakePhone() {
  148. var that = this;
  149. uni.makePhoneCall({
  150. phoneNumber: this.callPhone,
  151. complete: function() {
  152. that.showMakePhone = false;
  153. }
  154. });
  155. },
  156. getDateInfo(date) {
  157. this.dataList=[];
  158. console.log(date.date)
  159. this.$emit('getDateInfo', date)
  160. this.askList(date.date)
  161. this.date = date.date;
  162. },
  163. getDateRange(daterange) {
  164. // console.log('日期区间',datarange)
  165. this.askHeader(daterange[0].date, daterange[6].date);
  166. this.daterange = daterange;
  167. },
  168. gotoDetail(id) {
  169. uni.navigateTo({
  170. url: '../detail/index?id=' + id
  171. })
  172. },
  173. scroll(e) {
  174. this.scrollTop = e.detail.scrollTop
  175. },
  176. scrolltolower() {
  177. var totalPage = Math.ceil(Number(this.total) / 10)
  178. if (this.pageNum < totalPage) {
  179. this.pageNum++;
  180. this.showLoading = true;
  181. this.askList(this.date);
  182. }
  183. },
  184. scrolltoupper() {
  185. // this.pageNum = 1;
  186. // this.dataList = [];
  187. // this.showLoading = true;
  188. // this.askList(this.date);
  189. }
  190. }
  191. }
  192. </script>
  193. <style lang="scss" scoped>
  194. .nodata {
  195. width: 457rpx;
  196. margin-left: 147rpx;
  197. margin-top: 40rpx;
  198. }
  199. .consultation {
  200. .consultation_scroll {
  201. // height: calc(100vh - 230rpx - 98rpx - var(--status-bar-height) - 84rpx - 98rpx);
  202. }
  203. .card_item {
  204. height: 86rpx;
  205. position: relative;
  206. .card_item_level {
  207. position: absolute;
  208. left: 0;
  209. display: flex;
  210. flex-direction: column;
  211. width: 9rpx;
  212. height: 86rpx;
  213. background: rgba(36, 129, 238, 0.15);
  214. border: 1px solid #2481EE;
  215. .card_item_level_item {
  216. background: #2481EE;
  217. width: 9rpx;
  218. }
  219. }
  220. .card_item_text1 {
  221. color: #999999;
  222. font-size: 24rpx;
  223. }
  224. .card_item_text2 {
  225. color: #333333;
  226. font-size: 24rpx;
  227. }
  228. .card_item_state {
  229. .card_item_state_img {
  230. width: 25rpx;
  231. height: 25rpx;
  232. font-size: 25rpx;
  233. color: #007AFF;
  234. }
  235. .card_item_state_text {
  236. font-size: 25rpx;
  237. color: #999999;
  238. margin-left: 10rpx;
  239. transform: scale(0.8);
  240. }
  241. }
  242. .card_item_tel {
  243. width: 38rpx;
  244. height: 38rpx;
  245. font-size: 38rpx;
  246. color: #007AFF;
  247. }
  248. }
  249. }
  250. </style>