123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <template>
- <view style="background-color: #f2f2f6;padding-bottom: 0.01rpx;" :class="mask ? 'tl-show': ''">
- <u-navbar title="客户" :autoBack="true" :placeholder="true" leftIconColor="#fff"
- :titleStyle="{ color: '#ffffff' }" bgColor="#FD4B09">
- <template slot="right">
- <u-icon name="plus" color="#fff" @click="jumpCommodities"></u-icon>
- </template>
- </u-navbar>
- <view
- style="background-color: #fff;position: fixed;top: calc(var(--status-bar-height) + 44px);width: 100%;z-index: 10;">
- <u-tabs :list="tabsList" itemStyle="height:88rpx;" lineColor="#FD4B09" @click="tabsClick"
- :current="current">
- <!-- <view slot="right" style="font-size: 15px;display: flex;">
- <text style="margin-left: 10rpx;">|</text>
- <u--text text="排序" margin="0rpx 15rpx" @click="sortOpen = !sortOpen,mask=!mask"></u--text>
- </view> -->
- </u-tabs>
- <view style="background-color: #fff;padding: 10rpx 20rpx;">
- <u-search placeholder="请输入客户名称" v-model="form.cname" @custom="custom"></u-search>
- </view>
- </view>
- <view class="dropdown" v-if="sortOpen" @click.stop="dropdownOpen()">
- <view style="background-color: #fff;">
- <u-cell-group>
- <u-cell title="客户名称" @click="sortQuery(1)">
- <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>
- </u-cell>
- <u-cell title="电话" @click="sortQuery(2)">
- <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>
- </u-cell>
- </u-cell-group>
- </view>
- </view>
- <view class="content" style="margin-top: 100px;">
- <view class="contentBox" v-for="(item,index) in dataList" :key="index">
- <view style="width: 100%;margin: 0 auto;">
- <view class="textBox" @click="choice(item,index)">
- <view style="font-size: 36rpx;">{{item.cname}}</view>
- <view>编辑信息</view>
- </view>
- <view class="textBox">
- <view>
- <text style="color: #FD4B09;" @click="makePhoneCall(item.tel)">电话:{{item.tel}}</text>
- </view>
- <view>发货仓库:{{item.deliveryWarehouseName}}</view>
- </view>
- <view class="textBox">
- <view>商城价格:{{item.priceSystem}}</view>
- <div style="color: #fd4b09;" v-show="item.filePath" @click="choice(item,index)">
- 二维码
- </div>
- <div v-show="!item.filePath" @click="choice(item,index)">
- 二维码
- </div>
- </view>
- </view>
- </view>
- </view>
- <u-popup :show="showImg" mode="center" @close="closeImg">
- <view style="width: 400px;height: 400px;">
- <u-image style="margin-top: 50rpx;" width="100%" height="600rpx" :src="filePathImg"
- mode="aspectFit"></u-image>
- </view>
- </u-popup>
- <u-empty v-if="total == 0" style="position: absolute;top: 45%;left: 50%;transform:translate(-50%,-50%)"
- mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" />
- <uni-calendar ref="calendar" :insert="false" :range="true" @confirm="confirmCalendar" />
- <u-picker :show="show" :columns="columns" keyName="cname" @cancel="show = false" @confirm="confirm"></u-picker>
- <u-loadmore v-if="total !== 0 && dataList.length != 0" :status="status" />
- </view>
- </template>
- <script>
- import {
- queryList,
- corpsDescList,
- customerTypeAllList
- } from '@/api/views/customer/index.js'
- export default {
- data() {
- return {
- filePathImg: null,
- showImg: false,
- dataList: [],
- columns: [],
- sortOpen: false,
- show: false,
- mask: false,
- current: 0,
- total: 0,
- status: 'loadmore',
- name: '',
- form: {
- current: 1,
- size: 10,
- },
- tabsList: [{
- name: '全部',
- badge: {
- value: 0,
- }
- }]
- }
- },
- created() {
- customerTypeAllList({
- corpType: 'KH'
- }).then(res => {
- for (let item of res.data) {
- this.tabsList.push({
- name: item.title,
- id: item.id
- })
- }
- })
- },
- onLoad() {
- this.dataList = []
- this.queryListfun()
- },
- onReachBottom() {
- this.status = 'loading'
- if (this.dataList.length < this.total) {
- this.form.current++
- this.queryListfun()
- } else {
- this.status = 'nomore'
- }
- console.log(2222)
- },
- methods: {
- closeImg() {
- this.showImg = false
- this.filePathImg = null
- },
- dropdownOpen() {
- this.sortOpen = false
- this.mask = false
- },
- sortQuery(val, sort = 0) {
- this.form = {
- current: 1,
- size: 10,
- sort: sort,
- typeSort: val
- }
- this.dataList = []
- this.sortOpen = false
- this.mask = false
- this.current = 0
- this.queryListfun()
- },
- custom() {
- this.form = {
- current: 1,
- size: 10,
- cname: this.form.cname
- }
- this.dataList = []
- this.queryListfun()
- },
- makePhoneCall(tel) {
- uni.makePhoneCall({
- phoneNumber: tel,
- success: function() {
- console.log('拨打电话成功');
- },
- fail() {
- uni.showToast({
- title: '拨打电话失败',
- icon: 'none',
- mask: true
- });
- }
- })
- },
- choice(item1, index1) {
- uni.$u.route('/pages/views/customer/customerDetails', {
- id: item1.id
- });
- },
- jumpCommodities() {
- uni.$u.route('/pages/views/customer/customerDetails');
- },
- //查询
- queryListfun() {
- uni.showLoading({
- title: '加载中',
- mask: true
- });
- queryList({
- ...this.form,
- corpType: 'KH',
- enableOrNot: 1,
- }).then(res => {
- if (res.data.records) {
- this.dataList = this.dataList.concat(res.data.records)
- }
- this.total = res.data.total || 0
- uni.hideLoading();
- if (this.total < 10) {
- this.status = 'nomore'
- }
- })
- },
- tabsClick(item) {
- this.current = item.index
- this.form = {
- current: 1,
- size: 10,
- corpsTypeId: item.id
- }
- this.dataList = []
- this.queryListfun()
- },
- confirm(e) {
- this.form = {
- current: 1,
- size: 10,
- corpId: e.value[0].id
- }
- this.dataList = []
- this.queryListfun()
- this.show = false
- },
- //确认日期
- confirmCalendar(e) {
- this.form = {
- current: 1,
- size: 10,
- businesStartDate: e.range.before + ' 00:00:00',
- businesEndDate: e.range.after + ' 23:59:59'
- }
- this.dataList = []
- this.queryListfun()
- },
- }
- }
- </script>
- <style scoped>
- .contentBox {
- width: 96%;
- margin: 20rpx auto;
- background-color: #FFFFFF;
- border-radius: 20rpx;
- /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
- padding-top: 15rpx;
- padding-bottom: 10rpx;
- }
- .textBox {
- padding: 0 15px;
- display: flex;
- justify-content: space-between;
- font-size: 24rpx;
- margin-bottom: 10rpx;
- }
- .dropdown {
- position: absolute;
- z-index: 99;
- background: rgba(0, 0, 0, .3);
- width: 100%;
- left: 0;
- top: calc(var(--status-bar-height) + 90px);
- bottom: 0;
- }
- .tl-show {
- overflow: hidden;
- position: fixed;
- height: 100%;
- width: 100%;
- }
- </style>
|