index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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 class="flex-box">
  52. <view class="buttom-box" @click.stop="passThrough(item,'通过')">通过</view>
  53. <view class="buttom-box" @click.stop="passThrough(item,'驳回')">驳回</view>
  54. </view>
  55. </view>
  56. </view>
  57. <u-empty v-if="total == 0" style="position: absolute;top: 45%;left: 50%;transform:translate(-50%,-50%)"
  58. mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
  59. <uni-calendar ref="calendar" :insert="false" :range="true" @confirm="confirmCalendar" />
  60. <u-picker :show="show" :columns="columns" keyName="cname" @cancel="show = false" @confirm="confirm"></u-picker>
  61. <u-loadmore v-if="total !== 0 && dataList.length != 0" :status="status" />
  62. </view>
  63. </template>
  64. <script>
  65. import {
  66. queryList,
  67. corpsDescList,
  68. customerTypeAllList,
  69. corpsDescSubmit
  70. } from '@/api/views/customer/index.js'
  71. export default {
  72. data() {
  73. return {
  74. dataList: [],
  75. columns: [],
  76. sortOpen: false,
  77. show: false,
  78. mask: false,
  79. current: 0,
  80. total: 0,
  81. status: 'loadmore',
  82. name: '',
  83. form: {
  84. current: 1,
  85. size: 10,
  86. checkStatus:'提交'
  87. },
  88. tabsList: [{
  89. name: '全部',
  90. badge: {
  91. value: 0,
  92. }
  93. }]
  94. }
  95. },
  96. created() {
  97. customerTypeAllList({
  98. corpType: 'KH'
  99. }).then(res => {
  100. for (let item of res.data) {
  101. this.tabsList.push({
  102. name: item.title,
  103. id: item.id
  104. })
  105. }
  106. })
  107. },
  108. onLoad() {
  109. this.dataList = []
  110. this.queryListfun()
  111. },
  112. onReachBottom() {
  113. this.status = 'loading'
  114. if (this.dataList.length < this.total) {
  115. this.form.current++
  116. this.queryListfun()
  117. } else {
  118. this.status = 'nomore'
  119. }
  120. },
  121. methods: {
  122. // 通过和驳回
  123. passThrough(row,type){
  124. uni.showModal({
  125. title: '提示',
  126. content: `是否${type}保存`,
  127. success:(rest)=>{
  128. if (rest.confirm == true) {
  129. corpsDescSubmit({
  130. ...row,
  131. billType: 1,
  132. code: row.cname,
  133. corpType: "KH",
  134. checkStatus:type
  135. }).then(res=>{
  136. uni.showToast({
  137. icon: "none",
  138. title: `${type}成功`,
  139. mask: true
  140. });
  141. this.dataList = []
  142. this.form.current = 1
  143. this.queryListfun()
  144. })
  145. }
  146. }
  147. })
  148. },
  149. dropdownOpen(){
  150. this.sortOpen = false
  151. this.mask = false
  152. },
  153. sortQuery(val,sort = 0){
  154. this.form.current = 1
  155. this.form.sort = sort
  156. this.form.typeSort = val
  157. this.dataList = []
  158. this.sortOpen = false
  159. this.mask = false
  160. this.current = 0
  161. this.query()
  162. },
  163. custom() {
  164. this.form.current = 1
  165. this.form.cname = this.form.cname
  166. // this.form = {
  167. // current: 1,
  168. // size: 10,
  169. // cname: this.form.cname
  170. // }
  171. this.dataList = []
  172. this.query()
  173. },
  174. makePhoneCall(tel) {
  175. uni.makePhoneCall({
  176. phoneNumber: tel,
  177. success: function() {
  178. console.log('拨打电话成功');
  179. },
  180. fail() {
  181. uni.showToast({
  182. title: '拨打电话失败',
  183. icon: 'none',
  184. mask: true
  185. });
  186. }
  187. })
  188. },
  189. choice(item1, index1) {
  190. uni.$u.route('/pages/views/customer/customerDetails', {
  191. id: item1.id
  192. });
  193. },
  194. jumpCommodities() {
  195. uni.$u.route('/pages/views/customer/customerDetails');
  196. },
  197. //查询
  198. queryListfun() {
  199. uni.showLoading({
  200. title: '加载中',
  201. mask: true
  202. });
  203. queryList({
  204. ...this.form,
  205. corpType: 'KH'
  206. }).then(res => {
  207. if (res.data.records) {
  208. this.dataList = this.dataList.concat(res.data.records)
  209. }
  210. this.total = res.data.total || 0
  211. uni.hideLoading();
  212. if (this.total < 10) {
  213. this.status = 'nomore'
  214. }
  215. })
  216. },
  217. tabsClick(item) {
  218. this.current = item.index
  219. this.form.current = 1
  220. this.form.corpsTypeId = item.id
  221. // this.form = {
  222. // current: 1,
  223. // size: 10,
  224. // corpsTypeId: item.id
  225. // }
  226. this.dataList = []
  227. this.queryListfun()
  228. },
  229. confirm(e) {
  230. this.form.current = 1
  231. this.form.corpId = e.value[0].id
  232. // this.form = {
  233. // current: 1,
  234. // size: 10,
  235. // corpId: e.value[0].id
  236. // }
  237. this.dataList = []
  238. this.queryListfun()
  239. this.show = false
  240. },
  241. //确认日期
  242. confirmCalendar(e) {
  243. this.form.current = 1
  244. this.form.businesStartDate = e.range.before + ' 00:00:00'
  245. this.form.businesEndDate = e.range.after + ' 23:59:59'
  246. // this.form = {
  247. // current: 1,
  248. // size: 10,
  249. // businesStartDate: e.range.before + ' 00:00:00',
  250. // businesEndDate: e.range.after + ' 23:59:59'
  251. // }
  252. this.dataList = []
  253. this.queryListfun()
  254. },
  255. }
  256. }
  257. </script>
  258. <style scoped>
  259. .contentBox {
  260. width: 96%;
  261. margin: 20rpx auto;
  262. background-color: #FFFFFF;
  263. border-radius: 20rpx;
  264. /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
  265. padding-top: 15rpx;
  266. padding-bottom: 10rpx;
  267. }
  268. .textBox {
  269. padding: 0 15px;
  270. display: flex;
  271. justify-content: space-between;
  272. font-size: 24rpx;
  273. margin-bottom: 10rpx;
  274. }
  275. .dropdown {
  276. position: absolute;
  277. z-index: 99;
  278. background: rgba(0, 0, 0, .3);
  279. width: 100%;
  280. left: 0;
  281. top: calc(var(--status-bar-height) + 90px);
  282. bottom: 0;
  283. }
  284. .tl-show {
  285. overflow: hidden;
  286. position: fixed;
  287. height: 100%;
  288. width: 100%;
  289. }
  290. .flex-box {
  291. display: flex;
  292. align-items: center;
  293. justify-content: flex-end;
  294. }
  295. .buttom-box {
  296. padding: 15rpx 35rpx;
  297. background: #dd451b;
  298. font-size: 26rpx;
  299. color: #fff;
  300. border-radius: 10rpx;
  301. margin-right: 20rpx;
  302. }
  303. </style>