chooseCustomerBill.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="content flex flex_column">
  3. <view id="tab">
  4. <view class="header u-flex">
  5. <view class="tab">
  6. <u-tabs :show-bar="false" :active-item-style="activeItemStyle" :list="tabsList" :is-scroll="false" :current="params.allCustomerFlag" @change="changeTabs"></u-tabs>
  7. </view>
  8. <view class="payType u-flex" @click="gatherShow = true">
  9. <view class="u-line-1" v-if="!payTypeWord" :style="{ color: wordColor }">收款方式</view>
  10. <view class="u-line-1" v-else :style="{ color: $config('primaryColor') }">{{payTypeWord}}</view>
  11. <u-icon name="shaixuan" custom-prefix="iscm-icon" size="30" :color="wordColor"></u-icon>
  12. </view>
  13. </view>
  14. <view class="scroll-con u-flex u-row-between" v-show="params.allCustomerFlag == 0">
  15. <scroll-view scroll-x class="scroll-date">
  16. <view class="u-flex" v-show="!showType">
  17. <view v-for="(item, i) in dayGatherArr" :key="i">
  18. <view class="scroll-box" :class="chooseNum == i ? 'activeBox' : ''" v-if="i < 2" @click="handleDate(i)">
  19. <view>{{item}}</view>
  20. <view>{{i==0?'今日':'昨日'}}</view>
  21. </view>
  22. <view class="scroll-box" v-else :class="chooseNum == i ? 'activeBox' : ''" @click="handleDate(i)">{{item.split('.')[1]}}</view>
  23. </view>
  24. </view>
  25. <view class="u-flex" v-show="showType">
  26. <view v-for="(con, j) in monthGatherArr" :key="j">
  27. <view class="scroll-box" :class="chooseNum == j ? 'activeBox' : ''" v-if="j < 2" @click="handleDate(j)">
  28. <view>{{con}}</view>
  29. <view>{{j==0?'本月':'上月'}}</view>
  30. </view>
  31. <view class="scroll-box" v-else :class="chooseNum == j ? 'activeBox' : ''" @click="handleDate(j)">{{con}}</view>
  32. </view>
  33. </view>
  34. </scroll-view>
  35. <u-image :src="`../../static/${theme}/navIcon/dayImg.png`" width="42" height="42" v-show="!showType" @click="chooseType"></u-image>
  36. <u-image :src="`../../static/${theme}/navIcon/monthImg.png`" width="42" height="42" v-show="showType" @click="chooseType"></u-image>
  37. </view>
  38. <view class="customer-search" v-show="params.allCustomerFlag == 1">
  39. <u-search
  40. v-model="keyword"
  41. @input="$u.debounce(getSearchCon, 800)"
  42. @search="getSearchCon"
  43. @custom="getSearchCon"
  44. @clear="clearSearch"
  45. :show-action="false"
  46. placeholder="请输入客户名称/拼音首字母查询"
  47. ></u-search>
  48. </view>
  49. </view>
  50. <view class="customer-con">
  51. <customerList ref="customer" :height="listHeight" :params="params" ></customerList>
  52. </view>
  53. <!-- 收款方式弹窗 -->
  54. <search :showModal="gatherShow" @refresh="refreshList" @close="gatherShow=false"/>
  55. </view>
  56. </template>
  57. <script>
  58. import search from './gather.vue'
  59. import customerList from './customerList.vue'
  60. import { queryVerifySalesParams } from '@/api/dealerBizParam.js';
  61. import getDate from '@/libs/getDate.js';
  62. export default {
  63. components:{search,customerList},
  64. data() {
  65. return {
  66. tabsList: [
  67. {
  68. name: '最近开单'
  69. },
  70. {
  71. name: '全部客户'
  72. }
  73. ],
  74. payTypeWord:null,
  75. activeItemStyle: {
  76. color: this.$config('primaryColor'),
  77. borderBottom: '4rpx solid ' + this.$config('primaryColor')
  78. },
  79. wordColor: this.$config('infoColor'),
  80. theme: '',
  81. showType: false,
  82. chooseNum: 0,
  83. keyword:'',
  84. gatherShow:false,
  85. params:{
  86. allCustomerFlag:0 ,//1全部 0需要查询条件
  87. customer:{
  88. queryWord:undefined,
  89. settleStyleSn:undefined
  90. },
  91. bizBeginDate:undefined,
  92. bizEndDate:undefined
  93. },
  94. pageNo:1,
  95. pageSize:15,
  96. noDataText: '暂无数据',
  97. listHeight:200,
  98. dayGatherArr:[],
  99. monthGatherArr:[]
  100. };
  101. },
  102. onReady() {
  103. uni.setNavigationBarColor({
  104. frontColor: '#ffffff',
  105. backgroundColor: this.$config('primaryColor')
  106. });
  107. const query = uni.createSelectorQuery().in(this);
  108. query.select('#tab').boundingClientRect(data => {
  109. this.listHeight = Math.floor(data.height)
  110. }).exec();
  111. },
  112. onNavigationBarButtonTap() {
  113. uni.navigateTo({
  114. url: '/pages/sales/billHistory'
  115. });
  116. },
  117. onLoad() {
  118. this.theme = getApp().globalData.theme;
  119. this.getSetInfo();
  120. //获取日期集合
  121. this.dayGatherArr = getDate.getWeekGather();
  122. this.monthGatherArr = getDate.getMonthGather();
  123. },
  124. onBackPress() {
  125. if(this.gatherShow){
  126. this.gatherShow = false
  127. }else{
  128. uni.removeStorageSync('curTab')
  129. }
  130. },
  131. onUnload() {
  132. uni.removeStorageSync('curTab')
  133. },
  134. methods: {
  135. //获取系统参数
  136. getSetInfo(){
  137. // month day all
  138. queryVerifySalesParams({}).then(res => {
  139. let result = res.data;
  140. let obj=result.find(item=>{return item.remarks == 'verify_default_customer'})
  141. if(obj.paramValue == 'all'){
  142. this.params.allCustomerFlag = 1;
  143. this.refreshList();
  144. }else if(obj.paramValue == 'month'){
  145. this.showType = true
  146. }else{
  147. this.showType = false
  148. }
  149. if(this.params.allCustomerFlag != 1){
  150. this.momentTime(0)
  151. }
  152. //获取系统对账周期设置
  153. this.$store.state.vuex_systemSetList = result
  154. });
  155. },
  156. changeTabs(index) {
  157. this.params.allCustomerFlag = index;
  158. if(index==1){
  159. this.clearTime();
  160. this.$refs.customer.getList(1);
  161. }else{
  162. this.momentTime(0)
  163. this.keyword = ''
  164. this.params.customer.queryWord = ''
  165. }
  166. },
  167. handleDate(i) {
  168. this.chooseNum = i;
  169. this.momentTime(i)
  170. },
  171. chooseType() {
  172. this.chooseNum = 0;
  173. this.showType = !this.showType;
  174. this.momentTime(0)
  175. },
  176. momentTime(pos){
  177. var obj=null;
  178. if(!this.showType){//日
  179. obj =getDate.getFullToday(this.dayGatherArr[pos])
  180. }else{
  181. obj=getDate.getFullMonth(this.monthGatherArr[pos])
  182. }
  183. this.params.bizBeginDate = obj.starttime;
  184. this.params.bizEndDate = obj.endtime;
  185. this.refreshList();
  186. },
  187. getSearchCon(){
  188. this.params.customer.queryWord = this.keyword.trim();
  189. this.refreshList();
  190. },
  191. clearSearch(){
  192. this.keyword = ''
  193. this.params.customer.queryWord = undefined
  194. this.refreshList();
  195. },
  196. refreshList(e){
  197. const _this= this
  198. if(e){
  199. _this.params.customer.settleStyleSn = e.code;
  200. _this.payTypeWord = e.dispName
  201. }
  202. if(e == 'reSet'){
  203. _this.params.customer.settleStyleSn= undefined;
  204. _this.payTypeWord = null
  205. }
  206. this.$nextTick(()=>{
  207. _this.$refs.customer.getList(1);
  208. })
  209. },
  210. clearTime(){
  211. this.params.bizBeginDate = undefined;
  212. this.params.bizEndDate = undefined;
  213. }
  214. }
  215. };
  216. </script>
  217. <style lang="scss" scoped>
  218. .content {
  219. width: 100%;
  220. height: 100vh;
  221. .header {
  222. position: relative;
  223. background: #fff;
  224. .tab {
  225. width: 50%;
  226. margin: 0 auto;
  227. }
  228. .payType {
  229. position: absolute;
  230. right: 18rpx;
  231. max-width: 160rpx;
  232. view {
  233. font-size: 26rpx;
  234. }
  235. }
  236. }
  237. .scroll-con {
  238. width: 100%;
  239. background: #fff;
  240. margin: 6rpx 0;
  241. padding: 10rpx 20rpx;
  242. .scroll-date {
  243. width: calc(100% - 62rpx);
  244. .scroll-box {
  245. margin-right: 28rpx;
  246. padding: 10rpx 20rpx;
  247. text-align: center;
  248. font-size: 26rpx;
  249. view {
  250. &:last-child {
  251. font-size: 24rpx;
  252. color: #666;
  253. }
  254. }
  255. }
  256. .activeBox {
  257. font-weight: bold;
  258. color: $uni-color-primary;
  259. view {
  260. &:last-child {
  261. font-size: 24rpx;
  262. color: $uni-color-primary;
  263. }
  264. }
  265. }
  266. }
  267. }
  268. .customer-con {
  269. flex-grow: 1;
  270. overflow: auto;
  271. background: #fff;
  272. }
  273. //选择客户
  274. .customer-search {
  275. padding: 10rpx 20rpx;
  276. background: #fff;
  277. margin: 6rpx 0;
  278. }
  279. }
  280. </style>