1***@qq.com
1***@qq.com
  • 发布:2023-05-26 15:38
  • 更新:2023-05-26 17:11
  • 阅读:126

【报Bug】ios,安卓渲染出错,pcH5显示正常

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.7.11

手机系统: iOS

手机系统版本号: iOS 16

手机厂商: 苹果

手机机型: iphone8 plus

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template> <view class="content_warp_n overflow-hidden pb45"> <u-form :model="form" ref="uForm" :error-type="['border-bottom', 'toast']" :label-width='160'> <view class="u-p-l-30 u-p-r-30 bg_fff"> <u-form-item label="合同编号" prop="contract_no" v-if="form.id"> <u-input input-align='right' v-model="form.contract_no" placeholder="合同产生时生成 " type="text" disabled /> </u-form-item> <u-form-item label="终端用户" prop="farm_name" right-icon='arrow-right'> <u-input input-align='right' v-model="form.farm_name" disabled placeholder="请选择终端用户 " type="text" @click="chooseFarmer()" /> </u-form-item> <u-form-item label="客户名称" prop="custom_name" right-icon='arrow-right'> <u-input input-align='right' v-model="form.custom_name" @click="chooseCustom()" placeholder="请选择" type="text" disabled /> </u-form-item> <u-form-item label="付款方式"> <u-input type="select" input-align='right' :select-open="collectionVisible" v-model="form.collection_name" placeholder="请选择付款方式" @click="chooseCollect()" /> </u-form-item> <u-form-item label="收款银行"> <u-input type="select" input-align='right' :select-open="bankVisible" v-model="form.bank_name" placeholder="请选择收款银行" @click="chooseBank()" disabled /> </u-form-item> <u-form-item label="收款日期" required prop="return_date"> <u-input input-align='right' type="select" :select-open="return_dateVisible" v-model="form.return_date" placeholder="请输入收款日期" @click="chooseReturnDete()" /> </u-form-item> <u-form-item label="付款人"> <u-input input-align='right' v-model="form.collection_user_name" placeholder="请输入付款人" type="text" disabled /> </u-form-item> <!-- <u-form-item label="退款账号" prop="account_no"> <u-input :key='item.column_code' input-align='right' placeholder="请输入退款账号" v-model="form.account_no" clearable /> </u-form-item> --> <view class="u-flex "> <view class="flex-1" style="padding-right: 30upx;"> <u-form-item label="总台数" prop="deposit_name"> <u-input input-align='right' :value="list.length" placeholder=" " type="text" disabled /> </u-form-item> </view> <u-button type='primary' disabled @click='addRow' size='mini'> <u-icon name='plus'></u-icon> </u-button> <view class="flex-1" style="padding-left: 40upx;"> <u-form-item label="总金金额" prop="deposit" :label-width='130'> <view class="u-text-right color_fd9501 flex-1">{{ total_deposit }}</view> </u-form-item> </view> </view> <!-- 新增施肥机 押金 列表 start --> <view class="u-p-l-30 u-relative u-m-t-30 u-p-r-30 bg_fff pointer-events" v-for="(item, index) in list" key='index'> <view v-if="list.length > 1" @click='delFun(item, index)'
style="position: absolute;right:10upx; top:-20upx">
<u-icon size='50' color='#666' name='close-circle'></u-icon>
</view>
<u-form-item label="施肥机型号" prop="fertilizer_machine_type_name" right-icon='arrow-right'>
<u-input input-align='right' v-model="item.fertilizer_machine_type_name"
@click='machineVisible = true; current = item' placeholder="请选择施肥机" type="text" disabled />
</u-form-item>
<u-form-item label="租金" prop="money">
<u-input input-align='right' v-model="item.money" placeholder="请选择施肥机" type="text" disabled />
</u-form-item>
<u-form-item label="施肥机编号" prop="fertilizer_machine_code">
<u-input input-align='right' disabled v-model="item.fertilizer_machine_code" placeholder=""
type="text" />
</u-form-item>
</view>
<!-- 新增施肥机 押金 列表 end -->
</view>
<view class="u-m-t-30 u-p-l-30 u-p-r-30 bg_fff">
<u-form-item label="回款单"></u-form-item>
<u-form-item :border-bottom="false" prop="img_url" label-width="150" v-if="fileList.length > 0">
<scroll-view scroll-x style="width: 690upx;white-space: nowrap; margin-top: 10px;">
<view style="display: inline-block;" :key='index' v-for='(item, index) in fileList'>
<u-image width="200upx" height="200upx" @click="previewImage(fileList, index)" :src="item.url"

