详细问题描述
代码
<template>
<view class="page">
<view v-for="(item,index) in datas.list" :key="index" >
<uni-swipe-action :options="getOptions(item)" >
<view class='cont'>仓库名称:{{item.antennaName}}</view>
<view class='cont'>货区名称:{{item.areaName}}</view>
<view class='cont'>货架名称:{{item.shelveName}}</view>
<view class='cont'>货位名称:{{item.allocationName}}</view>
<view class='cont'>物品名称:{{item.goodsName}}</view>
<!--<view class='cont'>{{item.antennaName}}{{item.areaName}}{{item.shelveName}}{{item.allocationName}}{{item.goodsName}}需要检测!!</view>-->
</uni-swipe-action>
</view>
</view>
</template>
<script>
import uniSwipeAction from "@/components/uni-swipe-action/uni-swipe-action.vue";
import util, { parGetData, parSetData, checklogin } from '../../common/util';
export default {
name: "doSth",
data() {
return {
datas:{
nextPage:0,
pageSize:10,
size:0,
list:[]
},
modalName:'',
}
},
components: {
uniSwipeAction
},
mounted() {
this.getlistByStatus();
},
onBackPress() {
uni.reLaunch({
url: '../main/main',
});
return true;
},
methods: {
getOptions(item){
var that=this;
var data=[{
text: '完好',
style: {
backgroundColor: '#007aff'
},
click:function(){
uni.showModal({
title: '提示',
content: '该物品确定完整!!',
success: function (res) {
console.log('111111111')
if (res.confirm) {
uni.request({
url: util.apiurl + 'sage/bgoods/updateGoods',
method: 'POST',
dataType: 'json',
data:{
goodsStatus:0,
id:item.id,
type:1
},
success: ret => {
console.log(ret)
if (ret.statusCode !== 200) {
uni.showToast({
title: '请求数据失败请重试' + ret.statusCode,
duration: 2000,
icon: 'none'
});
} else {
that.datas={
nextPage:0,
pageSize:10,
size:0,
list:[]
}
that.getlistByStatus();
}
},
fail: res => {
console.log(uni.getStorageSync("token"))
uni.showToast({
title: '请求数据失败请重试',
duration: 2000,
icon: 'none'
});
},
complete: function() {
this.loading = false;
},
header: {
auth: util.httpauth,
'content-type': 'application/json',
'token':uni.getStorageSync("token")
}
});
} else if (res.cancel) {
}
}
});
}
}, {
text: '损坏',
style: {
backgroundColor: '#dd524d'
},
click:function(){
uni.navigateTo({
url:`badDetail?id=`+item.id+'&type=0'
});
}
}]
return data;
},
getlistByStatus(){
var that = this;
uni.request({
url: util.apiurl + 'sage/bgoods/listByStatus',
method: 'POST',
dataType: 'json',
data:{
goodsStatus:3,
limit:this.datas.pageSize,
page:this.datas.nextPage,
wareHouseId:parseInt(uni.getStorageSync("house"))
},
success: ret => {
console.log(ret)
if (ret.statusCode !== 200) {
uni.showToast({
title: '请求数据失败请重试' + ret.statusCode,
duration: 2000,
icon: 'none'
});
} else {
//that.list=that.datas.list;
//that.list.push(ret.data.goodsList.list)
that.datas.nextPage = ret.data.goodsList.nextPage;
that.datas.pageSize = ret.data.goodsList.pageSize;
that.datas.size = ret.data.goodsList.size;
this.datas.list = this.datas.list.concat(ret.data.goodsList.list);
if(ret.data.goodsList.list.length<1){
uni.showToast({
title: '没有了',
icon: 'none'
});
}
}
},
fail: res => {
console.log(uni.getStorageSync("token"))
uni.showToast({
title: '请求数据失败请重试',
duration: 2000,
icon: 'none'
});
},
complete: function() {
this.loading = false;
},
header: {
auth: util.httpauth,
'content-type': 'application/json',
'token':uni.getStorageSync("token")
}
});
},
},
onPullDownRefresh() {
// 下拉刷新
this.refreshing = true;
this. datas={
nextPage:0,
pageSize:10
};
this.getlistByStatus();
},
onReachBottom() {
/* 到底部加载 */
// this.getBreturnrecordsList();
if(this.datas.size==this.datas.pageSize){
this.getlistByStatus();
}
}
}
</script>
<style scoped>
.cont{
font-size: 16px;
line-height: 1.8;
}
</style>
[内容]
重现步骤
动态option getOptions 中click事件 在H5上可以使用 真机上无法使用 小米5 mini11
[步骤]
[结果]
[期望]
[如果语言难以表述清晰,拍一个视频或截图,有图有真相]
IDE运行环境说明
[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明]
[IDE版本号]
[windows版本号]
[mac版本号]
uni-app运行环境说明
[运行端是h5或app或某个小程序?]
[运行端版本号]
[项目是cli创建的还是HBuilderX创建的?如果是cli创建的,请更新到最新版cli再试]
[编译模式是老模板模式还是新的自定义组件模式?]
App运行环境说明
[Android版本号]
[iOS版本号]
[手机型号]
[模拟器型号]
附件
[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
[可重现代码片段]
联系方式
[QQ]
0 个回复