index.vue 7.4 KB

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