lazy-load="true"></u-image> </view>
</scroll-view>
</u-form-item>

    </view>  
    <view class="u-m-t-30 u-p-l-30 u-p-r-30  bg_fff">  
        <u-form-item label="备注"></u-form-item>  
        <u-form-item :border-bottom="false" prop="note">  
            <u-input type="textarea" disabled placeholder="备注" v-model="form.note" />  
        </u-form-item>  
    </view>  
    <!--    <view class="u-fixed foot-fixed">  
        <u-button type="primary" :loading='submitLoading' @click="submitForm(1)" :throttle-time='500'>确认提交  
        </u-button>  
    </view> -->  
</u-form>  
<!--施肥机类型   -->  
<u-select mode="single-column" :list="machineList" value-name='id' label-name='name' v-model="machineVisible"  
    @confirm="selectConfirm($event, 'fertilizer_machine_type_name', 'fertilizer_machine_type_id', 'machineList')">  
</u-select>  
<!-- 付款日期 -->  
<u-picker mode="time" v-model="return_dateVisible" @confirm='selectConfirmDate($event)'></u-picker>  
<!--付款方式 -->  
<u-select mode="single-column" :list="collectionList" value-name='value' label-name='text'  
    v-model="collectionVisible"  
    @confirm="selectConfirm($event, 'collection_name', 'collection_id', 'collectionList')"></u-select>  
<!-- 收款银行 -->  
<u-select mode="single-column" :list="bankList" value-name='value' label-name='text' v-model="bankVisible"  
    @confirm="selectConfirm($event, 'bank_name', 'bank_id', 'bankList')"></u-select>  
<!-- 部门 -->  
<!-- <u-select mode="single-column" value-name='id' label-name='dept_name' :list="dept_show" v-model="deptVisible" @confirm="multSelectConfirm($event,'dept_name','dept_id')"></u-select> -->  

</view>
</template>

