index.vue 6.6 KB

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