陶杰
2024-12-10 b07889e22f823fac80a66b503671e170668f4ee6
1.供应商子账号
已修改5个文件
已添加4个文件
1678 ■■■■ 文件已修改
common/authorize.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.js 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/home/supplier-home.vue 790 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/user/supplier-user.vue 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
store/index.js 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sub_pages/supplier/sub-account/sub-account-list.vue 177 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sub_pages/supplier/sub-account/sub-account-reg.vue 382 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sub_pages/supplier/sub-account/sub-account-switch-list.vue 165 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/authorize.js
对比新文件
@@ -0,0 +1,18 @@
import storage from '../plugins/storage.js'
function hasPermission(permission) {
    // 判断是否是子账号,如果是子账号菜单需要验证权限
    const appMenu=storage.getItem('appMenu');
    // 获取当前登录人信息
    const currentInfo=this.$store.state.currentInfo
    const isSubSupplier=currentInfo.isSubSupplier
    if(isSubSupplier){
      const menu = appMenu.find(element => element.permissionUq === permission);
      return  menu?.subaccountAccessFlag===1?true : false;
    }else{
      // 主账号用所有权限
      return true;
    }
  }
export default hasPermission
main.js
@@ -19,6 +19,9 @@
Vue.mixin(mixinsCommon)
import hasPermission from './common/authorize.js'
Vue.prototype.$hasPermission = hasPermission;
// main.js
import uView from 'uview-ui'
Vue.use(uView)
pages.json
@@ -223,6 +223,26 @@
                        "enablePullDownRefresh": true
                    }
                }
                ,{
                    "path": "sub-account/sub-account-list",
                    "style": {
                        "navigationBarTitleText": "子账号列表",
                        "enablePullDownRefresh": true
                    }
                }
                ,{
                    "path": "sub-account/sub-account-reg",
                    "style": {
                        "navigationBarTitleText": "子账号注册",
                        "enablePullDownRefresh": true
                    }
                },{
                    "path": "sub-account/sub-account-switch-list",
                    "style": {
                        "navigationBarTitleText": "子账号切换",
                        "enablePullDownRefresh": true
                    }
                }
                // #ifdef PUB_SUPPLIER
                , {
                    "path": "supplier-info/supplier-info",
pages/home/supplier-home.vue
@@ -7,38 +7,37 @@
            我的
        </view> -->
        <!-- 背景图 -->
        <view class="top-bg" :style="{'padding-top':(StatusBar)+'px','line-height':CustomBar+'rpx' }">
        <view class="top-bg" :style="{ 'padding-top': (StatusBar) + 'px', 'line-height': CustomBar + 'rpx' }">
            <view class="title" style="position: relative;">
                首页
            </view>
            <view class="flex user-info" v-if="currentInfo&&(currentInfo.id)">
            <view class="flex user-info" v-if="currentInfo && (currentInfo.id)">
                <image class="user-icon" v-if="
                    (currentInfo.customerDTO&&currentInfo.customerDTO.cover)
                    ||(currentInfo.supplierDTO&&currentInfo.supplierDTO.cover)
                    ||(currentInfo.partnerDTO&&currentInfo.partnerDTO.cover)
                    (currentInfo.customerDTO && currentInfo.customerDTO.cover)
                    || (currentInfo.supplierDTO && currentInfo.supplierDTO.cover)
                    || (currentInfo.partnerDTO && currentInfo.partnerDTO.cover)
                    || currentInfo.picture
                    " :src="
                    (currentInfo.customerDTO&&currentInfo.customerDTO.cover)
                    ||(currentInfo.supplierDTO&&currentInfo.supplierDTO.cover)
                    ||(currentInfo.partnerDTO&&currentInfo.partnerDTO.cover)
                    || currentInfo.picture
                    " mode="scaleToFill"></image>
                " :src="(currentInfo.customerDTO && currentInfo.customerDTO.cover)
                        || (currentInfo.supplierDTO && currentInfo.supplierDTO.cover)
                        || (currentInfo.partnerDTO && currentInfo.partnerDTO.cover)
                        || currentInfo.picture
                        " mode="scaleToFill"></image>
                <image class="user-icon" v-else
                    src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png'
                    mode="scaleToFill"></image>
                <!-- 头像 -->
            <!--     <image class="user-icon" v-if="!currentInfo.picture"
                <!--     <image class="user-icon" v-if="!currentInfo.picture"
                    src='https://youzhen123.oss-cn-huhehaote.aliyuncs.com/WechatOwnerProperty/images/mrtx.png'
                    mode="aspectFit"></image>
                <image class="user-icon" v-if="currentInfo.picture" :src="currentInfo.picture" mode="aspectFit"></image> -->
                <view class="name">
                    <view class="t1">
                    <view class="t1 flex" style="align-items: center; justify-content: space-between;">
                        <!-- {{ (!!currentInfo.supplierDTO?(currentInfo.supplierDTO.name):"") || currentInfo.nickName || currentInfo.loginName || '-'}} -->
                        <span v-if="currentInfo.partnerDTO && currentInfo.partnerDTO.name">
                            {{ currentInfo.partnerDTO.name }}
@@ -57,15 +56,21 @@
                        </span>
                        <span v-else>-</span>
                        <span v-if="currentInfo.supplierDTO&&currentInfo.supplierDTO.status!=='P'">
                            ({{currentInfo.supplierDTO?currentInfo.supplierDTO.statusStr:''}})</span>
                        <span v-if="currentInfo.partnerDTO&&currentInfo.partnerDTO.status!=='P'">
                            ({{currentInfo.partnerDTO?currentInfo.partnerDTO.statusStr:''}})</span>
                        <span v-if="!currentInfo.partnerDTO&&currentInfo.type==='partner'">(信息待完善)</span>
                        <span v-if="currentInfo.supplierDTO && currentInfo.supplierDTO.status !== 'P'">
                            ({{ currentInfo.supplierDTO ? currentInfo.supplierDTO.statusStr : '' }})</span>
                        <span v-if="currentInfo.partnerDTO && currentInfo.partnerDTO.status !== 'P'">
                            ({{ currentInfo.partnerDTO ? currentInfo.partnerDTO.statusStr : '' }})</span>
                        <span v-if="!currentInfo.partnerDTO && currentInfo.type === 'partner'">(信息待完善)</span>
                        <u--image v-if="selftype === 'supplier' && currentInfo.switchFlag "
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/fa/fa6585cd52d54156b5d64fa59af58180switch.png"
                            width="10px" height="10px" style="margin-left: 10px; margin-right: 10px;"
                            @click="switchSubAccount"></u--image>
                        <u--text v-if="selftype === 'supplier' && currentInfo.switchFlag " style="color: black;" text="切换账号" @click="switchSubAccount"></u--text>
                    </view>
                    <view class="t2">{{currentInfo.tel || '暂无电话'}}</view>
                    <view class="t2">{{ currentInfo.tel || '暂无电话' }}</view>
                    <view class="t2" v-if="currentInfo.partnerDTO && currentInfo.partnerDTO.id">
                      ID: {{ currentInfo.partnerDTO.id }}
                        ID: {{ currentInfo.partnerDTO.id }}
                    </view>
                </view>
@@ -73,12 +78,17 @@
        </view>
        <view class="item-container" :class="[selftype?selftype:'']">
        <view class="item-container" :class="[selftype ? selftype : '']"
            v-if="
                (selftype === 'supplier' && $hasPermission('supplier:workbench:mine:profit'))
            ||  (selftype === 'partner' && $hasPermission('partner:workbench:mine:profit'))
            ">
            <view class="title">我的收益</view>
            <view class="flex tj-container" v-if="selftype==='partner'">
            <view class="flex tj-container" v-if="selftype === 'partner'">
                <view class="tj-each">
                    <view class="num total">
                        ¥{{tj.income||'0.00'}}
                        ¥{{ tj.income || '0.00' }}
                    </view>
                </view>
                <view class="tj-each" style="flex: 1;">
@@ -89,26 +99,26 @@
            </view>
            <view class="line"></view>
            <view class="flex tj-container" v-if="selftype==='supplier'">
                <view class="tj-each"  @click="goto('/sub_pages/supplier/data-statis/data-statis',true)">
            <view class="flex tj-container" v-if="selftype === 'supplier'">
                <view class="tj-each" @click="goto('/sub_pages/supplier/data-statis/data-statis', true)">
                    <view class="num">
                        {{tj.dealCountLastMonth||0}}扎
                        {{ tj.dealCountLastMonth || 0 }}扎
                    </view>
                    <view class="name">
                        上月成交
                    </view>
                </view>
                <view class="tj-each"  @click="goto('/sub_pages/supplier/data-statis/data-statis',true)">
                <view class="tj-each" @click="goto('/sub_pages/supplier/data-statis/data-statis', true)">
                    <view class="num">
                        {{tj.dealCountToday||0}}扎
                        {{ tj.dealCountToday || 0 }}扎
                    </view>
                    <view class="name">
                        今日成交
                    </view>
                </view>
                <view class="tj-each"  @click="goto('/sub_pages/supplier/data-statis/data-statis',true)">
                <view class="tj-each" @click="goto('/sub_pages/supplier/data-statis/data-statis', true)">
                    <view class="num">
                        {{tj.dealCountDay30||0}}扎
                        {{ tj.dealCountDay30 || 0 }}扎
                    </view>
                    <view class="name">
                        近30天成交
@@ -116,25 +126,28 @@
                </view>
            </view>
            <view class="flex tj-container">
                <view class="tj-each" @click="selftype=='supplier'&&goto('/pages/order/order-delivery?range=today',true)">
                <view class="tj-each"
                    @click="selftype == 'supplier' && goto('/pages/order/order-delivery?range=today', true)">
                    <view class="num">
                        {{tj.orderCountToday||0}}单
                        {{ tj.orderCountToday || 0 }}单
                    </view>
                    <view class="name">
                        今日订单数
                    </view>
                </view>
                <view class="tj-each" @click="selftype=='supplier'&&goto('/pages/order/order-delivery?range=yesterday',true)">
                <view class="tj-each"
                    @click="selftype == 'supplier' && goto('/pages/order/order-delivery?range=yesterday', true)">
                    <view class="num">
                        {{tj.orderCountYesterday||0}}单
                        {{ tj.orderCountYesterday || 0 }}单
                    </view>
                    <view class="name">
                        昨日订单数
                    </view>
                </view>
                <view class="tj-each" @click="selftype=='supplier'&&goto('/pages/order/order-delivery?range=month',true)">
                <view class="tj-each"
                    @click="selftype == 'supplier' && goto('/pages/order/order-delivery?range=month', true)">
                    <view class="num">
                        {{tj.orderCountMonth||0}}单
                        {{ tj.orderCountMonth || 0 }}单
                    </view>
                    <view class="name">
                        本月订单数
@@ -142,103 +155,132 @@
                </view>
            </view>
        </view>
        <view class="item-container flex m-t-12" style="padding: 34rpx 44rpx;" v-if="selftype=='supplier'">
        <view class="item-container flex m-t-12" style="padding: 34rpx 44rpx;"
            v-if="(selftype == 'supplier' && $hasPermission('supplier:workbench:after:sale'))">
            <view class="rate-view flex1" style="max-width: 140rpx;">
                <view class="title">售后率</view>
                <view class="title" style="color: red;">{{((tj.salesRate||0)*100).toFixed(2)}}%</view>
                <view class="title" style="color: red;">{{ ((tj.salesRate || 0) * 100).toFixed(2) }}%</view>
            </view>
            <view class="tj-panel  pink flex1"
                @click="goto('/pages/order/order-delivery?status=PENDING&range=today',true)">
                @click="goto('/pages/order/order-delivery?status=PENDING&range=today', true)">
                <view class="name">今日待配送</view>
                <view class="title">{{tj.deliverCount||0}}扎</view>
                <view class="title">{{ tj.deliverCount || 0 }}扎</view>
            </view>
            <view class="tj-panel green flex1"
                @click="goto('/pages/order/order-delivery?status=ARRIVED&range=today',true)">
                @click="goto('/pages/order/order-delivery?status=ARRIVED&range=today', true)">
                <view class="name green">今日配送汇总</view>
                <view class="title">{{tj.deliverTotal||0}}扎</view>
                <view class="title">{{ tj.deliverTotal || 0 }}扎</view>
            </view>
        </view>
        <view class="m-t-12" @click="getNoticeMore">
        <view v-if="
                (selftype === 'supplier' && $hasPermission('supplier:workbench:notice') )
            ||  (selftype === 'partner' && $hasPermission('partner:workbench:notice'))
            "
            class="m-t-12" @click="getNoticeMore">
            <uni-notice-bar class="notice-bar" color="#333" background-color="#fff" show-get-more show-icon
                :scrollable="scrollable" :text="currentNotice.title||'暂无公告'" :key="currentNotice.id" />
            <span v-if="!currentNotice||!currentNotice.id">&nbsp;</span>
                :scrollable="scrollable" :text="currentNotice.title || '暂无公告'" :key="currentNotice.id" />
            <span v-if="!currentNotice || !currentNotice.id">&nbsp;</span>
        </view>
        <view class="item-container">
        <view class="item-container  m-t-12"
            v-if="
            (selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions') )
            ||  (selftype === 'partner' && $hasPermission('partner:workbench:common:functions'))
            ">
            <view class="title">常用功能</view>
            <view class="flex order-icons m-t-12">
                <view class="nav row margin-tb" v-if="selftype==='partner'"
                    @click="goto('/sub_pages/partner/order-manage/order-manage',true)">
            <view class="flex order-icons m-t-12 function-container ">
                <view class="nav row margin-tb function-item "
                v-if="(selftype === 'partner' && $hasPermission('partner:workbench:common:functions:order:management'))"
                    @click="goto('/sub_pages/partner/order-manage/order-manage', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon ddgl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/23/23a7ad86e00c4ba28cd962dc4910433cuser-icon-ddgl.png" mode="scaleToFill" />
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/23/23a7ad86e00c4ba28cd962dc4910433cuser-icon-ddgl.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">订单管理</view>
                </view>
                <view class="nav row margin-tb" v-if="selftype==='supplier'"
                    @click="goto('/sub_pages/supplier/order-manage/order-manage',true)">
                <view class="nav row margin-tb function-item "
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:order:statistics'))"
                    @click="goto('/sub_pages/supplier/order-manage/order-manage', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon ddgl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/23/23a7ad86e00c4ba28cd962dc4910433cuser-icon-ddgl.png" mode="scaleToFill" />
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/23/23a7ad86e00c4ba28cd962dc4910433cuser-icon-ddgl.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">订单统计</view>
                </view>
                <!-- <view class="nav row margin-tb"
                <view
                    v-if="(selftype==='partner' && $hasPermission('partner:workbench:common:functions:bill:settlement'))"
                    class="nav row margin-tb function-item "
                    @click="goto('/sub_pages/supplier/order-settlement/order-settlement',true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon zdjs"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/7b/7b7ed1488fd64f6fa9bc6b557f141f37user-icon-zdjs.png" mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">账单结算</view>
                </view> -->
                <view class="nav row margin-tb" @click="toFlowManage" v-if="selftype==='supplier'">
                </view>
                <view class="nav row margin-tb function-item " @click="toFlowManage"
                    v-if="selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:product:management')">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon spgl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/47/478e007ad07a43ea9f40a962d83cedb4user-icon-spgl.png" mode="scaleToFill" />
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/47/478e007ad07a43ea9f40a962d83cedb4user-icon-spgl.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc cqw">商品管理</view>
                </view>
                <view class="nav row margin-tb" v-if="selftype==='partner'"
                    @click="goto('/sub_pages/partner/markup-config/markup-config',true)">
                <view class="nav row margin-tb function-item "
                v-if="(selftype === 'partner' && $hasPermission('partner:workbench:common:functions:markup:configuration'))"
                    @click="goto('/sub_pages/partner/markup-config/markup-config', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon jjpz"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/93/93356ec339074b49b04c1a3a37146f22user-icon-jjpz.png" mode="scaleToFill" />
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/93/93356ec339074b49b04c1a3a37146f22user-icon-jjpz.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc tg">加价配置</view>
                </view>
                <view class="nav row margin-tb" @click="goto('/pages/order/order-sale/order-sale',true)">
                <view class="nav row margin-tb function-item "
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:after:sale:claim')) ||
                    (selftype === 'partner' && $hasPermission('partner:workbench:common:functions:after:sale:claim') )"
                    @click="goto('/pages/order/order-sale/order-sale', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon shlp"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/47/47b54c52e4c2430c8f9e91645fbf9ebduser-icon-shlp.png" mode="scaleToFill" />
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/47/47b54c52e4c2430c8f9e91645fbf9ebduser-icon-shlp.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc syst">售后理赔</view>
                </view>
                <!-- <view class="nav row margin-tb" @click="printDeliveryOrder">
                <!-- <view class="nav row margin-tb function-item " @click="printDeliveryOrder">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon kkjl"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/22/22db478554ec436a8c7e6e89c346767duser-icon-kkjl.png" mode="scaleToFill" />
                    </view>
                    <view class="order-desc wbsp">测试蓝牙</view>
                </view> -->
            </view>
            <view class="flex order-icons m-t-12">
                <view class="nav row margin-tb" v-if="selftype==='supplier'" @click="goto('/sub_pages/supplier/wallet/my-wallet',true)">
            <!-- </view>
            <view class="flex order-icons m-t-12"> -->
                <view class="nav row margin-tb function-item "
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:my:wallet'))" @click="goto('/sub_pages/supplier/wallet/my-wallet', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon shlp"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/8d/8d72f2df8a4348ac90bfbfb553a9cc71qianbao.png" mode="scaleToFill" />
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/8d/8d72f2df8a4348ac90bfbfb553a9cc71qianbao.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc syst">我的钱包</view>
                </view>
                <view class="nav row margin-tb">
                <view class="nav row margin-tb function-item "
                    v-if="(selftype === 'supplier' && $hasPermission('supplier:workbench:common:functions:sub:account'))"
                    @click="goto('/sub_pages/supplier/sub-account/sub-account-list', true)">
                    <view class="img-c">
                        <image class="icon margin-bottom order-icon shlp"
                            src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/56/56d1a93862a4470e9b4481b970fd6fc9子账号管理.png"
                            mode="scaleToFill" />
                    </view>
                    <view class="order-desc syst">子账号</view>
                </view>
                <view class="nav row margin-tb">
                </view>
                <view class="nav row margin-tb">
                </view>
                <!-- <view class="nav row margin-tb function-item "></view> -->
            </view>
        </view>
@@ -251,320 +293,340 @@
</template>
<script>
    export default {
        data() {
            return {
                CustomBar: uni.getStorageSync('CustomBar'),
                StatusBar: uni.getStorageSync('StatusBar'),
                tcode: '',
                inviterName: '',
                // StatusBar:0,
export default {
    data() {
        return {
            CustomBar: uni.getStorageSync('CustomBar'),
            StatusBar: uni.getStorageSync('StatusBar'),
            tcode: '',
            inviterName: '',
            // StatusBar:0,
                //公告的
                noticeList: [],
                currentNoticeIndex: 0,
                currentNotice: {
            //公告的
            noticeList: [],
            currentNoticeIndex: 0,
            currentNotice: {
                },
                scrollable: false,
                cacheUserId: '',
                tj: {}
            },
            scrollable: false,
            cacheUserId: '',
            tj: {}
            };
        },
        onShareAppMessage() {
            let that = this;
            var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
                that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
            var url =
                `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
            return {
                title: "花满芫",
                path: url,
        };
    },
    onShareAppMessage() {
        let that = this;
        var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
            that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
        var url =
            `/pages/login/supplier-login?shareId=${this.currentInfo && this.currentInfo.id || ''}&shareName=${name || ''}`; //你的转发页面路径拼接参数
        return {
            title: "花满芫",
            path: url,
        }
    },
    onShareTimeline() {
        let that = this;
        var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
            that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
        var url =
            `/pages/login/supplier-login?shareId=${this.currentInfo && this.currentInfo.id || ''}&shareName=${name || ''}`; //你的转发页面路径拼接参数
        return {
            title: "花满芫",
            path: url,
        }
    },
    async onPullDownRefresh() {
        await this.$store.dispatch('getCurrentInfo')
        await this.getTj(true)
        uni.stopPullDownRefresh()
    },
    onLoad(options) {
        const url = options.q ? decodeURIComponent(options.q) : '';
        const urlcode = options.url && decodeURIComponent(options.url) || ''
    },
    onShow() {
        this.getTj(true)
    },
    created() {
        //公告
        var type = ''
        // #ifdef PUB_CUSTOMER
        type = 'customer'
        // #endif
        // #ifdef PUB_SUPPLIER
        type = 'supplier'
        // #endif
        // #ifdef PUB_PARTNER
        type = 'partner'
        // #endif
        this.$http.request('get', '/api/pub/announcement/list/' + type, {
            params: {
                size: 5,
                status: 'A'
            }
        },
        onShareTimeline() {
            let that = this;
            var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
                that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
            var url =
                `/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
            return {
                title: "花满芫",
                path: url,
            }
        },
        async onPullDownRefresh() {
            await this.$store.dispatch('getCurrentInfo')
            await this.getTj(true)
            uni.stopPullDownRefresh()
        },
        onLoad(options) {
            const url = options.q ? decodeURIComponent(options.q) : '';
            const urlcode = options.url && decodeURIComponent(options.url) || ''
        },
        onShow() {
            this.getTj(true)
        },
        created() {
            //公告
            var type = ''
            // #ifdef PUB_CUSTOMER
            type = 'customer'
            // #endif
            // #ifdef PUB_SUPPLIER
            type = 'supplier'
            // #endif
            // #ifdef PUB_PARTNER
            type = 'partner'
            // #endif
            this.$http.request('get', '/api/pub/announcement/list/'+type, {
                params: {
                    size: 5,
                    status: 'A'
        }).then(res => {
            if (res.code == 0) {
                this.noticeList = (res.data && res.data || [])
                console.log('this.noticeList', this.noticeList)
                if (this.noticeList.length > 0) {
                    this.currentNotice = this.noticeList[0]
                    if (this.currentNotice.title && this.currentNotice.title.length >= 30) {
                        this.scrollable = true
                    } else {
                        this.scrollable = false
                    }
                    let that = this
                    // if (this.noticeList.length >= 1) {
                    //     setInterval(() => {
                    //         console.log('interval,1')
                    //         that.currentNoticeIndex += 1
                    //         that.currentNoticeIndex %= that.noticeList.length
                    //         that.currentNotice = that.noticeList[that.currentNoticeIndex]
                    //         that.scrollable = false
                    //         that.$nextTick(() => {
                    //             if (that.currentNotice.title && that.currentNotice.title
                    //                 .length >= 30) {
                    //                 that.scrollable = true
                    //             } else {
                    //                 that.scrollable = false
                    //             }
                    //         })
                    //     }, 8000)
                    // }
                }
            }).then(res => {
                if (res.code == 0) {
                    this.noticeList = (res.data && res.data || [])
                    console.log('this.noticeList', this.noticeList)
                    if (this.noticeList.length > 0) {
                        this.currentNotice = this.noticeList[0]
                        if (this.currentNotice.title && this.currentNotice.title.length >= 30) {
                            this.scrollable = true
                        } else {
                            this.scrollable = false
                        }
                        let that = this
                        // if (this.noticeList.length >= 1) {
                        //     setInterval(() => {
                        //         console.log('interval,1')
                        //         that.currentNoticeIndex += 1
                        //         that.currentNoticeIndex %= that.noticeList.length
                        //         that.currentNotice = that.noticeList[that.currentNoticeIndex]
                        //         that.scrollable = false
                        //         that.$nextTick(() => {
                        //             if (that.currentNotice.title && that.currentNotice.title
                        //                 .length >= 30) {
                        //                 that.scrollable = true
                        //             } else {
                        //                 that.scrollable = false
                        //             }
                        //         })
            }
        })
                        //     }, 8000)
                        // }
    },
    methods: {
        switchSubAccount() {
            uni.navigateTo({
                url: '/sub_pages/supplier/sub-account/sub-account-switch-list'
            })
        },
        printDeliveryOrder(item) {
            //蓝牙打印
            var that = this;
            wx.getBluetoothAdapterState({
                success: (result) => {
                    console.log('b s', result)
                    console.log("蓝牙状态:\n" + result.errMsg)
                    if (result.adapterState.available) {
                        if (result.adapterState.discovering) {
                            that.blueSearchDeviceCheck()
                        } else {
                            that.blueSearchDevice()
                        }
                    } else {
                        //打开蓝牙
                        wx.openBluetoothAdapter({
                            success: function (res) {
                                console.log("蓝牙已打开")
                                that.blueSearchDevice()
                            },
                            fail: function (res) {
                                console.log('res', res)
                                that.$message.showToast('蓝牙未打开')
                            }
                        })
                    }
                },
                fail: (res) => {
                    console.log("蓝牙状态", res)
                    that.$message.showToast('获取蓝牙状态失败')
                }
            })
        },
        blueSearchDevice() {
            var that = this;
            wx.startBluetoothDevicesDiscovery({
                success: (res) => {
                    //打印调试日志
                    console.log("搜索设备返回" + JSON.stringify(res))
                    that.blueSearchDeviceCheck()
                },
                fail: (res) => {
                    console.log('error search', res)
                    that.$message.showToast('打开蓝牙搜索设备失败')
                }
            })
        },
        methods: {
            printDeliveryOrder(item) {
                //蓝牙打印
                var that = this;
                wx.getBluetoothAdapterState({
                    success: (result) => {
                        console.log('b s', result)
                        console.log("蓝牙状态:\n" + result.errMsg)
                        if (result.adapterState.available) {
                            if (result.adapterState.discovering) {
                                that.blueSearchDeviceCheck()
                            } else {
                                that.blueSearchDevice()
                            }
        blueSearchDeviceCheck() {
            let that = this
            wx.getBluetoothDevices({
                success: (res) => {
                    var printDevice = undefined
                    for (var device of res.devices) {
                        if (device.name.indexOf('GP-M') >= 0) {
                            printDevice = device
                            // RSSI: -57
                            // advertisServiceUUIDs: Array(2)
                            // 0: "000018f0-0000-1000-8000-00805f9b34fb"
                            // 1: "e7810a71-73ae-499d-8c15-faa9aef0c3f2"
                            // length: 2
                            // nv_length: (...)
                            // __proto__: Array(0)
                            // deviceId: "89:E2:AF:33:46:2B"
                            // name: "GP-M322-5565_BLE"
                            break
                        } else {
                            //打开蓝牙
                            wx.openBluetoothAdapter({
                                success: function(res) {
                                    console.log("蓝牙已打开")
                                    that.blueSearchDevice()
                                },
                                fail: function(res) {
                                    console.log('res', res)
                                    that.$message.showToast('蓝牙未打开')
                                }
                            })
                        }
                    },
                    fail: (res) => {
                        console.log("蓝牙状态", res)
                        that.$message.showToast('获取蓝牙状态失败')
                    }
                })
            },
            blueSearchDevice() {
                var that = this;
                wx.startBluetoothDevicesDiscovery({
                    success: (res) => {
                        //打印调试日志
                        console.log("搜索设备返回" + JSON.stringify(res))
                        that.blueSearchDeviceCheck()
                    },
                    fail: (res) => {
                        console.log('error search', res)
                        that.$message.showToast('打开蓝牙搜索设备失败')
                    }
                })
            },
            blueSearchDeviceCheck() {
                let that = this
                wx.getBluetoothDevices({
                    success: (res) => {
                        var printDevice = undefined
                        for (var device of res.devices) {
                            if (device.name.indexOf('GP-M') >= 0) {
                                printDevice = device
                                // RSSI: -57
                                // advertisServiceUUIDs: Array(2)
                                // 0: "000018f0-0000-1000-8000-00805f9b34fb"
                                // 1: "e7810a71-73ae-499d-8c15-faa9aef0c3f2"
                                // length: 2
                                // nv_length: (...)
                                // __proto__: Array(0)
                                // deviceId: "89:E2:AF:33:46:2B"
                                // name: "GP-M322-5565_BLE"
                                break
                            } else {
                            }
                        }
                        if (!printDevice) {
                            that.$message.showToast('未找到可用打印机,请联系客服')
                            that.stopBluetoothDevicesDiscovery()
                        } else {
                            wx.createBLEConnection({
                                deviceId: printDevice.deviceId,
                                success: function(res) {
                                    // https: //blog.csdn.net/weixin_51375107/article/details/116009436
                                    console.log('连接设备返回:' + res.errMsg);
                                    that.$message.showToast('连接设备返回:' + res.errMsg)
                                    // escpos怎么来 →点击查看智谱清言的回答https://chatglm.cn/share/FEXaC
                                },
                                fail: function(res) {
                                    console.log('createBLEConnection fail', res)
                                    that.$message.showToast('连接打印机失败')
                                },
                                complete() {
                                    that.stopBluetoothDevicesDiscovery()
                                }
                            })
                        }
                        // res.devices.forEach((device, i) => {
                        //     console.log('device',
                        //         device)
                        //     // if (device.deviceId == that.data
                        //     //     .deviceId) {
                        //     //     console.log("物联网设备已找到")
                        //     //     that.$message.showToast(
                        //     //         '打印设备已找到')
                        //     //     return;
                        //     // }
                        // })
                    },
                    fail: (res) => {
                        console.log('getBluetoothDevices',
                            res)
                        that.$message.showToast('获取蓝牙设备失败')
                    }
                })
            },
            stopBluetoothDevicesDiscovery() {
                var that = this;
                wx.stopBluetoothDevicesDiscovery({
                    success: (res) => {
                        console.log("停止扫描设备")
                    },
                })
            },
            getTj(refresh=false) {
                // /api/supplier/delivery
                if (this.currentInfo.id && (this.currentInfo.id !== this.cacheUserId || refresh)) {
                    this.cacheUserId = this.currentInfo.id
                    let that = this
                    setTimeout(() => {
                        //其他统计
                        // #ifdef PUB_SUPPLIER
                        this.$http.request('get', '/api/supplier/delivery/statistics', {}).then(res => {
                            if (res.code === 0) {
                                that.tj = res.data || {}
                            }
                        })
                        // #endif
                        // #ifdef PUB_PARTNER
                        this.$http.request('get', '/api/partner/order/statistics', {}).then(res => {
                            if (res.code === 0) {
                                that.tj = res.data || {}
                            }
                        })
                        // #endif
                    }, 200)
                }
            },
            async toFlowManage() {
                if (!this.currentInfo.supplierDTO) {
                    await this.$message.confirm('尚未入驻店铺信息,是否前往入驻?')
                    this.goto('/sub_pages/supplier/supplier-info/supplier-info', true)
                    return
                }
                if (this.currentInfo.supplierDTO) {
                    //需要刷新一下当前用户信息
                    this.$message.showLoading()
                    await this.$store.dispatch('getCurrentInfo')
                    this.$message.hideLoading()
                    if (this.currentInfo.supplierDTO.status == 'P') {
                    if (!printDevice) {
                        that.$message.showToast('未找到可用打印机,请联系客服')
                        that.stopBluetoothDevicesDiscovery()
                    } else {
                        if (this.currentInfo.supplierDTO.status == 'R') {
                            await this.$message.confirm('店铺信息审核不通过,是否前往修改信息?')
                            this.goto('/sub_pages/supplier/supplier-info/supplier-info', true)
                            return
                        } else {
                            this.$message.showToast('审核中请耐心等待')
                            return
                        }
                        wx.createBLEConnection({
                            deviceId: printDevice.deviceId,
                            success: function (res) {
                                // https: //blog.csdn.net/weixin_51375107/article/details/116009436
                                console.log('连接设备返回:' + res.errMsg);
                                that.$message.showToast('连接设备返回:' + res.errMsg)
                                // escpos怎么来 →点击查看智谱清言的回答https://chatglm.cn/share/FEXaC
                            },
                            fail: function (res) {
                                console.log('createBLEConnection fail', res)
                                that.$message.showToast('连接打印机失败')
                            },
                            complete() {
                                that.stopBluetoothDevicesDiscovery()
                            }
                        })
                    }
                    // res.devices.forEach((device, i) => {
                    //     console.log('device',
                    //         device)
                    //     // if (device.deviceId == that.data
                    //     //     .deviceId) {
                    //     //     console.log("物联网设备已找到")
                    //     //     that.$message.showToast(
                    //     //         '打印设备已找到')
                    //     //     return;
                    //     // }
                    // })
                },
                fail: (res) => {
                    console.log('getBluetoothDevices',
                        res)
                    that.$message.showToast('获取蓝牙设备失败')
                }
                console.log('goto')
                this.goto('/sub_pages/supplier/flower-manage/flower-manage', true)
            },
            getNoticeMore() {
                uni.navigateTo({
                    url: '/pages/notice/list?id=' + this.currentNotice.id
                })
            },
            })
        },
        stopBluetoothDevicesDiscovery() {
            var that = this;
            wx.stopBluetoothDevicesDiscovery({
                success: (res) => {
                    console.log("停止扫描设备")
                },
            })
        },
        getTj(refresh = false) {
            // /api/supplier/delivery
            if (this.currentInfo.id && (this.currentInfo.id !== this.cacheUserId || refresh)) {
                this.cacheUserId = this.currentInfo.id
                let that = this
                setTimeout(() => {
                    //其他统计
                    // #ifdef PUB_SUPPLIER
                    this.$http.request('get', '/api/supplier/delivery/statistics', {}).then(res => {
                        if (res.code === 0) {
                            that.tj = res.data || {}
                        }
                    })
                    // #endif
                    // #ifdef PUB_PARTNER
                    this.$http.request('get', '/api/partner/order/statistics', {}).then(res => {
                        if (res.code === 0) {
                            that.tj = res.data || {}
                        }
                    })
                    // #endif
                }, 200)
            }
        },
        async toFlowManage() {
            if (!this.currentInfo.supplierDTO) {
                await this.$message.confirm('尚未入驻店铺信息,是否前往入驻?')
                this.goto('/sub_pages/supplier/supplier-info/supplier-info', true)
                return
            }
            if (this.currentInfo.supplierDTO) {
                //需要刷新一下当前用户信息
                this.$message.showLoading()
                await this.$store.dispatch('getCurrentInfo')
                this.$message.hideLoading()
                if (this.currentInfo.supplierDTO.status == 'P') {
                } else {
                    if (this.currentInfo.supplierDTO.status == 'R') {
                        await this.$message.confirm('店铺信息审核不通过,是否前往修改信息?')
                        this.goto('/sub_pages/supplier/supplier-info/supplier-info', true)
                        return
                    } else {
                        this.$message.showToast('审核中请耐心等待')
                        return
                    }
                }
            }
            console.log('goto')
            this.goto('/sub_pages/supplier/flower-manage/flower-manage', true)
        },
        getNoticeMore() {
            uni.navigateTo({
                url: '/pages/notice/list?id=' + this.currentNotice.id
            })
        },
        }
    }
}
</script>
<style lang="scss" scoped>
    @import "../user/user.scss";
@import "../user/user.scss";
    @import "./home.scss";
@import "./home.scss";
</style>
<style lang="scss" scoped>
<style lang="css" scoped>
.function-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-start;
}
.function-item {
  min-width: 25%;
  max-width: 25%;
  text-align: center;
  padding: 10px;
  box-sizing: border-box;
  margin-bottom: 10px;
}
</style>
pages/user/supplier-user.vue
@@ -103,7 +103,13 @@
                    <!-- getUserProfile -->
                    {{ '点击登陆/注册' }}
                </view>
                <image class="icon-setting" @click="toInfo" src="../../static/common/icon-setting.png" mode="aspectFit">
                <image class="icon-setting"
                    v-if="
                        (selftype==='supplier' && $hasPermission('supplier:mine:setting'))
                        || (selftype==='partner' && $hasPermission('partner:mine:setting') )
                        || (selftype==='customer')
                    "
                    @click="toInfo" src="../../static/common/icon-setting.png" mode="aspectFit">
                </image>
            </view>
            <!-- #ifdef PUB_CUSTOMER -->
@@ -323,14 +329,16 @@
                    <uni-icons type="right"></uni-icons>
                </view>
            </view> -->
            <view class="user-util m-t-12 flex" v-if="selftype==='partner'||!selftype"
            <view class="user-util m-t-12 flex"
                v-if="(selftype==='partner' && $hasPermission('partner:mine:personal:info') )||!selftype"
                @click="goto('/sub_pages/partner/partner-info/partner-info-personal',true)">
                <view class="title">个人资料</view>
                <view class="right-icon">
                    <uni-icons type="right"></uni-icons>
                </view>
            </view>
            <view class="user-util m-t-12 flex" v-if="selftype==='partner'"
            <view class="user-util m-t-12 flex"
                v-if="selftype==='partner' &&  $hasPermission('partner:mine:partner:info') "
                @click="goto('/sub_pages/partner/partner-info/partner-info',true)">
                <view class="title">合伙人信息</view>
                <view class="right-icon">
@@ -339,7 +347,9 @@
            </view>
            <!-- #ifdef PUB_PARTNER -->
            <view class="user-util m-t-12 flex"
                v-if="selftype==='partner'&&currentInfo.partnerDTO&&currentInfo.partnerDTO.id&&currentInfo.partnerDTO.status=='P'"
                v-if="
                    selftype==='partner'&& $hasPermission('partner:mine:reg:qrcode')
                    &&currentInfo.partnerDTO&&currentInfo.partnerDTO.id&&currentInfo.partnerDTO.status=='P'"
                @click="goto('/sub_pages/partner/partner-info/partner-code',true)">
                <view class="title">推广的注册二维码</view>
                <view class="right-icon">
@@ -365,14 +375,19 @@
            </view>
            <!-- #endif -->
            <view class="user-util m-t-12 flex"
                v-if="selftype==='supplier'&&currentInfo&&currentInfo.id&&currentInfo.supplierDTO&&currentInfo.supplierDTO.status==='P'"
                v-if="
                (selftype==='supplier'&&currentInfo&&currentInfo.id&&currentInfo.supplierDTO&&currentInfo.supplierDTO.status==='P'
                    && $hasPermission('supplier:mine:edit:info')
                )
                "
                @click="goto('/sub_pages/supplier/supplier-info/supplier-info-update',true)">
                <view class="title">信息维护</view>
                <view class="right-icon">
                    <uni-icons type="right"></uni-icons>
                </view>
            </view>
            <view class="user-util m-t-12 flex" v-if="selftype==='supplier'"
            <view class="user-util m-t-12 flex"
                v-if=" (selftype==='supplier' && $hasPermission('supplier:mine:shop:info') )"
                @click="goto('/sub_pages/supplier/supplier-info/supplier-info',true)">
                <view class="title">店铺信息</view>
                <view class="right-icon">
@@ -388,7 +403,10 @@
            </view> -->
            <view class="user-util m-t-12 flex"
             v-if="selftype==='supplier'||selftype==='partner'"
             v-if="
                (selftype==='supplier' && $hasPermission('supplier:mine:edit:password') )
                || (selftype==='partner' && $hasPermission('partner:mine:edit:password'))
             "
             @click="goto('/pages/user/user-pwd/user-pwd',true)">
                <view class="title">修改密码</view>
                <view class="right-icon">
@@ -402,7 +420,10 @@
                    <uni-icons type="right"></uni-icons>
                </view>
            </view> -->
            <view class="user-util m-t-12 flex" v-if="currentInfo&&currentInfo.id &&(selftype==='supplier'||selftype==='partner') "
            <view class="user-util m-t-12 flex" v-if="
                currentInfo&&currentInfo.id &&
                ((selftype==='supplier' &&  $hasPermission('supplier:mine:bind:wechat') )
                ||(selftype==='partner') &&  $hasPermission('partner:mine:bind:wechat') ) "
                @click="goto('/pages/user/user-bind-wx/user-bind-wx',true)">
                <view class="title">绑定当前微信</view>
                <view class="right-icon">
@@ -418,7 +439,9 @@
            <!-- v-if="selftype==='customer'" -->
            <view class="user-util m-t-12 flex"
              v-if="selftype==='supplier'||selftype==='partner'"
              v-if="
                  (selftype==='supplier' && $hasPermission('supplier:mine:logout')) ||
                (selftype==='partner' &&  $hasPermission('partner:mine:logout')) "
             @click="clearlogout">
                <view class="title">退出登录</view>
                <view class="right-icon">
store/index.js
@@ -19,6 +19,7 @@
        leftWinActive: '/pages/component/view/view',
        activeOpen: '',
        menu: [],
        appMenu: [],
        univerifyErrorMsg: '',
        currentInfo: {}, //个人用户信息
        cache_address: {},
@@ -61,7 +62,9 @@
            state.hasLogin = false
            state.openid = null
            state.currentInfo = {}
            state.appMenu=[]
            storage.removeItem('token')
            storage.removeItem('appMenu');
            message.showToast('退出登录成功')
        },
@@ -196,6 +199,7 @@
        }) {
            //把权限获取到
            // console.log('getCurrentInfo,getCurrentInfo')
            const currentInfo = await http.request('get', '/api/current/user', {})
            if (currentInfo && currentInfo.code == 0) {
                // state.cMenu = cMenu
@@ -212,6 +216,80 @@
                //这种情况就是要跳转到登录页面
            }
        },
        getSwitchSubAccount: async function({commit,state},payload) {
            //把权限获取到
            // console.log('getCurrentInfo,getCurrentInfo')
            const currentInfo = await http.request('get', '/api/supplierSub/getSwitchById', {
                params: {
                    id:payload.id
                }
            })
            if (currentInfo && currentInfo.code == 0) {
                state.currentInfo = currentInfo.data || {}
                state.type = currentInfo.data.type || ''
                state.spacecode = currentInfo.data.spacecode || ''
                commit("updateLogin", true)
            } else {
                commit("updateLogin", false)
                //这种情况就是要跳转到登录页面
            }
            return currentInfo;
        },
        getAppMenu: async function({
            commit,
            state
        }) {
            //把权限获取到
            const menu = await http.request('get', '/api/app/menu/permission/menu', {})
            storage.setItem('appMenu', []);
            if (menu && menu.code == 0) {
                const appMenu = menu.data || []
                storage.setItem('appMenu', appMenu);
                // commit("updateLogin", true)
            } else {
                // commit("updateLogin", false)
                //这种情况就是要跳转到登录页面
            }
        },
        getAppMenuSupplier: async function({
            commit,
            state
        }) {
            //把权限获取到
            const menu = await http.request('get', '/api/app/menu/supplier/permission/menu', {})
            storage.setItem('appMenu', []);
            if (menu && menu.code == 0) {
                const appMenu = menu.data || []
                storage.setItem('appMenu', appMenu);
            } else {
            }
        },
        getAppMenuPartner: async function({
            commit,
            state
        }) {
            //把权限获取到
            const menu = await http.request('get', '/api/app/menu/partner/permission/menu', {})
            storage.setItem('appMenu', []);
            if (menu && menu.code == 0) {
                const appMenu = menu.data || []
                storage.setItem('appMenu', appMenu);
            } else {
            }
        },
        loginwx: async function({
            dispatch,
            commit,
@@ -302,6 +380,8 @@
                    storage.setItem('token', resp.data.access_token)
                    commit("updateLogin", true)
                    await dispatch('getCurrentInfo')
                    // 获取所有权限菜单
                    await dispatch('getAppMenuPartner')
                    uni.reLaunch({
                        url: '/pages/home/supplier-home'
                    })
@@ -367,6 +447,8 @@
                    storage.setItem('token', resp.data.access_token)
                    commit("updateLogin", true)
                    await dispatch('getCurrentInfo')
                    // 获取所有供应商权限菜单
                    await dispatch('getAppMenuSupplier')
                    console.log('login,reLaunch')
                    // #ifdef APP
sub_pages/supplier/sub-account/sub-account-list.vue
对比新文件
@@ -0,0 +1,177 @@
<template>
    <view class="u-page">
      <view class="u-demo-block-2">
        <u-cell-group>
          <u-cell v-for="(item, index) in list" :key="index"
        >
            <view slot="icon" class="f10">
              <u-icon name="account"></u-icon>
            </view>
            <view slot="title" class="cell-title">{{ item.name }}</view>
            <view slot="label" class="cell-lable">{{ item.contact }} {{ item.phone }}</view>
            <view slot="value" class="cell-value" >
              <u-icon name="edit-pen" @click="handleEdit(item)"></u-icon>
              <u-icon name="trash"  @click="handleDel(item)"></u-icon>
            </view>
          </u-cell>
        </u-cell-group>
        <u-button type="primary" text="新增" customStyle="margin-top: 50px; width:100%;" @click="handleAdd"></u-button>
      </view>
    </view>
</template>
  <script>
  export default {
    data() {
      return {
          listApi:'/api/supplierSub/sub/all',
      };
    },
    onLoad(options) {},
    onShow() {
      this.getList();
    },
    async onPullDownRefresh() {
      this.getList();
    },
    methods: {
        handleEdit(item) {
            uni.navigateTo({
                url: `/sub_pages/supplier/sub-account/sub-account-reg?id=${item.id}`
            })
        },
        async handleDel(item) {
            await this.$message.confirm('确定要删除吗?')
            const {
                code
            } = await this.$http.request('post', `/api/supplierSub/delete/${item.id}`, {
                data: {
                }
            })
            if (code == 0) {
                uni.$u.toast('删除成功');
                this.getList();
            } else {
            }
        },
        handleAdd() {
            uni.navigateTo({
                url: '/sub_pages/supplier/sub-account/sub-account-reg'
            })
        },
    //   getList(refresh = false) {
    //     // /api/supplier/delivery
    //     if (this.currentInfo.id && (this.currentInfo.id !== this.cacheUserId || refresh)) {
    //       this.cacheUserId = this.currentInfo.id;
    //       let that = this;
    //       setTimeout(() => {
    //         //其他统计
    //         // #ifdef PUB_SUPPLIER
    //         this.$http.request('get', '/v2/wallet/supplier', {}).then(res => {
    //           if (res.code === 0) {
    //             that.wallet = res.data || {};
    //           }
    //         });
    //         // #endif
    //       }, 200);
    //     }
    //   }
    }
  };
  </script>
  <style lang="scss">
  .u-page {
    font-size: 14px;
    .image-icon {
      width: 30rpx;
      height: 30rpx;
    }
    .u-button--plain.data-v-3bf2dba7 {
      background-color: #00BCD4 !important;
    }
    .u-button--plain.u-button--primary.data-v-3bf2dba7 {
      color: #FFFFFF;
    }
    .u-button--primary.data-v-3bf2dba7 {
      color: #fff;
      border-color: #00BCD4 !important;
      border-width: 1px;
      border-style: solid;
      border-radius: 10rpx;
      width: 200rpx;
    }
    .u-demo-block {
      padding: 10rpx;
      background-color: #FFFFFF;
      border-radius: 50rpx;
      background-color: #00AF68;
      margin: 20rpx;
      .tixian {
        margin-top: 30rpx;
        margin-bottom: 30rpx;
      }
    }
    .u-demo-block-2 {
      margin: 30rpx;
      padding: 10rpx;
      background-color: #FFFFFF;
      border-radius: 10rpx;
    }
    .title {
      text-align: center;
      font-size: 30rpx;
      color: #909399;
      margin: 10rpx;
    }
    .grid-text-white {
      color: white;
    }
    .grid-text {
      font-size: 14px;
      color: #909399;
      padding: 10rpx 0 20rpx 0rpx;
      /* #ifndef APP-PLUS */
      box-sizing: border-box;
      /* #endif */
    }
    .statis_val {
      font-size: 16px;
      color: black;
      // font-weight: bold;
    }
    .margin-10 {
      margin: 10rpx;
    }
    .cell-title{
        font-size: 12px;
    }
    .cell-lable{
        font-size: 10px;
        color: gray;
    }
    .cell-value{
        display: flex;
        justify-content: space-between;
        width: 50px;
    }
  }
  </style>
sub_pages/supplier/sub-account/sub-account-reg.vue
对比新文件
@@ -0,0 +1,382 @@
<template>
    <view class="u-page">
        <view class="u-demo-block">
            <view class="u-demo-block__content">
                <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
                <u--form labelPosition="left" :rules="rules" :model="userInfo" ref="subAccountForm"
                    :labelWidth="labelWidth">
                    <u-form-item required label="子账号名称" prop="name" borderBottom>
                        <u--input v-model="userInfo.name" border="none" placeholder="请输入子账号名称" clearable></u--input>
                    </u-form-item>
                    <u-form-item required label="联系人" prop="contact" borderBottom>
                        <u--input v-model="userInfo.contact" border="none" placeholder="请输入联系人" clearable></u--input>
                    </u-form-item>
                    <u-form-item required label="手机" prop="phone" borderBottom>
                        <u--input type="number" v-model="userInfo.phone" border="none" placeholder="请输入手机号码" clearable></u--input>
                    </u-form-item>
                    <u-form-item required label="验证码" prop="smsCode" borderBottom>
                        <u--input type="number" v-model="userInfo.smsCode" border="none" placeholder="请填写验证码" clearable></u--input>
                        <u-button slot="right" @tap="getCode" :text="tips" type="success" size="mini"
                            :disabled="disabled1"></u-button>
                    </u-form-item>
                    <u-form-item required label="密码" prop="password" borderBottom>
                        <u--input type="password" v-model="userInfo.password" border="none" placeholder="请输入密码" clearable></u--input>
                    </u-form-item>
                    <u-form-item required label="账号状态" prop="isEnabled" borderBottom>
                        <u-switch v-model="userInfo.isEnabled" size="50"></u-switch>
                    </u-form-item>
                </u--form>
                <u-button type="primary" text="提交" customStyle="margin-top: 50px" @click="submit"></u-button>
                <u-button type="error" text="重置" customStyle="margin-top: 10px" @click="reset"></u-button>
            </view>
        </view>
    </view>
</template>
<script>
export default {
    data() {
        return {
            labelWidth: '180',
            tips: '获取验证码',
            disabled1: false,// 校验是否禁用
            timer: null, // 倒计时计时器
            count:60,
            // #ifdef PUB_SUPPLIER
            apitype: 'supplier',
            // #endif
            // #ifdef PUB_PARTNER
            apitype: 'partner',
            // #endif
            // #ifdef PUB_CUSTOMER
            apitype: 'customer',
            // #endif
            userInfo: {
                id: '',
                name: '',
                contact: '',
                phone: '',
                smsCode: '',
                password: '',
                isEnabled: true,
            },
            rules: {
                'name': [{
                    type: 'string',
                    required: true,
                    message: '请输入子账号名称',
                    trigger: ['blur', 'change']
                }
                    // , {
                    //     validator: (rule, value, callback) => {
                    //         return uni.$u.test.chinese(value);
                    //     },
                    //     message: "姓名必须为中文",
                    //     trigger: ["change", "blur"],
                    // }
                ],
                'contact': {
                    type: 'string',
                    required: true,
                    message: '请输入联系人',
                    trigger: ['blur', 'change']
                },
                'phone': [{
                    type: 'string',
                    required: true,
                    message: '请输入电话号码',
                    trigger: ['blur', 'change']
                }, {
                    pattern: /^1[3-9]\d{9}$/,
                    message: '请输入有效的手机号码',
                    trigger: ['blur', 'change'],
                },
                ],
                'smsCode': {
                    type: 'string',
                    required: true,
                    message: '请输入验证码',
                    trigger: ['blur', 'change']
                },
                'password': [{
                    type: 'string',
                    required: true,
                    message: '请输入密码',
                    trigger: ['blur', 'change']
                },
                {
                    validator: (rule, value, callback) => {
                        if (!value) {
                            callback(new Error('请输入密码'));
                        } else if (value.length < 8 || value.length > 20) {
                            callback(new Error('密码长度需为 8 到 20 位'));
                        } else {
                            callback(); // 校验通过
                        }
                    },
                    trigger: ['blur', 'change']
                },
                ]
            },
        }
    },
    onReady() {
        // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
        this.$refs.subAccountForm.setRules(this.rules)
    },
    onUnload() {
        // 组件销毁时清除计时器
        if (this.timer) {
            clearInterval(this.timer);
        }
    },
    onLoad(options) {
        this.userInfo.id = options.id || ''
        if(this.userInfo.id){
            this.getSubAccount()
            // 修改topbar标题
            uni.setNavigationBarTitle({
                title: '子账号修改'
            });
        }
    },
    onShow() {
      this.getList();
    },
    methods: {
        async getSubAccount(){
            const {
                code,data
            } = await this.$http.request('get', '/api/supplierSub/getById', {
                params: {
                    id:this.userInfo.id
                }
            })
            if (code == 0) {
                this.userInfo = {
                    ...data
                }
                this.userInfo.password=''
            } else {
            }
        },
        validatePhone(phone) {
            const phoneRegex = /^[1][3-9]\d{9}$/; // 简单的中国大陆手机号正则
            return phoneRegex.test(phone);
        },
        async getCode() {
            // 校验手机号格式
            if (!this.validatePhone(this.userInfo.phone)) {
                uni.showToast({
                    title: '请输入有效的手机号码',
                    icon: 'none'
                });
                return;
            }
            if (this.disabled1) return; // 防止重复点击
            const {
                code
            } = await this.$http.request('post', '/api/sms/send/code', {
                data: {
                    tel: this.userInfo.phone,
                    userType: this.apitype.toLowerCase()
                }
            })
            if (code == 0) {
                uni.$u.toast('验证码已发送');
                this.startCountdown(); // 开始倒计时
            } else {
            }
        },
        startCountdown() {
            this.disabled1 = true; // 禁用按钮
            this.tips = `${this.count}秒后重试`; // 设置按钮文本
            this.timer = setInterval(() => {
                if (this.count > 1) {
                    this.count--;
                    this.tips = `${this.count}秒后重试`;
                } else {
                    this.resetCountdown(); // 倒计时结束,重置状态
                }
            }, 1000);
        },
        resetCountdown() {
            clearInterval(this.timer); // 清除计时器
            this.timer = null;
            this.count = 60; // 重置秒数
            this.tips = '获取验证码'; // 重置按钮文本
            this.disabled1 = false; // 启用按钮
        },
        submit() {
            // 如果有错误,会在catch中返回报错信息数组,校验通过则在then中返回true
                this.$refs.subAccountForm.validate().then(async res => {
                    uni.$u.toast('校验通过')
                    const {
                    code
                } = await this.$http.request('post', '/api/supplierSub/addOrUpdate', {
                    data: {
                        ... this.userInfo
                    }
                })
                if (code == 0) {
                    uni.$u.toast('新增子账号成功');
                    uni.navigateTo({
                        url: '/sub_pages/supplier/sub-account/sub-account-list'
                    })
                } else {
                    uni.$u.toast('新增子账号失败')
                }
            }).catch(errors => {
                uni.$u.toast('请填写完整信息')
            })
        },
        reset() {
            this.$refs.subAccountForm.resetFields()
            this.$refs.subAccountForm.clearValidate()
            this.userInfo={
                id: '',
                name: '',
                contact: '',
                phone: '',
                smsCode: '',
                password: '',
                isEnabled: true,
            }
        },
    },
}
</script>
<style lang="scss">
.u-page {
    background-color: #f7f8fa;
    fonst-size: 14px;
    padding: 15px 15px 40px 15px;
    .u-demo-block {
        flex: 1;
        margin-bottom: 23px
    }
}
.u-page2 {
    background-color: #f7f8fa;
    padding: 15px 15px 40px 15px;
    .u-demo-block {
        flex: 1;
        margin-bottom: 23px
    }
    .u-demo-block__title {
        font-size: 14px;
        color: #8f9ca2;
        margin-bottom: 8px;
        display: flex;
        flex-direction: row
    }
    .u-demo-block__content {
        display: flex;
        flex-direction: column
    }
    .image-icon {
        width: 30rpx;
        height: 30rpx;
    }
    .u-button--plain.data-v-3bf2dba7 {
        background-color: #00BCD4 !important;
    }
    .u-button--plain.u-button--primary.data-v-3bf2dba7 {
        color: #FFFFFF;
    }
    .u-button--primary.data-v-3bf2dba7 {
        color: #fff;
        border-color: #00BCD4 !important;
        border-width: 1px;
        border-style: solid;
        border-radius: 10rpx;
        width: 200rpx;
    }
    .u-demo-block {
        padding: 10rpx;
        background-color: #FFFFFF;
        border-radius: 50rpx;
        background-color: #00AF68;
        margin: 20rpx;
        .tixian {
            margin-top: 30rpx;
            margin-bottom: 30rpx;
        }
    }
    .u-demo-block-2 {
        margin: 30rpx;
        padding: 10rpx;
        background-color: #FFFFFF;
        border-radius: 10rpx;
    }
    .title {
        text-align: center;
        font-size: 30rpx;
        color: #909399;
        margin: 10rpx;
    }
    .grid-text-white {
        color: white;
    }
    .grid-text {
        font-size: 14px;
        color: #909399;
        padding: 10rpx 0 20rpx 0rpx;
        /* #ifndef APP-PLUS */
        box-sizing: border-box;
        /* #endif */
    }
    .statis_val {
        font-size: 16px;
        color: black;
        // font-weight: bold;
    }
    .margin-10 {
        margin: 10rpx;
    }
}
</style>
sub_pages/supplier/sub-account/sub-account-switch-list.vue
对比新文件
@@ -0,0 +1,165 @@
<template>
    <view class="u-page">
        <view class="u-demo-block-2">
            <u-radio-group v-model="curSubAccount" placement="column">
                <u-cell-group>
                    <u-cell v-for="(item, index) in list" :key="index" @click="handleSwitchSubAccount(item)">
                        <view slot="icon" class="f10">
                            <!-- <image src="https://hmy-flower.oss-cn-shanghai.aliyuncs.com/56/56d1a93862a4470e9b4481b970fd6fc9子账号管理.png" class="image-icon"></image> -->
                            <u-radio  :key="index"
                                :name="item.id" @change="handleSwitchSubAccount(item)"
                                >
                                <u-icon name="account"></u-icon>
                            </u-radio>
                        </view>
                        <view slot="title" class="cell-title">{{ item.name }} {{ item.contact }} {{ item.phone }}</view>
                        <!-- <view slot="label" class="cell-lable">{{ item.name2 }} {{ item.tel }}</view> -->
                        <view slot="value" class="cell-value">
                        </view>
                    </u-cell>
                </u-cell-group>
            </u-radio-group>
        </view>
    </view>
</template>
<script>
export default {
    data() {
        return {
            curSubAccount:'',
            listApi:'/api/supplierSub/sub/all',
        };
    },
    onLoad(options) {
        this.getCurrentSubAccount()
    },
    onShow() {
        this.getList();
    },
    async onPullDownRefresh() {
        this.getList();
    },
    methods: {
        getCurrentSubAccount(){
            const currentInfo = this.$store.state.currentInfo
            this.curSubAccount=currentInfo?.supplierSub?.id
        },
        async handleSwitchSubAccount(item) {
            let res=await this.$store.dispatch('getSwitchSubAccount',item);
            if (res && res.code == 0) {
                const data=res.data
                if(data&&data.supplierSub&&data.supplierSub.id){
                    this.curSubAccount=data?.supplierSub?.id
                    uni.$u.toast('切换成功!');
                }
                uni.navigateBack({ delta: 1 })
            } else {
                uni.$u.toast('切换失败!');
            }
        },
    }
};
</script>
<style lang="scss">
.u-page {
    font-size: 14px;
    .image-icon {
        width: 30rpx;
        height: 30rpx;
    }
    .u-button--plain.data-v-3bf2dba7 {
        background-color: #00BCD4 !important;
    }
    .u-button--plain.u-button--primary.data-v-3bf2dba7 {
        color: #FFFFFF;
    }
    .u-button--primary.data-v-3bf2dba7 {
        color: #fff;
        border-color: #00BCD4 !important;
        border-width: 1px;
        border-style: solid;
        border-radius: 10rpx;
        width: 200rpx;
    }
    .u-demo-block {
        padding: 10rpx;
        background-color: #FFFFFF;
        border-radius: 50rpx;
        background-color: #00AF68;
        margin: 20rpx;
        .tixian {
            margin-top: 30rpx;
            margin-bottom: 30rpx;
        }
    }
    .u-demo-block-2 {
        margin: 30rpx;
        padding: 10rpx;
        background-color: #FFFFFF;
        border-radius: 10rpx;
    }
    .title {
        text-align: center;
        font-size: 30rpx;
        color: #909399;
        margin: 10rpx;
    }
    .grid-text-white {
        color: white;
    }
    .grid-text {
        font-size: 14px;
        color: #909399;
        padding: 10rpx 0 20rpx 0rpx;
        /* #ifndef APP-PLUS */
        box-sizing: border-box;
        /* #endif */
    }
    .statis_val {
        font-size: 16px;
        color: black;
        // font-weight: bold;
    }
    .margin-10 {
        margin: 10rpx;
    }
    .cell-title {
        font-size: 12px;
    }
    .cell-lable {
        font-size: 10px;
        color: gray;
    }
    .cell-value {
        display: flex;
        justify-content: space-between;
        width: 50px;
    }
}
</style>