chooseCustomerBill.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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" @click="gatherShow = true">
  9. <text v-if="!payTypeWord" :style="{ color: wordColor }">收款方式</text>
  10. <text v-else :style="{ color: $config('primaryColor') }">{{payTypeWord}}</text>
  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. }
  164. },
  165. handleDate(i) {
  166. this.chooseNum = i;
  167. this.momentTime(i)
  168. },
  169. chooseType() {
  170. this.chooseNum = 0;
  171. this.showType = !this.showType;
  172. this.momentTime(0)
  173. },
  174. momentTime(pos){
  175. var obj=null;
  176. if(!this.showType){//日
  177. obj =getDate.getFullToday(this.dayGatherArr[pos])
  178. }else{
  179. obj=getDate.getFullMonth(this.monthGatherArr[pos])
  180. }
  181. this.params.bizBeginDate = obj.starttime;
  182. this.params.bizEndDate = obj.endtime;
  183. this.refreshList();
  184. },
  185. getSearchCon(){
  186. this.params.customer.queryWord = this.keyword.trim();
  187. this.refreshList();
  188. },
  189. clearSearch(){
  190. this.keyword = ''
  191. this.params.customer.queryWord = undefined
  192. this.refreshList();
  193. },
  194. refreshList(e){
  195. const _this= this
  196. if(e){
  197. _this.params.customer.settleStyleSn = e.code;
  198. _this.payTypeWord = e.dispName
  199. }
  200. if(e == 'reSet'){
  201. _this.params.customer.settleStyleSn= undefined;
  202. _this.payTypeWord = null
  203. }
  204. this.$nextTick(()=>{
  205. _this.$refs.customer.getList(1);
  206. })
  207. },
  208. clearTime(){
  209. this.params.bizBeginDate = undefined;
  210. this.params.bizEndDate = undefined;
  211. }
  212. }
  213. };
  214. </script>
  215. <style lang="scss" scoped>
  216. .content {
  217. width: 100%;
  218. height: 100vh;
  219. .header {
  220. position: relative;
  221. background: #fff;
  222. .tab {
  223. width: 60%;
  224. margin: 0 auto;
  225. }
  226. .payType {
  227. position: absolute;
  228. right: 20rpx;
  229. text {
  230. vertical-align: top;
  231. font-size: 26rpx;
  232. }
  233. }
  234. }
  235. .scroll-con {
  236. width: 100%;
  237. background: #fff;
  238. margin: 6rpx 0;
  239. padding: 10rpx 20rpx;
  240. .scroll-date {
  241. width: calc(100% - 62rpx);
  242. .scroll-box {
  243. margin-right: 28rpx;
  244. padding: 10rpx 20rpx;
  245. text-align: center;
  246. font-size: 26rpx;
  247. view {
  248. &:last-child {
  249. font-size: 24rpx;
  250. color: #666;
  251. }
  252. }
  253. }
  254. .activeBox {
  255. font-weight: bold;
  256. color: $uni-color-primary;
  257. view {
  258. &:last-child {
  259. font-size: 24rpx;
  260. color: $uni-color-primary;
  261. }
  262. }
  263. }
  264. }
  265. }
  266. .customer-con {
  267. flex-grow: 1;
  268. overflow: auto;
  269. background: #fff;
  270. }
  271. //选择客户
  272. .customer-search {
  273. padding: 10rpx 20rpx;
  274. background: #fff;
  275. margin: 6rpx 0;
  276. }
  277. }
  278. </style>