123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <template>
- <view class="enterprise-list">
- <view class="list-wrap">
- <u-sticky bgColor="#fff" class="main-sticky">
- <view class="search-wrap">
- <view class="input-wrap">
- <view class="input">
- <u-search bgColor='#fff' :showAction='false'
- :placeholder="$t('base.common.inputPlaceholder')" @search="searchList"
- @clear='searchList' v-model="form.keyword">
- </u-search>
- <view class="search-btn" @click="searchList">{{$t("customer_meter.search")}}</view>
- </view>
- </view>
- </view>
- </u-sticky>
- <template v-if="driverList.length">
- <u-swipe-action>
- <view v-for="(item, index) in driverList" :key="item.id" class="business-card">
- <!-- <u-swipe-action-item :name="item.userName" :options="options" @click="onVehicleChange($event,item)"> -->
- <view class="business-card-info">
- <text class="info">{{item.dealerName}}</text>
- <text class="no">{{item.dealerPhone}}</text>
- <view class="businessStatus-info">
- <u--image width="100rpx" height="88rpx"
- :src="item.statusFlag==1?'/subpages/static/czzn-img/state/start.png':'/subpages/static/czzn-img/state/stop.png'">
- </u--image>
- </view>
- </view>
- <!-- </u-swipe-action-item> -->
- </view>
- </u-swipe-action>
- </template>
- <template v-else>
- <u-empty mode="list" icon="https://cdn.uviewui.com/uview/empty/list.png">
- </u-empty>
- </template>
- </view>
- <u-modal :show="showAdd" @confirm="confirm" ref="addModal" showCancelButton closeOnClickOverlay
- @cancel="showAdd=false" @close="showAdd=false">
- <view class="invite-box">
- <view class="invite-box-title">绑定客商</view>
- <u--input placeholder="请输入客商手机号" border="surround" v-model="phone"></u--input>
- </view>
- </u-modal>
- <!-- <uni-fab ref="fab" horizontal="left" vertical="bottom" buttonColor="#3c9cff" @trigger="trigger"
- @fabClick="onClickRight" /> -->
- </view>
- </template>
- <script>
- import {
- getDealerList,
- } from "../../api/driver";
- import {
- getDriverTenantList,
- } from "../../api/tenant.js";
- export default {
- data() {
- return {
- options: [{
- text: this.$t("base.button.disableEnable"),
- name: "disable",
- style: {
- backgroundColor: '#3c9cff'
- }
- },
- // {
- // text: this.$t("base.button.delete"),
- // name: "delete",
- // style: {
- // backgroundColor: '#f56c6c'
- // }
- // }
- ],
- current: undefined,
- showAdd: false,
- showEnable: false,
- keyword: "",
- active: 0,
- value: "",
- phone: "",
- driverList: [],
- form: {
- keyword: "",
- },
- tablist: [{
- name: this.$t("customer_meter.all"),
- },
- {
- name: this.$t("customer_meter.enable"),
- },
- {
- name: this.$t("customer_meter.deactivate"),
- },
- ],
- page: {
- pages: 1,
- size: 10,
- },
- total: 0,
- hasMore: true,
- };
- },
- components: {},
- onLoad() {
- this.bindDealerList();
- },
- methods: {
- //搜索列表
- searchList() {
- this.page.pages = 1
- this.hasMore = false
- this.bindDealerList()
- },
- //显示启用弹窗
- onVehicleChange(e, item) {
- var that = this;
- if (e.index == 0) {
- //停用客商
- uni.showModal({
- content: (item.statusFlag == 1 ? that.$t("dealer.stopDealer") : that.$t(
- "dealer.startDealer")),
- showCancel: true,
- cancelText: that.$t("settings.cancelText"),
- confirmText: that.$t("settings.confirmText"),
- success: function(res) {
- if (res.confirm) {
- console.log("开始处理客商信息、", item);
- dealerUpdateStatus(item.id, item.statusFlag == 1 ? 0 : 1).then(res => {
- if (res.statusCode == 200) {
- uni.showToast({
- title: (item.statusFlag == 1 ? that.$t(
- "dealer.stopIng") : that.$t(
- "dealer.startIng")),
- icon: "none",
- duration: 2000,
- });
- that.driverList = [];
- that.bindDealerList()
- }
- })
- }
- }
- })
- }
- // else {
- // //删除
- // uni.showModal({
- // // title: '提示',
- // content: that.$t("driver.deleteVehcile"),
- // showCancel: true,
- // cancelText: that.$t("base.search.cancelText"),
- // confirmText: that.$t("base.search.submitText"),
- // success: function(r) {
- // if (r.confirm) {
- // dealerDeleteVehicle(item).then(res => {
- // if (res.statusCode == 200) {
- // that.bindDealerList()
- // }
- // })
- // }
- // }
- // })
- // }
- },
- //加载更多
- scrolltolower() {
- if (this.hasMore) {
- this.page.pages += 1;
- this.bindDealerList();
- }
- },
- bindDealerList() {
- this.form.appUserType="4"
- getDealerList(this.form).then((res) => {
- if (this.hasMore) {
- this.driverList = [
- ...this.driverList,
- ...res.data.data,
- ];
- } else {
- this.driverList = res.data.data;
- }
- console.log(this.driverList);
- // debugger
- this.driverList.forEach((item) => {
- item.enableFlag = item.statusFlag == "1" ? true : false;
- });
- this.total = res.data.data.total;
- if (this.driverList.length >= this.total) {
- this.hasMore = false;
- } else {
- this.hasMore = true;
- }
- });
- },
- //点击右侧加号
- onClickRight() {
- this.showAdd = true;
- },
- changeTab(item) {
- this.active = item.index;
- },
- //绑定客商
- confirm() {
- bindDealerByPhone({
- phone: this.phone
- }).then((res) => {
- if (res.statusCode == 200) {
- console.log("绑定的信息为、",res.data);
- if(res.data.code==0 && !res.data.data.tenantList){
- uni.setStorageSync('tenantInfo', res.data.data.tenantList)
- }
- this.dealerPhone = ""
- this.showAdd = false
- this.driverList = [];
- uni.showToast({
- title: "绑定成功",
- icon: "none",
- duration: 2000,
- });
- this.page.pages = 1;
- this.bindDealerList();
- } else {
- this.dealerPhone = ""
- this.showAdd = false
- }
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- @import '../../common/css/public.scss';
- </style>
|