提交 f50ab356 作者: 王定

feat: 调整弹框

上级 430c2d14
{ {
"prompt" : "template" "version": "1",
"prompt": "template",
"title": "服务协议和隐私政策",
"message": "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://app.yiring.com/agri/services.html\">《服务协议》</a>和<a href=\"https://app.yiring.com/agri/privacy.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept": "同意并接受",
"buttonRefuse": "不同意",
"hrefLoader": "system",
"backToExit":"false",
"second": {
"title": "确认提示",
"message": "  进入应用前,你需先同意<a href=\"https://app.yiring.com/agri/services.html\">《服务协议》</a>和<a href=\"https://app.yiring.com/agri/privacy.html\">《隐私政策》</a>,否则将退出应用。",
"buttonAccept": "同意并继续",
"buttonRefuse": "退出应用"
},
"disagreeMode":{
"support": false,
"loadNativePlugins": false,
"visitorEntry": false,
"showAlways": false
}
} }
...@@ -6,6 +6,20 @@ enum Api { ...@@ -6,6 +6,20 @@ enum Api {
postEnterpriseAdd = '/server/enterprise/add', // 入驻申请 postEnterpriseAdd = '/server/enterprise/add', // 入驻申请
getEnterpriseDetail= '/server/enterprise/detail', // 企业详情 getEnterpriseDetail= '/server/enterprise/detail', // 企业详情
postGoodsAdd = '/trade/goods/add', // 农资商品管理-添加 postGoodsAdd = '/trade/goods/add', // 农资商品管理-添加
getGoodsQueryById = '/trade/goods/queryById', // 农资商品管理-通过id查询
}
/**
* @param params 请求参数
* @description: 农资商品管理-通过id查询
*/
export function getGoodsQueryById(params = {}) {
return otherHttp.get({
url: Api.getGoodsQueryById,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
} }
/** /**
......
...@@ -131,15 +131,6 @@ ...@@ -131,15 +131,6 @@
"uniStatistics": { "uniStatistics": {
"enable": true "enable": true
}, },
"privacy" : {
"prompt" : "template",
"template" : {
"title" : "服务协议和隐私政策",
"message" : "  尊敬的用户,欢迎您注册成为本应用用户,在注册前请您仔细阅读<a href=\"https://app.yiring.com/agri/services.html\">《服务协议》</a>及<a href=\"https://app.yiring.com/agri/privacy.html\">《隐私政策》</a>,了解我们对您使用我们APP制定的规则,您个人信息的处理以及申请权限的目的和使用范围。<br/>  经您确认后,本用户协议和隐私权政策即在您和本应用之间产生法律效力。请您务必在注册之前认真阅读全部服务协议内容,如有任何疑问,可向本应用客服咨询。",
"buttonAccept" : "同意",
"buttonRefuse" : "拒绝并退出"
}
},
"nativePlugins": { "nativePlugins": {
"lemonjk-FileSelect": { "lemonjk-FileSelect": {
"appid_android": "com.yiring.app.agri", "appid_android": "com.yiring.app.agri",
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
title: param.name title: param.name
}); });
getDetailData(param.id); getDetailData(param.id);
queryByCategoryAndCode(0,null) queryByCategoryAndCode(0,null);
queryByCategory();
getGoodsQueryById(param.id);
}) })
const toastRef = ref() const toastRef = ref()
const unitPopupRef = ref(null); const unitPopupRef = ref(null);
...@@ -28,16 +30,21 @@ ...@@ -28,16 +30,21 @@
unitPopup:false, unitPopup:false,
unitOptions:[], unitOptions:[],
unitVal:[], unitVal:[],
unitText:"",
productImageArr:[], productImageArr:[],
categoryPopup:false,
categoryOptions:[],
categoryText:[],
categoryVal:[],
rules: [ rules: [
{ {
name: 'name', name: 'name',
rule: ['required'], rule: ['required'],
msg: ['请输入商品名称'], msg: ['请输入商品名称'],
},{ },{
name: "contactMobile", name: "mobile",
rule: ["required", "isMobile"], rule: ["required", "isMobile"],
msg: ["请输入联系电话", "请输入正确的联系电话"] msg: ["请输入联系电话", "请输入正确的联系电话"]
},{ },{
...@@ -68,7 +75,7 @@ ...@@ -68,7 +75,7 @@
let productInfo = reactive({ let productInfo = reactive({
id:"", id:"",
name:"",// 商品名称 name:"",// 商品名称
contactMobile:"", // 联系方式 mobile:"", // 联系方式
category:"", // 分类 category:"", // 分类
minSellPrice:"", // 最小销售价 minSellPrice:"", // 最小销售价
maxSellPrice: "", // 最大销售价 maxSellPrice: "", // 最大销售价
...@@ -77,6 +84,12 @@ ...@@ -77,6 +84,12 @@
enterpriseId:"", // 企业ID enterpriseId:"", // 企业ID
image:"" image:""
}) })
function getGoodsQueryById(id){
NongzhiAPI.getEnterpriseList({id:id}).then((res) => {
console.log("查询到的产品");
console.log(res);
})
}
// 文件上传 // 文件上传
function handleUpload(file) { function handleUpload(file) {
const tempFilePaths = file.tempFilePaths; const tempFilePaths = file.tempFilePaths;
...@@ -101,7 +114,6 @@ ...@@ -101,7 +114,6 @@
text: '上传成功', text: '上传成功',
}) })
pageData.productImageArr[0] = data.message // 保存返回的图片信息 pageData.productImageArr[0] = data.message // 保存返回的图片信息
} }
} }
}, },
...@@ -122,18 +134,38 @@ ...@@ -122,18 +134,38 @@
uploadRef.value.clearFiles() uploadRef.value.clearFiles()
pageData.productImageArr[0] = null pageData.productImageArr[0] = null
} }
function changeCategory(e){
productInfo.category = e.value;
pageData.categoryPopup = false;
}
function selectCompleteUnit(e){ function selectCompleteUnit(e){
productInfo.unit = e.text[e.text.length-1]; productInfo.unit = e.text[e.text.length-1];
pageData.unitPopup = false; pageData.unitPopup = false;
} }
function handleSelectUnit(){
pageData.unitPopup = true;
}
function changeUnit(e){ function changeUnit(e){
let val = e.value; let val = e.value;
queryByCategoryAndCode(val,e); queryByCategoryAndCode(val,e);
} }
function handleSelectCategory(){
pageData.categoryPopup = true;
}
function handleSelectUnit(){
pageData.unitPopup = true;
}
// 查询商品分类
function queryByCategory(){
LinghuoyonggongAPI.gitListByCodeDict({ code : 'category'}).then(res=>{
console.log("查询到的商品分类");
console.log(res);
pageData.categoryOptions = res;
let textArr = [];
for(let i = 0; i < res.length; i++){
textArr.push(res[i].itemText);
}
pageData.categoryText = textArr;
})
}
// 查询单位字典
function queryByCategoryAndCode(code,e){ function queryByCategoryAndCode(code,e){
LinghuoyonggongAPI.queryByCategoryAndCode({ category : 2,code : code}).then(res=>{ LinghuoyonggongAPI.queryByCategoryAndCode({ category : 2,code : code}).then(res=>{
if(res.length){ if(res.length){
...@@ -152,24 +184,28 @@ ...@@ -152,24 +184,28 @@
}else{ }else{
unitPopupRef.value.end(); unitPopupRef.value.end();
} }
}) })
} }
// 发布 // 发布
const formRef = ref() const formRef = ref()
function addData(){ function addData(){
// productInfo.img = pageData.productImageArr[0]; productInfo.image = pageData.productImageArr[0];
formRef.value.validator(productInfo, pageData.rules, true).then((res) => { formRef.value.validator(productInfo, pageData.rules, true).then((res) => {
if (res.isPassed) { if (res.isPassed) {
console.log("验证通过了"); NongzhiAPI.postGoodsAdd(productInfo).then((res) => {
toastRef.value.show({
type: 'success',
text: '发布成功',
})
pageData.isPopupShow = false;
setTimeout(()=>{
getGoodsQueryById(productInfo.id);
},500)
})
} }
}) })
/* NongzhiAPI.postGoodsAdd(productInfo).then((res) => {
console.log("发布成功了");
console.log(res);
}) */
} }
function getDetailData(id){ function getDetailData(id){
NongzhiAPI.getEnterpriseDetail({ id }).then((res) => { NongzhiAPI.getEnterpriseDetail({ id }).then((res) => {
...@@ -235,9 +271,11 @@ ...@@ -235,9 +271,11 @@
</view> </view>
<view class="popup_content"> <view class="popup_content">
<fui-form label-weight="auto" ref="formRef" top="0"> <fui-form label-weight="auto" ref="formRef" top="0">
<fui-input required label="商品名称" borderTop placeholder="请输入商品名称" v-model="productInfo.name"></fui-input> <fui-input required label="商品名称" borderTop placeholder="请输入商品名称" v-model="productInfo.name" label-width="180" size="28"></fui-input>
<fui-input required label="联系电话" placeholder="请输入联系方式" v-model="productInfo.contactMobile"></fui-input>
<fui-input @click="handleSelectCategory" required label="商品分类" placeholder="请选择商品分类" disabled :value="productInfo.category" label-width="180" size="28"></fui-input>
<fui-input required maxlength="11" label="联系电话" placeholder="请输入联系方式" v-model="productInfo.mobile" label-width="180" size="28"></fui-input>
<fui-form-item asterisk label="价格(元)" labelSize="28" label-width="180" size="28"> <fui-form-item asterisk label="价格(元)" labelSize="28" label-width="180" size="28">
<fui-input v-model="productInfo.minSellPrice" style="width: 120rpx !important" :borderBottom="false" :padding="[0]" placeholder="最低价"></fui-input> <fui-input v-model="productInfo.minSellPrice" style="width: 120rpx !important" :borderBottom="false" :padding="[0]" placeholder="最低价"></fui-input>
<template v-slot:right> <template v-slot:right>
...@@ -248,7 +286,7 @@ ...@@ -248,7 +286,7 @@
</template> </template>
</fui-form-item> </fui-form-item>
<fui-form-item asterisk label="商品图片" :bottomBorder="false" prop="descr" error-align="left"> <fui-form-item asterisk label="商品图片" :bottomBorder="false">
<template v-slot:vertical> <template v-slot:vertical>
<uni-file-picker :value="pageData.productImageArr" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete"/> <uni-file-picker :value="pageData.productImageArr" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete"/>
</template> </template>
...@@ -268,6 +306,10 @@ ...@@ -268,6 +306,10 @@
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<fui-picker :options="pageData.categoryText" layer="1" :show="pageData.categoryPopup" @change="changeCategory" @cancel="pageData.categoryPopup = false"></fui-picker>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
</template> </template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论