<script>
export default {
data() {
return {
source_id: '',
machineVisible: false, //施肥机类型
list: [], //押金单列表
machineList: [],
//=========================
editId: '',
userVisible: false,
form: {
id: '',
user_id: "",
custom_id: '',
custom_name: '',
invoce_cust_id: "",
invoce_cust_name: '',
collection_id: '',
collection_name: '',
bank_id: "",
bank_name: "",
collection_user_name: "",
// account_no: '',
return_date: '',
note: '',
img_url: '',
invoice_status: '',
area_id: '',
area_name: '',
dept_id: '',
terminal_type: 'app',
},
bankList: [], //银行
bankVisible: false,
return_dateVisible: false,
collectionList: [], //付款方式
collectionVisible: false,
deptList: [], //部门
deptVisible: false,
fileList: [], //回单
currentItem: {},
customer: {},
addVisible: true,
areaVisible: false,
submitLoading: false,
money: 0,
action: '',
delta: 1,
payRules: {
return_date: [{
required: true,
message: '请选择收款日期',
trigger: 'blur,change,'
}],
},
editData: [],
topButton: false
}
},
computed: {
//统计总押金
total_deposit() {
return this.list.reduce((a, b) => a + (+b.money || 0), 0).toFixed(2)
}
},
methods: {
onRemove(index, lists, name) {
this.fileList = lists;
},
previewImage(arr, index) {
let list = []
arr.forEach(i => {
list.push(i.url)
})
uni.previewImage({
urls: list,
current: index
})
},
async getDatedetails() {
if (!this.editId) return;
this.topButton = true
//详情sale_bizreturndeposit_detail //sale_moneyback_detail
let res = await this.$u.api.sale_bizreturndeposit_detail({
id: this.editId
});
if (res.code === 0) {
this.cash_status = res.data.invoice_status
if (this.cash_status == '2') {
//如果押金已确认,隐藏按钮
// #ifdef H5
setTimeout(() => {
let t = document.getElementsByTagName("uni-page")[0].getElementsByClassName('uni-page-head-ft')[0].getElementsByClassName('uni-page-head-btn')[0];
t = t ? t : document.getElementsByTagName("uni-page")[0].getElementsByClassName('uni-page-head-ft')[1].getElementsByClassName('uni-page-head-btn')[0];
if (t) t.style.display = 'none';
console.log(t);
}, 10)
// #endif
// #ifdef APP-PLUS
let currentWebview = page.$getAppWebview();
currentWebview.setTitleNViewButtonStyle(index, { text: ' ', });
// #endif
this.topButton = false;
}
this.form = res.data;
this.form.id = res.data.id
this.form.custom_id = res.data.custom_id || ''
this.form.custom_name = res.data.custom_name || ''
this.form.invoce_cust_id = res.data.invoce_cust_id || ''
this.form.invoce_cust_name = res.data.invoce_cust_name || ''
this.form.collection_id = res.data.collection_id || ''
this.form.collection_name = res.data.collection_name || ''
this.form.bank_id = res.data.bank_id || ''
this.form.bank_name = res.data.bank_name || ''
this.form.collection_user_name = res.data.collection_user_name || ''
// // this.form.account_no = res.data.account_no
this.form.return_date = res.data.return_date || ''
this.form.note = res.data.note || ''
this.form.invoice_status = res.data.invoice_status || ''
this.list = res.data.detail_list || []
this.fileList = res.data.img_url ? res.data.img_url.split(',').map(i => {
return {
url: i
}
}) : [];
console.log(this.fileList, '===this.fileList')
if (res.data.invoice_status == 0) this.editData = [];
}
},
async getSelectData() {
// this.getDict(1,'payment');//1付款类型2回款银行3款项类型, pre_type 回款类型
let soure = {
1: 'collectionList',
2: 'bankList'
}
const list = await Promise.all([
this.$u.api.admin_dictList({
code: '1,2',
page: 1,
limit: 100
})
])
list.map((i, index) => {
if (index == 0 && i.data) {
for (let m in i.data) {
this[soure[m]] = i.data[m]
}
}
})
},
selectConfirm(e, name, id, list) {
if (e.length < 1) return;
if (id == 'area_id') {
this.form[name] = e[0].area_name;
this.form[id] = e[0].area_id;
return
}
this.form[name] = e[0].label;
this.form[id] = e[0].value;
console.log(e, '=====施肥机类型')
// if (id == 'fertilizer_machine_type_id') this.current.money = (this.machineList.find(i => i.id == e[0].value) || {}).money || 0;
if (id == 'fertilizer_machine_type_id') {
this.current.money = (this.machineList.find(i => i.id == e[0].value) || {}).money || 0;
this.current.fertilizer_machine_type_name = (this.machineList.find(i => i.id == e[0].value) || {}).name || 0;
console.log(this.list)
}
// if (name == 'fertilizer_machine_type_name') {
// let l = this.machineList.filter(i => i[id] == e[0].value);
// this.form.fertilizer_machine_type_id = (l[0] || {}).id || '';
// this.form.fertilizer_machine_type_name = (l[0] || {}).name || '';
// }

    },  
    selectConfirmDate(e) {  
        this.form.return_date = e.year + '-' + e.month + '-' + e.day;  
    },  
    async getMachine() {  
        let res = await this.$u.api.app_lease_fertilizerMachineTypeSelect({}).catch(err => err.data || err);  
        if (res.code != 0) return this.loading = 'loadmore';  
        this.machineList = res.data || [];  
    },  
    /**  
     * 删除列表的施肥机押金单  
     * */  
    delFun(item, index) {  
        this.list.splice(index, 1)  
    },  
    /**  
     * 新增列表的施肥机押金单  
     *   
     * */  
    addRow() {  
        this.list.push({  
            fertilizer_machine_type_id: '', //施肥机类型ID  
            machine_count: '1',  
            fertilizer_machine_code: '', //施肥机编码  
            fertilizer_machine_type_name: '',  
            money: '', //押金  
        })  
    },  
    chooseCollect() {  
        if (this.editId) return this.$u.toast('不可修改付款方式')  
        this.collectionVisible = true  
    },  
    chooseBank() {  
        if (this.editId) return this.$u.toast('不可修改收款银行')  
        this.bankVisible = true  
    },  
    chooseReturnDete() {  
        console.log('111')  
        this.return_dateVisible = true  
    },  
    chooseFarmer() {  
        if (this.editId) return this.$u.toast('不可修改终端用户')  
        this.$u.route({  
            url: '/pages/choose_page/choose_page',  
            params: { index: 0, checked: 1, name: 'farmer' },  
            animationType: 'slide-in-right'  
        })  
    },  
    //选择终端用户  
    chooseFarmerFun(data, param) {  
        console.log(data, '终端用户=====')  
        console.log(data, 'data===')  
        this.form.farmer_id = data.id;  
        this.form.farm_name = data.name  
        console.log(this.form.farmer_id, this.form.farm_name, ' 选中终端用户===')  
    },  
    //============================  
    chooseCustom() {  
        if (this.editId) return this.$u.toast('不可修改客户')  
        this.$u.route({  
            url: '/pages/choose_page/choose_page',  
            params: {  
                come: 'payback_edit',  
                is_new: 1,  
                type: 3,  
                name: 'customer',  
                index: 1  
            },  
            animationType: 'slide-in-right'  
        })  
    },  
    multSelectConfirm(e, name, id) {  
        this.currentItem[name] = e[0].label, this.currentItem[id] = e[0].value;  
    },  
    async delview() {  
        let res = await this.$u.api.sale_bizreturndeposit_delete({ ids: this.editId.split(',') }).catch(err => err.data || err);  
        if (res.code != 0) return this.$u.toast('删除失败!');  
        this.$u.toast('删除成功!');  
        uni.navigateBack({  
            delta: 1  
        });  
    },  
    /**  
     * 押金确认  
     * */  
    async confirm() {  
        if (this.form.return_date == '' || !this.form.return_date) {  
            this.$u.toast('请选择收款日期!');  
            return  
        }  
        // if(this.form.img_url == ''){  
        //  this.$u.toast('请上传附件!');  
        //  return  
        // }  
        let json = {  
            id: this.editId,  
            return_date: this.form.return_date,  
            // img_url:this.form.img_url  
        }  
        let res = await this.$u.api.sale_bizreturndeposit_confirmPay(json).catch(err => err.data || err);  
        if (res.code != 0) return this.$u.toast('确认押金失败!');  
        this.$u.toast('确认押金成功!');  
        uni.navigateBack({  
            delta: 1  
        });  
    },  
    /**  
     * 新增,提交  
     *   
     * */  
    async formSend(param, val) {  
        this.submitLoading = true;  
        let api = this.editId ? 'sale_bizreturndeposit_update' : 'sale_bizreturndeposit_save';  
        param.money = this.total_deposit; //总押金  
        if (this.submitLoading) return this.$u.toast('请务重复点击!');  

        let res = await this.$u.api[api](param);  
        if (res.code == 0) this.editId = String(res.data.id);  
        if (val == 1 && res.data && res.data.id) {  
            res = await this.$u.api.sale_moneyback_apply({  
                id: this.editId  
            });  
        }  
        this.$u.submitToast(res, res.msg, this.delta)  
        this.submitLoading = false;  
    },  
    onUploaded(data, indexs, list, index) {  
        this.fileList = list;  
        console.log(data, indexs, list, index)  
    },  
    offEvent() {  
        uni.$off('chooseCustomer');  
    },  
    chooseCustomer(data) {  
        console.log('chooseCustomer')  
        this.form.custom_name = data.custom_name;  
        this.form.custom_id = data.id;  
    }  
},  
onReady() {  
    // this.$nextTick(() => {  
    //  console.log(this.payRules)  
    //  this.$refs.uForm.setRules(this.payRules)  
    // })  
},  
async onLoad(e) {  
    this.getMachine()  
    if (e) {  
        this.editId = e.id;  
    }  
    this.form.return_date = this.utils.getDate();  
    await this.getSelectData();  
    await this.getDatedetails();  
    if (this.editId) this.delta = 2;  
    uni.$on('chooseCustomer', this.chooseCustomer)  
    uni.$on('chooseFarmer', this.chooseFarmerFun)  
},  
onBackPress() {  
    this.offEvent()  
},  
onUnload() {  
    this.offEvent()  
},  
onNavigationBarButtonTap() {  
    if (!this.topButton) return;  
    let self = this;  
    uni.showActionSheet({  
        //    itemList:['确认','删除'],  
        itemList: this.source_id == '' ? ['确认', '删除'] : ['确认'],  
        success: e => {  
            if (e.tapIndex == 0) {  
                // uni.navigateTo({  
                //  url:'/pages/cashPledge/cash_edit?id='+self.editId  
                // })  
                self.confirm()  
            }  
            if (e.tapIndex == 1) {  
                self.delview()  
            }  
        }  
    });  
},  

}
</script>

