index.vue 6.6 KB

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