index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view style="background-color: #f2f2f6;padding-bottom: 0.01rpx;" :class="mask ? 'tl-show': ''">
  3. <u-navbar title="客户" :autoBack="true" :placeholder="true" leftIconColor="#fff"
  4. :titleStyle="{ color: '#ffffff' }" bgColor="#FD4B09">
  5. <template slot="right">
  6. <u-icon name="plus" color="#fff" @click="jumpCommodities"></u-icon>
  7. </template>
  8. </u-navbar>
  9. <view
  10. style="background-color: #fff;position: fixed;top: calc(var(--status-bar-height) + 44px);width: 100%;z-index: 10;">
  11. <u-tabs :list="tabsList" itemStyle="height:88rpx;" lineColor="#FD4B09" @click="tabsClick"
  12. :current="current">
  13. <!-- <view slot="right" style="font-size: 15px;display: flex;">
  14. <text style="margin-left: 10rpx;">|</text>
  15. <u--text text="排序" margin="0rpx 15rpx" @click="sortOpen = !sortOpen,mask=!mask"></u--text>
  16. </view> -->
  17. </u-tabs>
  18. <view style="background-color: #fff;padding: 10rpx 20rpx;">
  19. <u-search placeholder="请输入客户名称" v-model="form.cname" @custom="custom"></u-search>
  20. </view>
  21. </view>
  22. <view class="dropdown" v-if="sortOpen" @click.stop="dropdownOpen()">
  23. <view style="background-color: #fff;">
  24. <u-cell-group>
  25. <u-cell title="客户名称" @click="sortQuery(1)">
  26. <view style="display: flex;" slot="value" @click.stop="sortQuery(1,form.sort == 0?'1':'0')">{{form.typeSort == 1?form.sort==0?'正序':'倒序':''}}<u-icon :name="form.typeSort == 1?form.sort==0?'arrow-up-fill':'arrow-down-fill':''"></u-icon></view>
  27. </u-cell>
  28. <u-cell title="电话" @click="sortQuery(2)">
  29. <view style="display: flex;" slot="value" @click.stop="sortQuery(2,form.sort == 0?'1':'0')">{{form.typeSort == 2?form.sort==0?'正序':'倒序':''}}<u-icon :name="form.typeSort == 2?form.sort==0?'arrow-up-fill':'arrow-down-fill':''"></u-icon></view>
  30. </u-cell>
  31. </u-cell-group>
  32. </view>
  33. </view>
  34. <view class="content" style="margin-top: 100px;">
  35. <view class="contentBox" v-for="(item,index) in dataList" :key="index">
  36. <view style="width: 100%;margin: 0 auto;">
  37. <view class="textBox" @click="choice(item,index)">
  38. <view style="font-size: 36rpx;">{{item.cname}}</view>
  39. <view>编辑信息</view>
  40. </view>
  41. <view class="textBox">
  42. <view>
  43. <text style="color: #FD4B09;"
  44. @click="makePhoneCall(item.tel)">电话:{{item.tel}}</text></view>
  45. <view>发货仓库:{{item.deliveryWarehouseName}}</view>
  46. </view>
  47. <view class="textBox">
  48. <view>商城价格:{{item.priceSystem}}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <u-empty v-if="total == 0" style="position: absolute;top: 45%;left: 50%;transform:translate(-50%,-50%)"
  54. mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
  55. <uni-calendar ref="calendar" :insert="false" :range="true" @confirm="confirmCalendar" />
  56. <u-picker :show="show" :columns="columns" keyName="cname" @cancel="show = false" @confirm="confirm"></u-picker>
  57. <u-loadmore v-if="total !== 0 && dataList.length != 0" :status="status" />
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. queryList,
  63. corpsDescList,
  64. customerTypeAllList
  65. } from '@/api/views/customer/index.js'
  66. export default {
  67. data() {
  68. return {
  69. dataList: [],
  70. columns: [],
  71. sortOpen: false,
  72. show: false,
  73. mask: false,
  74. current: 0,
  75. total: 0,
  76. status: 'loadmore',
  77. name: '',
  78. form: {
  79. current: 1,
  80. size: 10,
  81. },
  82. tabsList: [{
  83. name: '全部',
  84. badge: {
  85. value: 0,
  86. }
  87. }]
  88. }
  89. },
  90. created() {
  91. customerTypeAllList({
  92. corpType: 'KH'
  93. }).then(res => {
  94. for (let item of res.data) {
  95. this.tabsList.push({
  96. name: item.title,
  97. id: item.id
  98. })
  99. }
  100. })
  101. },
  102. onShow() {
  103. this.dataList = []
  104. this.queryListfun()
  105. },
  106. onReachBottom() {
  107. this.status = 'loading'
  108. if (this.dataList.length < this.total) {
  109. this.form.current++
  110. this.queryListfun()
  111. } else {
  112. this.status = 'nomore'
  113. }
  114. },
  115. methods: {
  116. dropdownOpen(){
  117. this.sortOpen = false
  118. this.mask = false
  119. },
  120. sortQuery(val,sort = 0){
  121. this.form = {
  122. current: 1,
  123. size: 10,
  124. sort:sort,
  125. typeSort:val
  126. }
  127. this.dataList = []
  128. this.sortOpen = false
  129. this.mask = false
  130. this.current = 0
  131. this.queryListfun()
  132. },
  133. custom() {
  134. this.form = {
  135. current: 1,
  136. size: 10,
  137. cname: this.form.cname
  138. }
  139. this.dataList = []
  140. this.queryListfun()
  141. },
  142. makePhoneCall(tel) {
  143. uni.makePhoneCall({
  144. phoneNumber: tel,
  145. success: function() {
  146. console.log('拨打电话成功');
  147. },
  148. fail() {
  149. uni.showToast({
  150. title: '拨打电话失败',
  151. icon: 'none',
  152. mask: true
  153. });
  154. }
  155. })
  156. },
  157. choice(item1, index1) {
  158. uni.$u.route('/pages/views/customer/customerDetails', {
  159. id: item1.id
  160. });
  161. },
  162. jumpCommodities() {
  163. uni.$u.route('/pages/views/customer/customerDetails');
  164. },
  165. //查询
  166. queryListfun() {
  167. uni.showLoading({
  168. title: '加载中',
  169. mask: true
  170. });
  171. queryList({
  172. ...this.form,
  173. corpType: 'KH'
  174. }).then(res => {
  175. if (res.data.records) {
  176. this.dataList = this.dataList.concat(res.data.records)
  177. }
  178. this.total = res.data.total || 0
  179. uni.hideLoading();
  180. if (this.total < 10) {
  181. this.status = 'nomore'
  182. }
  183. })
  184. },
  185. tabsClick(item) {
  186. this.current = item.index
  187. this.form = {
  188. current: 1,
  189. size: 10,
  190. corpsTypeId: item.id
  191. }
  192. this.dataList = []
  193. this.queryListfun()
  194. },
  195. confirm(e) {
  196. this.form = {
  197. current: 1,
  198. size: 10,
  199. corpId: e.value[0].id
  200. }
  201. this.dataList = []
  202. this.queryListfun()
  203. this.show = false
  204. },
  205. //确认日期
  206. confirmCalendar(e) {
  207. this.form = {
  208. current: 1,
  209. size: 10,
  210. businesStartDate: e.range.before + ' 00:00:00',
  211. businesEndDate: e.range.after + ' 23:59:59'
  212. }
  213. this.dataList = []
  214. this.queryListfun()
  215. },
  216. }
  217. }
  218. </script>
  219. <style scoped>
  220. .contentBox {
  221. width: 96%;
  222. margin: 20rpx auto;
  223. background-color: #FFFFFF;
  224. border-radius: 20rpx;
  225. /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
  226. padding-top: 15rpx;
  227. padding-bottom: 10rpx;
  228. }
  229. .textBox {
  230. padding: 0 15px;
  231. display: flex;
  232. justify-content: space-between;
  233. font-size: 24rpx;
  234. margin-bottom: 10rpx;
  235. }
  236. .dropdown {
  237. position: absolute;
  238. z-index: 99;
  239. background: rgba(0, 0, 0, .3);
  240. width: 100%;
  241. left: 0;
  242. top: calc(var(--status-bar-height) + 90px);
  243. bottom: 0;
  244. }
  245. .tl-show {
  246. overflow: hidden;
  247. position: fixed;
  248. height: 100%;
  249. width: 100%;
  250. }
  251. </style>