<style scoped>
.tr .td input {
font-size: 26upx;
}

.pointer-events {
pointer-events: none;
/禁止触发事件/
}</style>

操作步骤:
    <view class="content_warp_n overflow-hidden pb45">  
        <u-form :model="form" ref="uForm" :error-type="['border-bottom', 'toast']" :label-width='160'>  
            <view class="u-p-l-30 u-p-r-30 bg_fff">  
                <u-form-item label="合同编号" prop="contract_no" v-if="form.id">  
                    <u-input input-align='right' v-model="form.contract_no" placeholder="合同产生时生成 " type="text" disabled />  
                </u-form-item>  
                <u-form-item label="终端用户" prop="farm_name" right-icon='arrow-right'>  
                    <u-input input-align='right' v-model="form.farm_name" disabled placeholder="请选择终端用户 " type="text"  
                        @click="chooseFarmer()" />  
                </u-form-item>  
                <u-form-item label="客户名称" prop="custom_name" right-icon='arrow-right'>  
                    <u-input input-align='right' v-model="form.custom_name" @click="chooseCustom()" placeholder="请选择"  
                        type="text" disabled />  
                </u-form-item>  
                <u-form-item label="付款方式">  
                    <u-input type="select" input-align='right' :select-open="collectionVisible"  
                        v-model="form.collection_name" placeholder="请选择付款方式" @click="chooseCollect()" />  
                </u-form-item>  
                <u-form-item label="收款银行">  
                    <u-input type="select" input-align='right' :select-open="bankVisible" v-model="form.bank_name"  
                        placeholder="请选择收款银行" @click="chooseBank()" disabled />  
                </u-form-item>  
                <u-form-item label="收款日期" required prop="return_date">  
                    <u-input input-align='right' type="select" :select-open="return_dateVisible" v-model="form.return_date"  
                        placeholder="请输入收款日期" @click="chooseReturnDete()" />  
                </u-form-item>  
                <u-form-item label="付款人">  
                    <u-input input-align='right' v-model="form.collection_user_name" placeholder="请输入付款人" type="text"  
                        disabled />  
                </u-form-item>  
                <!--    <u-form-item label="退款账号"   prop="account_no">   
                        <u-input :key='item.column_code' input-align='right' placeholder="请输入退款账号"  
                            v-model="form.account_no" clearable />   
                    </u-form-item> -->  
                <view class="u-flex ">  
                    <view class="flex-1" style="padding-right: 30upx;">  
                        <u-form-item label="总台数" prop="deposit_name">  
                            <u-input input-align='right' :value="list.length" placeholder=" " type="text" disabled />  
                        </u-form-item>  
                    </view>  
                    <u-button type='primary' disabled @click='addRow' size='mini'>  
                        <u-icon name='plus'></u-icon>  
                    </u-button>  
                    <view class="flex-1" style="padding-left: 40upx;">  
                        <u-form-item label="总金金额" prop="deposit" :label-width='130'>  
                            <view class="u-text-right color_fd9501 flex-1">{{ total_deposit }}</view>  
                        </u-form-item>  
                    </view>  
                </view>  
                <!-- 新增施肥机 押金 列表 start -->  
                <view class="u-p-l-30 u-relative u-m-t-30 u-p-r-30 bg_fff pointer-events" v-for="(item, index) in list"  
                    :key='index'>  
                    <view v-if="list.length > 1" @click='delFun(item, index)'  
                        style="position: absolute;right:10upx; top:-20upx">  
                        <u-icon size='50' color='#666' name='close-circle'></u-icon>  
                    </view>  
                    <u-form-item label="施肥机型号" prop="fertilizer_machine_type_name" right-icon='arrow-right'>  
                        <u-input input-align='right' v-model="item.fertilizer_machine_type_name"  
                            @click='machineVisible = true; current = item' placeholder="请选择施肥机" type="text" disabled />  
                    </u-form-item>  
                    <u-form-item label="租金" prop="money">  
                        <u-input input-align='right' v-model="item.money" placeholder="请选择施肥机" type="text" disabled />  
                    </u-form-item>  
                    <u-form-item label="施肥机编号" prop="fertilizer_machine_code">  
                        <u-input input-align='right' disabled v-model="item.fertilizer_machine_code" placeholder=""  
                            type="text" />  
                    </u-form-item>  
                </view>  
                <!-- 新增施肥机 押金 列表 end -->  
            </view>  
            <view class="u-m-t-30 u-p-l-30 u-p-r-30  bg_fff">  
                <u-form-item label="回款单"></u-form-item>  
                <u-form-item :border-bottom="false" prop="img_url" label-width="150" v-if="fileList.length > 0">  
                    <scroll-view scroll-x style="width: 690upx;white-space: nowrap; margin-top: 10px;">  
                        <view style="display: inline-block;" :key='index' v-for='(item, index) in fileList'>  
                            <u-image width="200upx" height="200upx" @click="previewImage(fileList, index)" :src="item.url"  
                                :lazy-load="true"></u-image>  
                        </view>  
                    </scroll-view>  
                </u-form-item>  

            </view>  
            <view class="u-m-t-30 u-p-l-30 u-p-r-30  bg_fff">  
                <u-form-item label="备注"></u-form-item>  
                <u-form-item :border-bottom="false" prop="note">  
                    <u-input type="textarea" disabled placeholder="备注" v-model="form.note" />  
                </u-form-item>  
            </view>  
            <!--    <view class="u-fixed foot-fixed">  
                <u-button type="primary" :loading='submitLoading' @click="submitForm(1)" :throttle-time='500'>确认提交  
                </u-button>  
            </view> -->  
        </u-form>  
        <!--施肥机类型   -->  
        <u-select mode="single-column" :list="machineList" value-name='id' label-name='name' v-model="machineVisible"  
            @confirm="selectConfirm($event, 'fertilizer_machine_type_name', 'fertilizer_machine_type_id', 'machineList')">  
        </u-select>  
        <!-- 付款日期 -->  
        <u-picker mode="time" v-model="return_dateVisible" @confirm='selectConfirmDate($event)'></u-picker>  
        <!--付款方式 -->  
        <u-select mode="single-column" :list="collectionList" value-name='value' label-name='text'  
            v-model="collectionVisible"  
            @confirm="selectConfirm($event, 'collection_name', 'collection_id', 'collectionList')"></u-select>  
        <!-- 收款银行 -->  
        <u-select mode="single-column" :list="bankList" value-name='value' label-name='text' v-model="bankVisible"  
            @confirm="selectConfirm($event, 'bank_name', 'bank_id', 'bankList')"></u-select>  
        <!-- 部门 -->  
        <!-- <u-select mode="single-column" value-name='id' label-name='dept_name' :list="dept_show" v-model="deptVisible" @confirm="multSelectConfirm($event,'dept_name','dept_id')"></u-select> -->  
    </view>  
