提交 8dded24c 作者: 王定

feat: 优化一些细节

上级 054cd02b
# API 接口地址
# VITE_GLOB_API_URL=http://111.22.182.169:49600
VITE_GLOB_API_URL=http://36.133.16.81:42111
VITE_GLOB_API_URL=http://111.22.182.169:49600
# VITE_GLOB_API_URL=http://36.133.16.81:42111
# API 接口地址前缀
# VITE_GLOB_API_URL_PREFIX=/jeecgboot
VITE_GLOB_API_URL_PREFIX=/jeecg-boot
VITE_GLOB_API_URL_PREFIX=/jeecgboot
# VITE_GLOB_API_URL_PREFIX=/jeecg-boot
......@@ -74,3 +74,20 @@
.uni-picker-container .uni-picker-action.uni-picker-action-confirm {
color: #5DB66F !important;
}
.yr-select-area {
padding-top: 30rpx;
position: relative;
.fui-title {
font-size: 30rpx;
font-weight: bold;
text-align: center;
padding-bottom: 24rpx;
}
.fui-icon__close {
position: absolute;
top: 24rpx;
right: 24rpx;
}
}
......@@ -248,7 +248,7 @@
}
</script>
<template>
<view class="w-full h-95vh bg-#E6F5E8 detail_page">
<view class="w-full bg-#E6F5E8 detail_page">
<view class="module_width top_content">
<view class="enterprise_logo_view"><image class="enterprise_logo" mode="heightFix" :src="pageData.data.enterpriseLogoUrl" /></view>
<view class="enterprise_business">主营:{{pageData.data.businessScope}}</view>
......@@ -357,6 +357,7 @@
align-items: flex-start;
align-content: flex-start;
padding-bottom: 40rpx;
min-height: calc(100vh - 88rpx);
.module_width{
width: 690rpx;
margin-top: 24rpx;
......@@ -454,7 +455,9 @@
}
}
.footer_content{
margin-bottom: 100rpx;
}
.module_business{
display: flex;
flex-wrap: wrap;
......@@ -468,8 +471,9 @@
border-radius: 16rpx;
box-sizing: border-box;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
flex-direction: column;
background: #F9FAFB;
.business_img{
width: 310rpx;
......
......@@ -3,6 +3,7 @@
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as nongjifuwu from '@/api/model/nongjifuwu'
import { getDictData, getText } from '@/utils/dict/area'
......@@ -17,15 +18,16 @@
} else {
pageData.title = '新增农活作业'
}
getProvince(43,null);
uni.setNavigationBarTitle({
title: pageData.title,
})
})
onShow(() => {
/* onShow(() => {
// 数据字典赋值
initDict()
})
}) */
const pageData = reactive({
title: '农活表单',
......@@ -35,9 +37,10 @@
time2: false,
address: false,
},
options: {
address: [],
},
options: [],
optionsVal:[],
optionsValText:"",
form: {
id: '',
name: '',
......@@ -92,8 +95,49 @@
const { show, options, form } = toRefs(pageData)
async function initDict() {
pageData.options.address = await getDictData()
const areaPopupRef = ref(null);
// 选择地区完成
function selectCompleteArea(e){
let text = e.text;
let value = e.value;
let areaText = "",areaVal="";
for(let i = 0; i < (text.length-1);i++){
areaText += text[i]+'/';
areaVal += value[i]+',';
}
pageData.form.scope = areaVal.slice(0, -1);; // code
pageData.optionsValText = areaText.slice(0, -1);;
pageData.show.address = false;
}
// 在选择地区
function changeArea(e){
let val = e.value;
getProvince(val,e);
}
// 获取下一级地区
function getProvince(code,e) {
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{
if(res.length){
let dataArr = [];
for(let i = 0; i < res.length; i++){
let obj = {text:"",value:""};
obj.text = res[i].name;
obj.value = res[i].code;
dataArr.push(obj);
}
if(!pageData.options.length){
pageData.options = dataArr;
}else{
console.log("e.layer= "+ e.layer);
areaPopupRef.value.setRequestData(dataArr, e.layer);
if(e.layer >= 2){
areaPopupRef.value.end();
}
}
}else{
areaPopupRef.value.end();
}
})
}
function getDetails(id) {
......@@ -216,7 +260,7 @@
<text class="label">服务范围</text>
<view class="time-input" @click="show.address = true">
<text class="select-text" :class="{ placeholder: !pageData.form.scope }">
{{ getText(pageData.form.scope, ' / ') || '请选择市/区县/乡镇' }}
{{ pageData.optionsValText || '请选择市/区县/乡镇' }}
</text>
</view>
</view>
......@@ -258,7 +302,20 @@
<fui-date-picker :show="show.time2" type="3" @change="handleChangeTime2" @cancel="show.time2 = false" :minDate="getCurrentDate()" />
<fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
<fui-picker :show="show.address" :options="options.address" :linkage="true" :layer="3" @change="handleChangeAddress" @cancel="show.address = false" />
<!-- <fui-picker :show="show.address" :options="options.address" :linkage="true" :layer="3" @change="handleChangeAddress" @cancel="show.address = false" />
-->
<fui-bottom-popup :show="pageData.show.address">
<view class="fui-scroll__wrap yr-select-area">
<view class="fui-title">请选择</view>
<fui-cascader ref="areaPopupRef" :value="pageData.optionsVal" stepLoading @change="changeArea" @complete="selectCompleteArea" :options="pageData.options"></fui-cascader>
<view class="fui-icon__close" @tap.stop="pageData.show.address = false">
<fui-icon name="close" :size="48"></fui-icon>
</view>
</view>
</fui-bottom-popup>
</view>
</view>
</template>
......
......@@ -2,7 +2,7 @@
import { reactive, ref } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import ApplyDialog from './components/apply-dialog.vue'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import * as NongzhiAPI from '@/api/model/nongzhi'
import Navigate from '@/utils/page/navigate'
......@@ -10,14 +10,15 @@
import { getDictData, getText } from '@/utils/dict/area'
onLoad((option) => {
pageData.search.serviceType = Number(option.type) || 1
pageData.search.serviceType = Number(option.type) || 1;
getProvince(43,null);
})
onShow(() => {
pageData.search.pageNo = 1
pageData.farmMachineList = []
getFarmMachineList()
getCascader()
// getCascader()
})
const pageData = reactive({
......@@ -28,6 +29,8 @@
address: false,
},
options: [],
optionsVal:[],
optionsValText:"",
// 分类标签
categoryTabs: [
{ id: 1, name: '找农机' },
......@@ -38,11 +41,59 @@
pageSize: 10,
serviceType: 1,
scope: null,
bizCategory:3
bizCategory:3,
reviewStatus:1
},
farmMachineList: [],
total: 0,
})
const areaPopupRef = ref(null);
// 选择地区完成
function selectCompleteArea(e){
let text = e.text;
let value = e.value;
let areaText = "",areaVal="";
for(let i = 0; i < (text.length-1);i++){
areaText += text[i]+'/';
areaVal += value[i]+',';
}
pageData.search.scope = areaVal.slice(0, -1);; // code
pageData.optionsValText= areaText.slice(0, -1);;
pageData.show.address = false;
// 触发搜索
search();
}
// 在选择地区
function changeArea(e){
let val = e.value;
getProvince(val,e);
}
// 获取下一级地区
function getProvince(code,e) {
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{
if(res.length){
let dataArr = [];
for(let i = 0; i < res.length; i++){
let obj = {text:"",value:""};
obj.text = res[i].name;
obj.value = res[i].code;
dataArr.push(obj);
}
if(!pageData.options.length){
pageData.options = dataArr;
}else{
console.log("e.layer= "+ e.layer);
areaPopupRef.value.setRequestData(dataArr, e.layer);
if(e.layer >= 2){
areaPopupRef.value.end();
}
}
}else{
areaPopupRef.value.end();
}
})
}
function getFarmMachineList() {
pageData.loading = true
......@@ -71,6 +122,17 @@
function search() {
pageData.loading = true
if(pageData.search.serviceType == 1){
NongzhiAPI.getEnterpriseList(pageData.search)
.then((res) => {
const { records, total } = res
pageData.farmMachineList = records
pageData.total = total
})
.finally(() => {
pageData.loading = false
})
}else{
NongjifuwuAPI.farmMachineList(pageData.search)
.then((res) => {
const { records, total } = res
......@@ -81,6 +143,7 @@
pageData.loading = false
})
}
}
async function getCascader() {
pageData.options = await getDictData()
......@@ -88,12 +151,40 @@
// 分类标签点击事件
function onCategoryTabClick(tab: any) {
console.log('点击分类标签:', tab)
pageData.search.serviceType = tab.id;
// 在这里添加具体的分类标签点击逻辑
pageData.search.pageNo = 1
pageData.farmMachineList = []
pageData.farmMachineList = [];
getFarmMachineList()
let pages = getCurrentPages();
let page = pages[pages.length - 1];
if(pageData.search.serviceType == 1){
// #ifdef H5
document.querySelector('.uni-page-head-ft .uni-page-head-btn .uni-btn-icon').innerHTML = '申请入驻';
// #endif
// #ifdef APP-PLUS
var currentVebview = page.$getAppWebview();
var tn = currentVebview.getStyle().titleNView;
tn.buttons[0].text = '申请入驻'; // \ue... 字体图标
// tn.buttons[0].fontSrc = "/static/font/iconfont.ttf"
currentVebview.setStyle({
titleNView: tn
})
// #endif
}else{
// #ifdef H5
document.querySelector('.uni-page-head-ft .uni-page-head-btn .uni-btn-icon').innerHTML = '';
// #endif
// #ifdef APP-PLUS
var currentVebview = page.$getAppWebview();
var tn = currentVebview.getStyle().titleNView;
tn.buttons[0].text = '';
currentVebview.setStyle({
titleNView: tn
})
// #endif
}
}
function handlePublish() {
......@@ -133,10 +224,12 @@
}
onNavigationBarButtonTap(() => {
onNavigationBarButtonTap((e) => {
/* pageData.search.scope = null
search() */
if(pageData.search.serviceType == 1){
Navigate.to('/pages/nongjifuwu/shenqingruzhu')
}
})
onReachBottom(() => {
......@@ -152,7 +245,7 @@
<view class="codefun-flex-row codefun-justify-between section_2">
<text class="font_2 text_2">服务区域</text>
<view class="codefun-flex-row codefun-items-center" @click="pageData.show.address = true">
<text class="font_2 text_3">{{ getText(pageData.search.scope, ' / ') || '选择市县乡镇' }}</text>
<text class="font_2 text_3">{{ pageData.optionsValText || '选择市县乡镇' }}</text>
<image
class="codefun-shrink-0 image_7 codefun-ml-4"
src="/static/images/codefun/774cfe989f8417dc655fb301635f5893.png"
......@@ -180,12 +273,20 @@
<fui-empty marginTop="100" src="/static/images/no-data.png" title="暂无数据" />
</view>
<view class="codefun-flex-col codefun-relative section_4">
<template v-if=" pageData.search.serviceType == 1">
<template v-if="pageData.search.serviceType == 1">
<view class="yr-item" v-for="item in pageData.farmMachineList" :key="item.id">
<view class="item_top">
<image class="enterprise_logo" mode="aspectFit" :src="item.enterpriseLogoUrl" />
<view class="item_right">
<view class="text-ellipsis yr-item-name">{{item.enterpriseName}}</view>
<view class="text-ellipsis yr-item-product">公司主营: {{item.businessScope}}</view>
</view>
</view>
<view class="yr-item-info">
<view class="text-ellipsis yr-item-address">{{item.provinceName}}{{item.cityName}}{{item.districtName}}{{item.townName}}</view>
<view class="text-ellipsis yr-item-address">
<image class="address_icon" src="/static/images/linghuoyonggong/address.png" />
<text>{{item.provinceName}}{{item.cityName}}{{item.districtName}}{{item.townName}}</text>
</view>
<view class="yr-item-detail" @click="toDetail(item)">查看详情</view>
</view>
</view>
......@@ -227,20 +328,32 @@
</view>
</view>
</view>
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<fui-fab v-show="pageData.search.serviceType != 1" position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<view class="text-white text-center">
<view class="fab-icon" />
<view style="font-size: 24rpx">发布</view>
</view>
</fui-fab>
<fui-picker
<!-- <fui-picker
:show="pageData.show.address"
:options="pageData.options"
:linkage="true"
:layer="3"
@change="handleChangeAddress"
@cancel="pageData.show.address = false"
/>
/> -->
<fui-bottom-popup :show="pageData.show.address">
<view class="fui-scroll__wrap yr-select-area">
<view class="fui-title">请选择</view>
<fui-cascader ref="areaPopupRef" :value="pageData.optionsVal" stepLoading @change="changeArea" @complete="selectCompleteArea" :options="pageData.options"></fui-cascader>
<view class="fui-icon__close" @tap.stop="pageData.show.address = false">
<fui-icon name="close" :size="48"></fui-icon>
</view>
</view>
</fui-bottom-popup>
<ApplyDialog ref="applyDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
......@@ -248,13 +361,14 @@
<style scoped lang="scss">
.page {
box-sizing: border-box;
padding-bottom: 12rpx;
background-color: #e6f5e8;
mix-blend-mode: NOTTHROUGH;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
height: 100%;
min-height: calc(100vh - 88rpx);
.text-ellipsis {
white-space: nowrap;
overflow: hidden;
......@@ -265,8 +379,17 @@
border-bottom: 2rpx solid #EEEEEE;
padding-left: 8rpx;
padding-bottom: 20rpx;
.item_top{
display: flex;
align-items:flex-start;
justify-content: space-between;
}
.enterprise_logo{
width: 160rpx;
max-height: 120rpx;
}
.yr-item-name{
width: 640rpx;
width: 480rpx;
height: 40rpx;
font-size: 32rpx;
line-height: 40rpx;
......@@ -275,7 +398,7 @@
}
.yr-item-product{
margin-top: 12rpx;
width: 640rpx;
width: 480rpx;
height: 32rpx;
font-size: 24rpx;
line-height: 32rpx;
......@@ -283,14 +406,21 @@
color: #555555;
}
.yr-item-info{
margin-top: 24rpx;
margin-top: 18rpx;
display: flex;
justify-content: space-between;
align-items: center;
.yr-item-address{
font-size: 24rpx;
color: #5DB66F;
color: #999999;
width: 480rpx;
display: flex;
align-items: center;
.address_icon{
width: 24rpx;
height: 26rpx;
margin-right: 8rpx;
}
}
.yr-item-detail{
width: 136rpx;
......
......@@ -127,9 +127,10 @@
function getGoodsList() {
NongzhiAPI.goodsList(pageData.search).then((res) => {
console.log("pageData.products******************")
console.log(res)
const { records, total } = res
pageData.products = [...pageData.products, ...records]
pageData.products = [...pageData.products, ...records];
pageData.total = total
})
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论