</template>  

<script>  
export default {  
    data() {  
        return {  
            source_id: '',  
            machineVisible: false, //施肥机类型  
            list: [], //押金单列表  
            machineList: [],  
            //=========================  
            editId: '',  
            userVisible: false,  
            form: {  
                id: '',  
                user_id: "",  
                custom_id: '',  
                custom_name: '',  
                invoce_cust_id: "",  
                invoce_cust_name: '',  
                collection_id: '',  
                collection_name: '',  
                bank_id: "",  
                bank_name: "",  
                collection_user_name: "",  
                // account_no: '',  
                return_date: '',  
                note: '',  
                img_url: '',  
                invoice_status: '',  
                area_id: '',  
                area_name: '',  
                dept_id: '',  
                terminal_type: 'app',  
            },  
            bankList: [], //银行  
            bankVisible: false,  
            return_dateVisible: false,  
            collectionList: [], //付款方式  
            collectionVisible: false,  
            deptList: [], //部门  
            deptVisible: false,  
            fileList: [], //回单  
            currentItem: {},  
            customer: {},  
            addVisible: true,  
            areaVisible: false,  
            submitLoading: false,  
            money: 0,  
            action: '',  
            delta: 1,  
            payRules: {  
                return_date: [{  
                    required: true,  
                    message: '请选择收款日期',  
                    trigger: 'blur,change,'  
                }],  
            },  
            editData: [],  
            topButton: false  
        }  
    },  
    computed: {  
        //统计总押金  
        total_deposit() {  
            return this.list.reduce((a, b) => a + (+b.money || 0), 0).toFixed(2)  
        }  
    },  
    methods: {  
        onRemove(index, lists, name) {  
            this.fileList = lists;  
        },  
        previewImage(arr, index) {  
            let list = []  
            arr.forEach(i => {  
                list.push(i.url)  
            })  
            uni.previewImage({  
                urls: list,  
                current: index  
            })  
        },  
        async getDatedetails() {  
            if (!this.editId) return;  
            this.topButton = true  
            //详情sale_bizreturndeposit_detail  //sale_moneyback_detail  
            let res = await this.$u.api.sale_bizreturndeposit_detail({  
                id: this.editId  
            });  
            if (res.code === 0) {  
                this.cash_status = res.data.invoice_status  
                if (this.cash_status == '2') {  
                    //如果押金已确认,隐藏按钮  
                    // #ifdef H5  
                    setTimeout(() => {  
                        let t = document.getElementsByTagName("uni-page")[0].getElementsByClassName('uni-page-head-ft')[0].getElementsByClassName('uni-page-head-btn')[0];  
                        t = t ? t : document.getElementsByTagName("uni-page")[0].getElementsByClassName('uni-page-head-ft')[1].getElementsByClassName('uni-page-head-btn')[0];  
                        if (t) t.style.display = 'none';  
                        console.log(t);  
                    }, 10)  
                    // #endif  
                    // #ifdef APP-PLUS  
                    let currentWebview = page.$getAppWebview();  
                    currentWebview.setTitleNViewButtonStyle(index, { text: ' ', });  
                    // #endif  
                    this.topButton = false;  
                }  
                this.form = res.data;  
                this.form.id = res.data.id  
                this.form.custom_id = res.data.custom_id || ''  
                this.form.custom_name = res.data.custom_name || ''  
                this.form.invoce_cust_id = res.data.invoce_cust_id || ''  
                this.form.invoce_cust_name = res.data.invoce_cust_name || ''  
                this.form.collection_id = res.data.collection_id || ''  
                this.form.collection_name = res.data.collection_name || ''  
                this.form.bank_id = res.data.bank_id || ''  
                this.form.bank_name = res.data.bank_name || ''  
                this.form.collection_user_name = res.data.collection_user_name || ''  
                // // this.form.account_no = res.data.account_no  
                this.form.return_date = res.data.return_date || ''  
                this.form.note = res.data.note || ''  
                this.form.invoice_status = res.data.invoice_status || ''  
                this.list = res.data.detail_list || []  
                this.fileList = res.data.img_url ? res.data.img_url.split(',').map(i => {  
                    return {  
                        url: i  
                    }  
                }) : [];  
                console.log(this.fileList, '===this.fileList')  
                if (res.data.invoice_status == 0) this.editData = [];  
            }  
        },  
        async getSelectData() {  
            // this.getDict(1,'payment');//1付款类型2回款银行3款项类型, pre_type 回款类型  
            let soure = {  
                1: 'collectionList',  
                2: 'bankList'  
            }  
            const list = await Promise.all([  
                this.$u.api.admin_dictList({  
                    code: '1,2',  
                    page: 1,  
                    limit: 100  
                })  
            ])  
            list.map((i, index) => {  
                if (index == 0 && i.data) {  
                    for (let m in i.data) {  
                        this[soure[m]] = i.data[m]  
                    }  
                }  
            })  
        },  
        selectConfirm(e, name, id, list) {  
            if (e.length < 1) return;  
            if (id == 'area_id') {  
                this.form[name] = e[0].area_name;  
                this.form[id] = e[0].area_id;  
                return  
            }  
            this.form[name] = e[0].label;  
            this.form[id] = e[0].value;  
            console.log(e, '=====施肥机类型')  
            // if (id == 'fertilizer_machine_type_id') this.current.money = (this.machineList.find(i => i.id == e[0].value) || {}).money || 0;  
            if (id == 'fertilizer_machine_type_id') {  
                this.current.money = (this.machineList.find(i => i.id == e[0].value) || {}).money || 0;  
                this.current.fertilizer_machine_type_name = (this.machineList.find(i => i.id == e[0].value) || {}).name || 0;  
                console.log(this.list)  
            }  
            // if (name == 'fertilizer_machine_type_name') {  
            //  let l = this.machineList.filter(i => i[id] == e[0].value);  
            //  this.form.fertilizer_machine_type_id = (l[0] || {}).id || '';  
            //  this.form.fertilizer_machine_type_name = (l[0] || {}).name || '';  
            // }  

        },  
        selectConfirmDate(e) {  
            this.form.return_date = e.year + '-' + e.month + '-' + e.day;  
        },  
        async getMachine() {  
            let res = await this.$u.api.app_lease_fertilizerMachineTypeSelect({}).catch(err => err.data || err);  
            if (res.code != 0) return this.loading = 'loadmore';  
            this.machineList = res.data || [];  
        },  
        /**  
         * 删除列表的施肥机押金单  
         * */  
        delFun(item, index) {  
            this.list.splice(index, 1)  
        },  
        /**  
         * 新增列表的施肥机押金单  
         *   
         * */  
        addRow() {  
            this.list.push({  
                fertilizer_machine_type_id: '', //施肥机类型ID  
                machine_count: '1',  
                fertilizer_machine_code: '', //施肥机编码  
                fertilizer_machine_type_name: '',  
                money: '', //押金  
            })  
        },  
        chooseCollect() {  
            if (this.editId) return this.$u.toast('不可修改付款方式')  
            this.collectionVisible = true  
        },  
        chooseBank() {  
            if (this.editId) return this.$u.toast('不可修改收款银行')  
            this.bankVisible = true  
        },  
        chooseReturnDete() {  
            console.log('111')  
            this.return_dateVisible = true  
        },  
        chooseFarmer() {  
            if (this.editId) return this.$u.toast('不可修改终端用户')  
            this.$u.route({  
                url: '/pages/choose_page/choose_page',  
                params: { index: 0, checked: 1, name: 'farmer' },  
                animationType: 'slide-in-right'  
            })  
        },  
        //选择终端用户  
        chooseFarmerFun(data, param) {  
            console.log(data, '终端用户=====')  
            console.log(data, 'data===')  
            this.form.farmer_id = data.id;  
            this.form.farm_name = data.name  
            console.log(this.form.farmer_id, this.form.farm_name, ' 选中终端用户===')  
        },  
        //============================  
        chooseCustom() {  
            if (this.editId) return this.$u.toast('不可修改客户')  
            this.$u.route({  
                url: '/pages/choose_page/choose_page',  
                params: {  
                    come: 'payback_edit',  
                    is_new: 1,  
                    type: 3,  
                    name: 'customer',  
                    index: 1  
                },  
                animationType: 'slide-in-right'  
            })  
        },  
        multSelectConfirm(e, name, id) {  
            this.currentItem[name] = e[0].label, this.currentItem[id] = e[0].value;  
        },  
        async delview() {  
            let res = await this.$u.api.sale_bizreturndeposit_delete({ ids: this.editId.split(',') }).catch(err => err.data || err);  
            if (res.code != 0) return this.$u.toast('删除失败!');  
            this.$u.toast('删除成功!');  
            uni.navigateBack({  
                delta: 1  
            });  
        },  
        /**  
         * 押金确认  
         * */  
        async confirm() {  
            if (this.form.return_date == '' || !this.form.return_date) {  
                this.$u.toast('请选择收款日期!');  
                return  
            }  
            // if(this.form.img_url == ''){  
            //  this.$u.toast('请上传附件!');  
            //  return  
            // }  
            let json = {  
                id: this.editId,  
                return_date: this.form.return_date,  
                // img_url:this.form.img_url  
            }  
            let res = await this.$u.api.sale_bizreturndeposit_confirmPay(json).catch(err => err.data || err);  
            if (res.code != 0) return this.$u.toast('确认押金失败!');  
            this.$u.toast('确认押金成功!');  
            uni.navigateBack({  
                delta: 1  
            });  
        },  
        /**  
         * 新增,提交  
         *   
         * */  
        async formSend(param, val) {  
            this.submitLoading = true;  
            let api = this.editId ? 'sale_bizreturndeposit_update' : 'sale_bizreturndeposit_save';  
            param.money = this.total_deposit; //总押金  
            if (this.submitLoading) return this.$u.toast('请务重复点击!');  

            let res = await this.$u.api[api](param);  
            if (res.code == 0) this.editId = String(res.data.id);  
            if (val == 1 && res.data && res.data.id) {  
                res = await this.$u.api.sale_moneyback_apply({  
                    id: this.editId  
                });  
            }  
            this.$u.submitToast(res, res.msg, this.delta)  
            this.submitLoading = false;  
        },  
        onUploaded(data, indexs, list, index) {  
            this.fileList = list;  
            console.log(data, indexs, list, index)  
        },  
        offEvent() {  
            uni.$off('chooseCustomer');  
        },  
        chooseCustomer(data) {  
            console.log('chooseCustomer')  
            this.form.custom_name = data.custom_name;  
            this.form.custom_id = data.id;  
        }  
    },  
    onReady() {  
        // this.$nextTick(() => {  
        //  console.log(this.payRules)  
        //  this.$refs.uForm.setRules(this.payRules)  
        // })  
    },  
    async onLoad(e) {  
        this.getMachine()  
        if (e) {  
            this.editId = e.id;  
        }  
        this.form.return_date = this.utils.getDate();  
        await this.getSelectData();  
        await this.getDatedetails();  
        if (this.editId) this.delta = 2;  
        uni.$on('chooseCustomer', this.chooseCustomer)  
        uni.$on('chooseFarmer', this.chooseFarmerFun)  
    },  
    onBackPress() {  
        this.offEvent()  
    },  
    onUnload() {  
        this.offEvent()  
    },  
    onNavigationBarButtonTap() {  
        if (!this.topButton) return;  
        let self = this;  
        uni.showActionSheet({  
            //    itemList:['确认','删除'],  
            itemList: this.source_id == '' ? ['确认', '删除'] : ['确认'],  
            success: e => {  
                if (e.tapIndex == 0) {  
                    // uni.navigateTo({  
                    //  url:'/pages/cashPledge/cash_edit?id='+self.editId  
                    // })  
                    self.confirm()  
                }  
                if (e.tapIndex == 1) {  
                    self.delview()  
                }  
            }  
        });  
    },  
}  
</script>  

<style scoped>  
.tr .td input {  
    font-size: 26upx;  
}  

.pointer-events {  
    pointer-events: none;  
    /**禁止触发事件**/  
}</style>

预期结果:

希望快点解决

实际结果:

希望快点解决

bug描述:

详情页,内容页渲染出错,H5是正常的,ios,和安卓渲染有问题,一个标签页出现两次,代码检查无误只写一次

2023-05-26 15:38 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者)

应该是渲染的bug

要回复问题请先登录注册