处理待办事项

This commit is contained in:
2026-01-15 17:12:46 +08:00
parent 1a0f43b1bd
commit 7ee44c0663
29 changed files with 3215 additions and 63 deletions

413
pages/todo/goodsAdd.vue Normal file
View File

@@ -0,0 +1,413 @@
<template>
<view class="page-content">
<view style=" padding: 20rpx;">
<nut-form>
<nut-form-item label="名称">
<nut-input v-model="form.goods_name" class="nut-input-text" placeholder="请输入名称" type="text" />
</nut-form-item>
<nut-form-item label="串号">
<nut-input v-model="form.goods_no" class="nut-input-text" placeholder="请输入串号" type="text">
<template #right>
<nut-icon @click="onScan" name="scan2" size="30" custom-color="#000000" />
</template>
</nut-input>
</nut-form-item>
<nut-form-item label="售价">
<nut-input v-model="form.goods_price" class="nut-input-text" placeholder="请输入售价" type="nubmer" />
</nut-form-item>
<nut-form-item label="说明">
<nut-textarea v-model="form.content" autosize placeholder="请输入说明" type="text" />
</nut-form-item>
<nut-form-item label="介绍">
<nut-textarea v-model="form.details_content" autosize placeholder="请输入介绍" type="text" />
</nut-form-item>
<!-- <nut-form-item label="上架人">
<nut-input v-model="form.add_person" class="nut-input-text" placeholder="请输入上架人" type="text" />
</nut-form-item> -->
<!-- <nut-form-item label="排序">
<nut-input v-model="form.goods_sort" class="nut-input-text" placeholder="请输入排序" type="number" />
</nut-form-item> -->
<nut-form-item label="状态">
<nut-radio-group direction="horizontal" v-model="form.status">
<nut-radio label="10">下架</nut-radio>
<nut-radio label="20">上架</nut-radio>
</nut-radio-group>
</nut-form-item>
<nut-form-item>
<template v-slot:label>成色</template>
<template v-slot:default>
<view style="color: black;" @click="show_degree_popup = true">
<text>{{form.degree_name}}</text>
</view>
</template>
</nut-form-item>
<nut-form-item>
<template v-slot:label>机型</template>
<template v-slot:default>
<view style="color: black;" @click="show_product_cascader = true">
<text>{{form.type_name}},{{form.brand_name}},{{form.product_name}}</text>
</view>
</template>
</nut-form-item>
<nut-form-item>
<template v-slot:label>商品图片</template>
<template v-slot:default>
<shmily-drag-image v-model="form.images" :number=9 :add-image="addGoodsImg"
keyName="file_path"></shmily-drag-image></template>
</nut-form-item>
<!-- <nut-form-item>
<template v-slot:label>商品视频</template>
<template v-slot:default>
<nut-uploader :url="uploadVideoUrl" name="iFile" v-model:file-list="uploadVideoList"
:source-type="['album','camera']" :media-type="['video']" maximum="1" :multiple="false"
@success="onUploadSuccess" @fail="onUploadFail" @delete="onDeleteFile" :timeout="1000*60">
</nut-uploader>
</template>
</nut-form-item> -->
<view style="align-items: center;text-align: center; padding: 20rpx 60rpx;">
<nut-button type="primary" block @click="onSubmit">
新增商品
</nut-button>
</view>
</nut-form>
</view>
<nut-popup v-model:visible="show_degree_popup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popup_degree_val" :columns="filter_params.degree_list"
:field-names="{text:'degree_name',value:'degree_id'}" title="选择成色" @confirm="onConfirmDegree"
@cancel="show_degree_popup = false">
</nut-picker>
</nut-popup>
<nut-cascader title="机型选择" v-model:visible="show_product_cascader" v-model="cascader_product_val"
@change="onProductChange" @pathChange="onProcutPathChange" text-key="label" value-key="value"
:title-ellipsis="false" children-key="children" :options="filter_params.drop_down_options"></nut-cascader>
</view>
</template>
<script setup>
import {
onMounted,
reactive,
ref,
toValue
} from 'vue';
import {
fetchFilterParmas,
fetchGoodsAdd,
} from '@/api/goods';
import {
getUploadImageUrl,
} from '@/api/request';
// import {
// fetchControlAddGoods,
// } from '@/api/control';
// const uploadVideoUrl = ref('')
// uploadVideoUrl.value = getUploadVideoUrl()
// const uploadVideoOk = ref('https://qnxsd.19year.cn/wechat_2025-08-12_130250_716.png')
// const uploadVideoList = ref([])
// const videoUrl = ref('')
// const onUploadSuccess = (res) => {
// uploadVideoList.value[0].url = uploadVideoOk
// let respStr = res.data.data
// let resp = JSON.parse(respStr)
// if (resp.code === 1) {
// form.video_url = resp.data.url
// uni.showToast({
// title: '上传成功',
// icon: 'success'
// })
// } else {
// uni.showToast({
// title: '上传失败',
// icon: 'none'
// })
// }
// }
// const onDeleteFile = (files, fileList, index) => {
// uploadVideoList.value = []
// form.video_url = ""
// console.log('uploadVideoList3', uploadVideoList)
// console.log('form3', form)
// }
// const onUploadFail = (err) => {
// console.error('上传失败:', err)
// uni.showToast({
// title: '上传失败',
// icon: 'none'
// })
// }
// 扫码
const onScan = () => {
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
console.log(res);
form.goods_no = res.result
},
fail: () => {
uni.showToast({
icon: 'none',
title: '扫码失败'
})
}
})
}
const filter_params = reactive({})
// const report_tags = reactive([])
// const all_report_tag_ids = ref([])
// 默认展开
// const defaultExpandKeys = ref([0])
// 显示机型选择
const show_product_cascader = ref(false)
// 显示成色
const show_degree_popup = ref(false)
// const show_disk_popup = ref(false)
// 显示验机报告
// const show_report_tags_popup = ref(false)
const popup_degree_val = ref([])
const cascader_product_val = ref([])
// const popup_disk_val = ref(["未选择"])
const form = reactive({
// goods_id: 0,
goods_name: '',
goods_no: '',
goods_price: '',
goods_stock: '',
content: '',
details_content: '',
status: '10',
images: [],
add_person: '',
// disk: '未选择',
degree_id: 0,
degree_name: '未选择',
type_id: 0,
type_name: '未选择',
brand_id: 0,
brand_name: '未选择',
product_id: 0,
product_name: '未选择',
// video_url: ''
// goods_no: '',
// goods_status: '10',
// goods_sort: 0,
})
const onProductChange = (...args) => {
}
const onSubmit = () => {
console.log('form====>', form);
fetchGoodsAdd(form).then(res => {
uni.showToast({
icon: 'none',
title: '新增商品成功'
})
// setTimeout(() => {
// uni.switchTab({
// url: '/pages/mine/index'
// });
// }, 500)
setTimeout(() => {
// uni.switchTab({
// url: '/pages/mine/index'
// });
uni.navigateBack({
delta: 1 // 返回上一页
});
}, 500)
})
}
// 选择机型
const onProcutPathChange = (args) => {
console.log(args);
form.type_id = 0
form.type_name = ''
form.brand_id = 0
form.brand_name = ''
form.product_id = 0
form.product_name = ''
if (args.length >= 1 && args[0] !== null) {
form.type_id = args[0].value
form.type_name = args[0].text
}
if (args.length >= 2 && args[1] !== null) {
form.brand_id = args[1].value
form.brand_name = args[1].text
}
if (args.length >= 3 && args[2] !== null) {
form.product_id = args[2].value
form.product_name = args[2].text
}
}
// 选择成色
const onConfirmDegree = () => {
form.degree_id = popup_degree_val.value[0]
filter_params.degree_list.forEach(item => {
if (item.degree_id === form.degree_id) {
form.degree_name = item.degree_name
}
})
show_degree_popup.value = false
}
// const onConfirmDisk = () => {
// form.disk = popup_disk_val.value[0]
// console.log('form.disk', form.disk);
// console.log('popup_disk_val.value', popup_disk_val.value);
// // filter_params.disk_list.forEach(item => {
// // if (item.value === form.disk) {
// // form.disk = item.value
// // }
// // })
// show_disk_popup.value = false
// }
onMounted(() => {
fetchFilterParmas(1).then(res => {
Object.assign(filter_params, res)
filter_params.degree_list.unshift({
degree_id: 0,
degree_name: '未选择'
})
console.log('filter_params', filter_params)
// console.log('filter_params.disk_list', filter_params.disk_list)
// filter_params.disk_list.unshift({
// // id: 0,
// value: '未选择'
// })
})
})
// 上传商品图片
const addGoodsImg = () => {
uni.chooseImage({
count: 9 - (form.image?.length || 0),
sourceType: ['album', 'camera'],
success: res => {
res.tempFiles.forEach(file => {
uni.uploadFile({
url: getUploadImageUrl(),
filePath: file.path,
name: 'iFile',
formData: {
group_id: 1,
},
success: (res) => {
let data = JSON.parse(res.data).data
form.images.push({
id: parseInt(data.file_id),
file_path: data.file_path,
})
}
})
})
}
})
}
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
}
.list {
display: flex;
justify-content: center;
flex-direction: column;
background: #ffffff;
align-items: center;
max-height: 300rpx;
overflow-y: scroll;
padding: 10px;
.list-item {
border-bottom: 1px solid #eee;
padding: 20rpx 10rpx;
}
}
</style>

341
pages/todo/goodsDetail.vue Normal file
View File

@@ -0,0 +1,341 @@
<template>
<view class="content">
<nut-watermark v-if="detail.status?.value === 10" class="mark1" :z-index="1" content="此商品已下架"></nut-watermark>
<nut-watermark v-if="detail.status?.value === 30" class="mark1" :z-index="1" content="此商品已锁定"></nut-watermark>
<nut-watermark v-if="detail.status?.value === 40" class="mark1" :z-index="1" content="此商品已售出"></nut-watermark>
<swiper class="swiper" circular indicator-dots autoplay>
<swiper-item @click="showGoodsImages(idx)" v-for="(item,idx) in detail.image" :key="idx">
<image :src="item.file_path" mode="aspectFill"></image>
</swiper-item>
</swiper>
<view class='goods_info'>
<nut-cell-group>
<view class="price">
<text class="unit"></text>
<text class="value">{{detail.goods_price}}</text>
</view>
</nut-cell-group>
<nut-cell-group>
<view class="name">
<view class="top">
<view class="tag">
<text>{{detail.degree?.degree_name}}</text>
</view>
<text class="title">{{detail.goods_name}}</text>
</view>
<view>
<text class="info">{{detail.content}}</text>
</view>
</view>
</nut-cell-group>
<view class="service">
<view class="info">
<text class="title">服务</text>
<text class="value">{{serviceTxt}}</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
reactive,
ref
} from 'vue';
import {
navigateTo,
switchTab,
goToLoginPage
} from '@/utils/helper';
import {
onShareAppMessage,
onShareTimeline,
onLoad
} from '@dcloudio/uni-app'
import {
fetchGoodsDetail,
} from '@/api/goods';
import {
fetchGetConfig,
} from '@/api/config';
// 审核模式 默认开启 true
// const audit = ref(true);
const serviceTxt = ref('')
const id = ref(0)
const detail = reactive({})
onLoad(options => {
console.log('init');
// 获取配置
getConfig()
// 获取商品详情
id.value = options.id
fetchGoodsDetail(id.value).then(res => {
Object.assign(detail, res)
})
})
// 获取配置
const getConfig = () => {
fetchGetConfig().then(res => {
console.log('getConfig=====>', res)
// audit.value = res.appConfig.is_audit == 1
serviceTxt.value = res.appConfig.service_txt
})
}
// 分享给朋友圈
onShareTimeline((res) => {
return {
title: detail.goods_name,
path: '/pages/mall/detail?id=' + detail.goods_id,
imageUrl: detail.image[0].file_path
};
})
// 分享
onShareAppMessage((res) => {
return {
title: detail.goods_name,
path: '/pages/mall/detail?id=' + detail.goods_id,
imageUrl: detail.image[0].file_path
}
})
// 显示图片
const showGoodsImages = (index) => {
uni.previewImage({
current: index, // 指定当前显示的图片索引
urls: detail.image.map(e => {
return e.file_path
}),
});
}
</script>
<style scoped lang="scss">
.bottom-action {
position: fixed;
bottom: 0;
left: 0;
height: 50px;
background: #fff;
width: calc(100% - 20px);
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 auto;
padding: 5px 10px;
.bottom-action-icon {
align-items: center;
display: flex;
justify-content: center;
.bottom-action-icon-item {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
text {
color: rgba(0, 0, 0, .5);
font-size: 11px;
}
}
}
.bottom-action-btn {
-ms-flex-align: center;
-ms-flex-pack: end;
-webkit-align-items: center;
align-items: center;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
gap: 5px;
-webkit-justify-content: flex-end;
justify-content: flex-end;
}
}
.content {
display: flex;
flex-direction: column;
min-height: calc(100vh - 50px); //100vh;
/* align-items: center; */
// justify-content: center;
background-color: #f2f3f5;
// height: calc(100% - 50px);
--nut-cell-group-title-color: #000;
--nut-collapse-item-padding: 10px 10px 10px 10px;
--nut-collapse-wrapper-content-padding: 10px 10px 10px 10px;
--nut-collapse-item-color: #000;
padding-bottom: 50px;
}
.report-inner {
display: flex;
flex-direction: column;
gap: 5px;
.report-item {
.report-item-name {
color: rgba(0, 0, 0, .9);
font-weight: 700;
}
.report-item-content {
display: flex;
flex-wrap: wrap;
.report-item-content-item {
padding-top: 2px;
padding-bottom: 2px;
width: 50%;
display: flex;
align-items: center;
}
}
}
}
.count-item {
display: flex;
justify-content: center;
align-items: center;
gap: 2px;
}
.swiper {
width: 100%;
height: 414px;
image {
width: 100%;
height: 100%;
}
}
.goods_info {
padding: 5px;
color: #000;
.price {
border-radius: 5px;
padding: 10px;
background: #fff;
.unit {
font-size: 12px;
}
.value {
font-size: 24px;
}
}
.name {
border-radius: 5px;
padding: 10px;
background: #fff;
display: flex;
gap: 5px;
flex-direction: column;
.top {
display: flex;
gap: 5px;
.tag {
background: #000;
padding: 1px 2px;
justify-content: center;
align-items: center;
display: flex;
border-radius: 2px;
text {
font-size: 10px;
color: #fff;
}
}
.title {
font-size: 16px;
}
}
.info {
color: rgba(0, 0, 0, .7);
font-size: 13px;
}
}
.service {
border-radius: 5px;
padding: 10px;
background: #fff;
display: flex;
align-items: center;
justify-content: space-between;
.info {
display: flex;
flex-direction: column;
justify-content: center;
gap: 5px;
.title {
font-size: 16px;
}
.value {
color: rgba(0, 0, 0, .7);
font-size: 13px;
}
}
.right_icon {
background-color: currentColor;
mask: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDI0IDEwMjQiPjxwYXRoIGZpbGw9IiMxQTFBMUEiIGQ9Ik0zNTMuODMgMTU4LjE3YTQyLjY3IDQyLjY3IDAgMSAxIDYwLjM0LTYwLjM0bDM4NCAzODRhNDIuNjcgNDIuNjcgMCAwIDEgMCA2MC4zNmwtMzg0IDM4NGE0Mi42NyA0Mi42NyAwIDEgMS02MC4zNC02MC4zNkw3MDcuNjcgNTEyeiIvPjwvc3ZnPg==') 0 0/100% 100% no-repeat;
width: 12px;
height: 12px;
}
}
.report {
border-radius: 5px;
padding: 1px;
background: #fff;
}
}
</style>

339
pages/todo/goodsEdit.vue Normal file
View File

@@ -0,0 +1,339 @@
<template>
<view class="page-content">
<view v-if="is_show_edit" style=" padding: 20rpx;">
<nut-form>
<nut-form-item label="名称">
<nut-input v-model="form.goods_name" class="nut-input-text" placeholder="请输入名称" type="text" />
</nut-form-item>
<nut-form-item label="串号">
<nut-input v-model="form.goods_no" class="nut-input-text" placeholder="请输入串号" type="text">
<template #right>
<nut-icon @click="onScan" name="scan2" size="30" custom-color="#000000" />
</template>
</nut-input>
</nut-form-item>
<nut-form-item label="售价">
<nut-input v-model="form.goods_price" class="nut-input-text" placeholder="请输入售价" type="nubmer" />
</nut-form-item>
<nut-form-item label="说明">
<nut-textarea v-model="form.content" autosize placeholder="请输入说明" type="text" />
</nut-form-item>
<nut-form-item label="介绍">
<nut-textarea v-model="form.details_content" autosize placeholder="请输入介绍" type="text" />
</nut-form-item>
<!-- <nut-form-item label="上架人">
<nut-input v-model="form.add_person" class="nut-input-text" placeholder="请输入上架人" type="text" />
</nut-form-item> -->
<!-- <nut-form-item label="排序">
<nut-input v-model="form.goods_sort" class="nut-input-text" placeholder="请输入排序" type="number" />
</nut-form-item> -->
<nut-form-item label="状态">
<nut-radio-group direction="horizontal" v-model="form.status">
<nut-radio label="10">下架</nut-radio>
<nut-radio label="20">上架</nut-radio>
</nut-radio-group>
</nut-form-item>
<nut-form-item>
<template v-slot:label>成色</template>
<template v-slot:default>
<view style="color: black;" @click="show_degree_popup = true">
<text>{{form.degree_name}}</text>
</view>
</template>
</nut-form-item>
<nut-form-item>
<template v-slot:label>机型</template>
<template v-slot:default>
<view style="color: black;" @click="show_product_cascader = true">
<text>{{form.type_name}},{{form.brand_name}},{{form.product_name}}</text>
</view>
</template>
</nut-form-item>
<nut-form-item>
<template v-slot:label>商品图片</template>
<template v-slot:default>
<shmily-drag-image v-model="form.images" :number=9 :add-image="addGoodsImg"
keyName="file_path"></shmily-drag-image></template>
</nut-form-item>
<view style="align-items: center;text-align: center; padding: 20rpx 60rpx;">
<nut-button type="primary" block @click="onSubmit">
保存修改
</nut-button>
</view>
</nut-form>
</view>
<nut-popup v-model:visible="show_degree_popup" position="bottom" safe-area-inset-bottom>
<nut-picker v-model="popup_degree_val" :columns="filter_params.degree_list"
:field-names="{text:'degree_name',value:'degree_id'}" title="选择成色" @confirm="onConfirmDegree"
@cancel="show_degree_popup = false">
</nut-picker>
</nut-popup>
<nut-cascader title="机型选择" v-model:visible="show_product_cascader" v-model="cascader_product_val"
@change="onProductChange" @pathChange="onProcutPathChange" text-key="label" value-key="value"
:title-ellipsis="false" children-key="children" :options="filter_params.drop_down_options"></nut-cascader>
</view>
</template>
<script setup>
import {
onMounted,
reactive,
ref,
toValue,
computed
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app'
import {
fetchFilterParmas,
fetchGoodsEdit,
fetchGoodsDetail,
} from '@/api/goods';
import {
getUploadImageUrl,
} from '@/api/request';
const id = ref(0)
// 是否显示结果页
const is_show_edit = ref(false);
// 显示机型选择
const show_product_cascader = ref(false)
// 显示成色
const show_degree_popup = ref(false)
const popup_degree_val = ref([])
const cascader_product_val = ref([])
const filter_params = reactive({})
const form = reactive({
goods_id: 0,
goods_name: '',
goods_no: '',
goods_price: '',
goods_stock: '',
content: '',
details_content: '',
status: '10',
images: [],
add_person: '',
degree_id: 0,
degree_name: '未选择',
type_id: 0,
type_name: '未选择',
brand_id: 0,
brand_name: '未选择',
product_id: 0,
product_name: '未选择',
})
//
onMounted(() => {
fetchFilterParmas(1).then(res => {
Object.assign(filter_params, res)
filter_params.degree_list.unshift({
degree_id: 0,
degree_name: '未选择'
})
console.log('filter_params', filter_params)
})
})
onLoad(options => {
console.log("goods_id===>", options.id);
// 获取商品详情
id.value = options.id
is_show_edit.value = false;
fetchGoodsDetail(id.value).then(res => {
is_show_edit.value = true;
console.log("====>", res);
form.goods_id = res.goods_id
form.goods_name = res.goods_name
form.goods_no = res.goods_no
form.goods_price = res.goods_price
// form.goods_stock = res.goods_stock
form.content = res.content
form.details_content = res.details_content
form.status = res.status.value.toString()
form.degree_id = res.degree?.degree_id ?? 0
form.degree_name = res.degree?.degree_name ?? '未选择'
form.type_id = res.type?.type_id ?? 0
form.type_name = res.type?.name ?? '未选择'
form.brand_id = res.brand?.brand_id ?? 0
form.brand_name = res.brand?.name ?? '未选择'
form.product_id = res.product?.product_id ?? 0
form.product_name = res.product?.name ?? '未选择'
popup_degree_val.value = [res.degree?.degree_id ?? 0]
cascader_product_val.value = [res.type?.type_id ?? 0, res.brand?.brand_id ?? 0, res.product
?.product_id ?? 0
]
form.images = []
res.image?.forEach(item => {
form.images.push({
id: item.image_id,
file_path: item.file_path,
})
})
})
})
const onProductChange = (...args) => {
console.log(0, ...args)
console.log(cascader_product_val)
}
const onSubmit = () => {
console.log('form===>', form);
fetchGoodsEdit(form).then(res => {
uni.showToast({
icon: 'none',
title: '编辑商品成功'
})
setTimeout(() => {
uni.navigateBack({
delta: 1 // 返回上一页
});
}, 500)
})
}
// 扫码
const onScan = () => {
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
console.log(res);
form.goods_no = res.result
},
fail: () => {
uni.showToast({
icon: 'none',
title: '扫码失败'
})
}
})
}
const onProcutPathChange = (args) => {
console.log(args);
form.type_id = 0
form.type_name = ''
form.brand_id = 0
form.brand_name = ''
form.product_id = 0
form.product_name = ''
if (args.length >= 1 && args[0] !== null) {
form.type_id = args[0].value
form.type_name = args[0].text
}
if (args.length >= 2 && args[1] !== null) {
form.brand_id = args[1].value
form.brand_name = args[1].text
}
if (args.length >= 3 && args[2] !== null) {
form.product_id = args[2].value
form.product_name = args[2].text
}
}
const onConfirmDegree = () => {
form.degree_id = popup_degree_val.value[0]
filter_params.degree_list.forEach(item => {
if (item.degree_id === form.degree_id) {
form.degree_name = item.degree_name
}
})
show_degree_popup.value = false
}
// 上传商品图片
const addGoodsImg = () => {
uni.chooseImage({
count: 9 - (form.image?.length || 0),
sourceType: ['album', 'camera'],
success: res => {
res.tempFiles.forEach(file => {
uni.uploadFile({
url: getUploadImageUrl(),
filePath: file.path,
name: 'iFile',
formData: {
group_id: 1,
},
success: (res) => {
let data = JSON.parse(res.data).data
form.images.push({
id: parseInt(data.file_id),
file_path: data.file_path,
})
}
})
})
}
})
}
</script>
<style lang="scss" scoped>
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
--nut-searchbar-input-height: 40px;
}
// .list {
// display: flex;
// justify-content: center;
// flex-direction: column;
// background: #ffffff;
// align-items: center;
// max-height: 300rpx;
// overflow-y: scroll;
// padding: 10px;
// .list-item {
// border-bottom: 1px solid #eee;
// padding: 20rpx 10rpx;
// }
// }
</style>

705
pages/todo/goodsList.vue Normal file
View File

@@ -0,0 +1,705 @@
<template>
<view class="page-content">
<z-paging ref="paging" :refresher-enabled="false" :auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false" v-model="dataList" @query="queryList">
<view style="z-index: 10000;position: sticky;" :style="'top:0px'">
<view class="top-bar">
<nut-button type="primary" block plain @click="navigateTo('/pages/config/goodsAdd')">
新增订单
</nut-button>
</view>
</view>
<view class="goods-item" v-for="(item, index) in dataList" :key="index">
<view class="goods-item-image">
<!-- @click="showGoodsImages(item)" -->
<image class="goods-item-image-img" :src="getImg(item)" @click="navigateTo('/pages/config/goodsDetail?id=' + item.goods_id)"
mode="scaleToFill">
</image>
</view>
<view class="goods-item-content">
<!-- @click="navigateTo('/pages/control/goods/edit?id=' + item.goods_id)" -->
<view class="goods-item-content-header">
<nut-tag custom-color="#1a1a1a">{{ item.degree.degree_name }}</nut-tag>
<view>{{item.goods_name}}</view>
</view>
<!-- @click="navigateTo('/pages/control/goods/edit?id=' + item.goods_id)" -->
<view class="goods-item-content-body">
<view class="goods-item-content-body-desc">
{{item.content}}
</view>
</view>
<view class="goods-item-content-footer">
<view style="font-size: 24rpx;color: red;">
<text>¥{{item.goods_price}}</text>
</view>
<view style="font-size: 24rpx;">
状态:<text>{{item.status.text}}</text>
</view>
<view class="goods-item-content-footer-btn">
<nut-button size="small" type="primary"
v-if="item.status.value == 10 || item.status.value == 20"
@click="navigateTo('/pages/config/goodsEdit?id=' + item.goods_id)">
编辑商品
</nut-button>
<nut-button size="small" type="primary" v-if="item.status.value == 40 "
@click="navigateTo('/pages/config/goodsEdit?id=' + item.goods_id)">
售后(重新上架)
</nut-button>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script setup>
import {
ref,
reactive,
onMounted,
computed
} from 'vue'
import {
onLoad,
onShow,
} from '@dcloudio/uni-app'
// import {
// fetchFilterParmas
// } from '@/api/goods';
import {
fetchFilterParmas,
fetchSysGoodsList
} from '@/api/goods';
import {
navigateTo,
// switchTab,
// goToOtherMiniProgram
} from '@/utils/helper';
// 显示商品图片
const showGoodsImages = (goods) => {
console.log(goods);
uni.previewImage({
// current: index, // 指定当前显示的图片索引
urls: goods?.image.map(e => {
return e.file_path
}),
});
}
const getImg = (goods) => {
const url = goods?.image?.[0]?.file_path
return url ? url + '?imageView2/1/w/200/h/200' : ''
}
// zp
const paging = ref(null);
// 商品列表
const dataList = ref([]);
// 价格排序
const selectPriceSortRef = ref(null);
// 成色选择
const selectDegreeRef = ref(null);
// 机型选择
const selectProductRef = ref(null)
const state = reactive({
type_params: [], // 产品类型
drop_down_options: [], // 产品类型下的品牌列表
o_drop_down_options: [],
// 价格排序
price_sort_params: [{
text: '默认排序',
value: ''
},
{
text: '价格升序',
value: 'ascend'
},
{
text: '价格降序',
value: 'descend'
}
],
// 成色所有选项
degree_params: [],
price_sort: '',
price_sort_name: "默认排序",
degree_ids: [],
degree_name: "成色",
product_name: "机型",
type_id: 1, // 产品类型id 默认 1 手机
type_name: '手机',
brand_id: 0, // 品牌id // 默认 0 全部
brand_name: '全部',
product_ids: [0], // 机型ids 默认 0 全部
search_val: '', // 搜索
});
// 搜索
const onSearch = () => {
console.log("搜索:", state.search_val);
paging.value.reload();
}
// 清空搜索框
const onClear = () => {
console.log("搜索:", state.search_val);
paging.value.reload();
}
// 机型重置
const onResetProduct = () => {
console.log("重置产品");
state.type_id = 1
state.type_name = '手机'
state.brand_id = 0
state.brand_name = '全部'
state.product_ids = [0]
state.product_name = '机型'
}
// 机型确定
const onConfirmProduct = () => {
console.log("当前产品类型", {
"type_id": state.type_id,
"type_name": state.type_name,
"brand_id": state.brand_id,
"brand_name": state.brand_name,
"product_ids": state.product_ids,
});
selectProductRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
}
// 选择机型
const selectProduct = (product) => {
if (product.value === 0) {
state.product_ids = [0]
} else {
state.product_ids = state.product_ids.filter(e => e != 0)
// 判断是否存在
const index = state.product_ids.indexOf(product.value);
if (index > -1) {
state.product_ids.splice(index, 1); // 存在则删除
if (state.product_ids.length === 0) {
state.product_ids = [0]
}
} else {
state.product_ids.push(product.value); // 新增
}
}
console.log(product);
}
const productOptions = computed(() => {
return state?.o_drop_down_options[state.type_id]?.children[state.brand_id].children
})
// 选择品牌
const selectBrand = (brand) => {
console.log(brand);
// 选中的品牌id
state.brand_id = brand.value;
state.brand_name = brand.label
// 品牌下的产品ids
state.product_ids = [0];
state.product_name = brand.label
}
// 选择type
const selectType = (type) => {
console.log(type);
// 选中产品类型id
state.type_id = type.type_id;
state.type_name = type.name;
// 选中的品牌id
state.brand_id = 0;
state.brand_name = '全部';
// 品牌下的产品ids
state.product_ids = [0];
}
// 选择价格排序
const selectPriceSort = (item) => {
if (state.price_sort !== item.value) {
state.price_sort = item.value
state.price_sort_name = item.text
} else {
state.price_sort_name = '默认排序'
state.price_sort = ''
}
selectPriceSortRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
};
// 选择成色
const selectDegree = (item) => {
const index = state.degree_ids.indexOf(item.value);
if (index > -1) {
state.degree_ids.splice(index, 1);
} else {
state.degree_ids.push(item.value);
}
if (state.degree_ids.length > 0) {
state.degree_name = '已选' + state.degree_ids.length.toString() + '项'
} else {
state.degree_name = '成色'
}
}
// 重置选择成色
const onResetDegree = () => {
state.degree_ids = [];
state.degree_name = '成色'
selectDegreeRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
}
// 确认选择成色
const onConfirmDegree = () => {
if (state.degree_ids.length > 0) {
state.degree_name = '已选' + state.degree_ids.length.toString() + '项'
} else {
state.degree_name = '成色'
}
selectDegreeRef.value?.toggle(false);
// 4. 刷新数据
paging.value.reload();
}
// 获取列表
const queryList = (pageNo, pageSize) => {
const params = {
pageSize,
page: pageNo,
price_sort: state.price_sort,
degree_ids: state.degree_ids,
type_id: state.type_id,
brand_id: state.brand_id,
product_ids: state.product_ids,
search: state.search_val,
}
console.log(params);
fetchSysGoodsList(params).then(res => {
console.log('res=>', res.list);
paging.value.complete(res.list);
}).catch(res => {
paging.value.complete(false);
});
};
const init = () => {
console.log('init111');
// 加载默认筛选项内容
fetchFilterParmas().then(res => {
console.log(res);
// 处理成色
let degree_params = res.degree_list;
state.degree_params = degree_params.reduce((it, cit) => {
it.push({
text: cit.degree_name,
value: cit.degree_id
});
return it;
}, state.degree_params) || [];
// 产品类型
state.type_params = res.type_list
// 产品下品牌列表
state.drop_down_options = res.drop_down_options
state.o_drop_down_options = res.o_drop_down_options
})
}
onShow(() => {
console.log("onshow---");
console.log('paging.value', paging.value);
if (paging.value) {
// paging.value.pageNo = 1;
paging.value.refresh();
// paging.value.refreshToPage(1)
// paging.value.reload();
}
});
onMounted(() => {
init();
})
</script>
<style scoped lang="scss">
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
--nut-menu-bar-box-shadow: none;
--nut-menu-item-content-padding: 20rpx;
--nut-menu-item-content-max-height: 900rpx;
// --nut-searchbar-input-padding:5px 0 5px 13px;
--nut-searchbar-input-height: 40px;
}
:deep(.titleClass) .nut-menu__title-text {
font-size: 30rpx;
font-weight: bold;
color: black;
}
.top-bar {
background: #fff;
// padding: 20rpx;
align-items: center;
text-align: center;
padding: 20rpx 60rpx;
// display: flex;
// justify-content: space-between;
// border-top: 1px solid #eee;
// position: sticky;
// bottom: 0;
// z-index: 999;
}
.goods-item {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 20rpx;
background-color: #ffffff;
// border-radius: 20rpx;
margin-bottom: 20rpx;
gap: 20rpx;
.goods-item-image {
width: 180rpx;
height: 180rpx;
.goods-item-image-img {
width: 100%;
height: 100%;
}
}
.goods-item-content {
// width: 100%;
display: flex;
flex: 1;
flex-direction: column;
justify-content: space-between;
/* 首尾贴边,中间均分 */
// gap: 15px;
.goods-item-content-header {
display: flex;
align-items: center;
padding: 6rpx 0;
gap: 20rpx;
}
.goods-item-content-body {
padding: 6rpx 0;
.goods-item-content-body-desc {
color: #7c7c7c;
font-size: 26rpx;
/* 关键属性 */
display: -webkit-box;
/* 使用弹性盒子布局 */
-webkit-box-orient: vertical;
/* 垂直方向排列 */
-webkit-line-clamp: 2;
/* 限制显示两行 */
overflow: hidden;
/* 超出部分隐藏 */
text-overflow: ellipsis;
/* 超出时显示省略号 */
}
}
.goods-item-content-stock {
display: flex;
justify-content: space-between;
.goods-item-content-stock-desc {
font-size: 26rpx;
color: #999999;
}
.goods-item-content-status-desc {
font-size: 26rpx;
color: red;
}
}
.goods-item-content-footer {
padding: 6rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
// width: 100%;
// flex-direction: row;
.goods-item-content-footer-btn {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10rpx;
.share-btn {
border-radius: 50rpx;
border: 2rpx solid red;
font-size: 26rpx;
align-items: center;
height: 54rpx;
color: red;
display: flex;
justify-content: center;
}
}
}
}
}
.filter-types {
display: flex;
justify-content: flex-start;
flex-direction: row;
align-items: center;
overflow: auto;
gap: 10rpx;
padding: 10rpx;
// position: fixed;
// top: 0;
height: 60rpx;
// z-index: 9999;
background-color: #fff;
border-bottom: 2rpx solid gainsboro;
border-top: 2rpx solid gainsboro;
.filter-type-inner {
align-items: center;
background-color: rgba(0, 0, 0, .05);
border-radius: 16rpx;
box-sizing: border-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex: 0 0 auto;
font-size: 28rpx;
gap: 15rpx;
padding: 10rpx 20rpx;
// image {
// height: 22px;
// width: 22px;
// }
}
.filter-type-inner.active {
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
}
.tabs-container {
display: flex;
.tab-pane-inner {
height: 600rpx;
}
.tabs-inner {
overflow-y: scroll;
height: 600rpx;
width: 160rpx;
background-color: #F5F5F5;
.tab-inner {
display: flex;
height: 60rpx;
padding: 10rpx;
font-size: 28rpx;
display: flex;
align-items: center;
background: #F5F5F5;
text {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
}
}
.tab-inner-active {
// background: #FFF;
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
}
}
.degree-inner {
display: flex;
flex: 1;
flex-wrap: wrap;
// gap: 20rpx;
gap: 10rpx;
// padding: 11px;
width: 100%;
margin-bottom: 60rpx;
}
.degree-item {
align-items: center;
background-color: rgba(0, 0, 0, .05);
border-radius: 10rpx;
box-sizing: border-box;
display: flex;
flex: 0 0 auto;
font-size: 26rpx;
gap: 10rpx;
justify-content: center;
min-height: 80rpx;
width: calc(50% - 10rpx);
}
.degree-item.active {
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
.product-btns {
display: flex;
width: 100%;
padding: 20rpx 0;
// border-bottom: 2rpx solid gainsboro;
// border-top: 2rpx solid gainsboro;
.reset {
flex: 1;
}
.confirm {
flex: 2;
}
}
.degree-btns {
display: flex;
width: 100%;
.reset {
flex: 1;
/* 重置按钮占 1 份 */
}
.confirm {
flex: 2;
/* 确认按钮占 2 份 */
}
}
.main-nav-container {
display: flex;
justify-content: space-between;
background-color: #fff;
padding: 20rpx;
}
.nav-button {
display: flex;
align-items: center;
width: 45%;
height: 160rpx;
border-radius: 20rpx;
overflow: hidden;
padding: 0 10rpx;
}
.phone-button {
background: linear-gradient(135deg, #6a5ae0, #8d7bfb);
color: white;
}
.parts-button {
background: linear-gradient(135deg, #ff6b6b, #ee5253);
color: white;
}
.nav-button-bg {
position: absolute;
right: 0;
top: 0;
height: 100%;
width: 50%;
opacity: 0.2;
object-fit: cover;
}
.nav-button-icon {
width: 90rpx;
height: 90rpx;
margin-right: 20rpx;
// border-radius: 20rpx;
z-index: 2;
}
.nav-button-content {
z-index: 2;
display: flex;
flex-direction: column;
}
.nav-button-title {
font-size: 34rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
.nav-button-desc {
font-size: 24rpx;
opacity: 0.85;
}
</style>

View File

@@ -1,8 +0,0 @@
<template>
</template>
<script>
</script>
<style>
</style>

481
pages/todo/todoList.vue Normal file
View File

@@ -0,0 +1,481 @@
<template>
<view class="page-content">
<z-paging ref="paging" :refresher-enabled="false" :auto-clean-list-when-reload="false"
:auto-scroll-to-top-when-reload="false" v-model="dataList" @query="queryList">
<view style="z-index: 10000;position: sticky;" :style="'top:0px'">
<view class="top-bar">
<nut-button type="primary" block plain @click="navigateTo('/pages/config/goodsAdd')">
新增备忘录
</nut-button>
</view>
</view>
<view class="todo-item" v-for="(item, index) in dataList" :key="index">
<view class="goods-item-content">
<!-- @click="navigateTo('/pages/control/goods/edit?id=' + item.goods_id)" -->
<view class="goods-item-content-header">
<view style="font-size: 24rpx">记录人:</view>
<nut-tag custom-color="#1a1a1a">{{ item.user.staff_name }}</nut-tag>
</view>
<view class="goods-item-content-body">
<view class="goods-item-content-body-desc">
{{item.content}}
</view>
</view>
<view class="goods-item-content-footer">
<view style="font-size: 24rpx; color: red;" v-if="item.status.value === 0">
状态:<text>{{item.status.text}}</text>
</view>
<view style="font-size: 24rpx; color:chartreuse;" v-else>
状态:<text>{{item.status.text}}</text>
</view>
<view class="goods-item-content-footer-btn">
<nut-button size="small" type="success" v-if="item.status.value == 0"
@click="onMark(item.goods_id,'1')">
标记已办
</nut-button>
<nut-button size="small" type="danger" v-if="item.status.value == 1"
@click="onMark(item.goods_id,'0')">
标记未办
</nut-button>
</view>
</view>
</view>
</view>
</z-paging>
</view>
</template>
<script setup>
import {
ref,
reactive,
onMounted,
computed
} from 'vue'
import {
onLoad,
onShow,
} from '@dcloudio/uni-app'
import {
fetchTodoList
} from '@/api/index';
import {
navigateTo,
} from '@/utils/helper';
// zp
const paging = ref(null);
// 列表
const dataList = ref([]);
// 获取列表
const queryList = (pageNo, pageSize) => {
const params = {
pageSize,
page: pageNo,
}
console.log(params);
fetchTodoList(params).then(res => {
console.log('res=>', res.list);
paging.value.complete(res.list);
}).catch(res => {
paging.value.complete(false);
});
};
const init = () => {
console.log('init111');
// // 加载默认筛选项内容
// fetchFilterParmas().then(res => {
// console.log(res);
// // 处理成色
// let degree_params = res.degree_list;
// state.degree_params = degree_params.reduce((it, cit) => {
// it.push({
// text: cit.degree_name,
// value: cit.degree_id
// });
// return it;
// }, state.degree_params) || [];
// // 产品类型
// state.type_params = res.type_list
// // 产品下品牌列表
// state.drop_down_options = res.drop_down_options
// state.o_drop_down_options = res.o_drop_down_options
// })
}
onShow(() => {
console.log("onshow---");
console.log('paging.value', paging.value);
if (paging.value) {
paging.value.refresh();
}
});
onMounted(() => {
init();
})
</script>
<style scoped lang="scss">
.page-content {
min-height: 100vh;
background-color: #f2f3f5;
--nut-menu-bar-box-shadow: none;
--nut-menu-item-content-padding: 20rpx;
--nut-menu-item-content-max-height: 900rpx;
// --nut-searchbar-input-padding:5px 0 5px 13px;
--nut-searchbar-input-height: 40px;
}
:deep(.titleClass) .nut-menu__title-text {
font-size: 30rpx;
font-weight: bold;
color: black;
}
.top-bar {
background: #fff;
// padding: 20rpx;
align-items: center;
text-align: center;
padding: 20rpx 60rpx;
// display: flex;
// justify-content: space-between;
// border-top: 1px solid #eee;
// position: sticky;
// bottom: 0;
// z-index: 999;
}
.todo-item {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 20rpx;
background-color: #ffffff;
margin-bottom: 20rpx;
gap: 20rpx;
.goods-item-content {
// width: 100%;
display: flex;
flex: 1;
flex-direction: column;
justify-content: space-between;
/* 首尾贴边,中间均分 */
// gap: 15px;
.goods-item-content-header {
display: flex;
align-items: center;
padding: 6rpx 0;
gap: 20rpx;
}
.goods-item-content-body {
padding: 6rpx 0;
.goods-item-content-body-desc {
color: #7c7c7c;
font-size: 26rpx;
/* 关键属性 */
display: -webkit-box;
/* 使用弹性盒子布局 */
-webkit-box-orient: vertical;
/* 垂直方向排列 */
-webkit-line-clamp: 2;
/* 限制显示两行 */
overflow: hidden;
/* 超出部分隐藏 */
text-overflow: ellipsis;
/* 超出时显示省略号 */
}
}
.goods-item-content-stock {
display: flex;
justify-content: space-between;
.goods-item-content-stock-desc {
font-size: 26rpx;
color: #999999;
}
.goods-item-content-status-desc {
font-size: 26rpx;
color: red;
}
}
.goods-item-content-footer {
padding: 6rpx 0;
display: flex;
justify-content: space-between;
align-items: center;
// width: 100%;
// flex-direction: row;
.goods-item-content-footer-btn {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10rpx;
.share-btn {
border-radius: 50rpx;
border: 2rpx solid red;
font-size: 26rpx;
align-items: center;
height: 54rpx;
color: red;
display: flex;
justify-content: center;
}
}
}
}
}
.filter-types {
display: flex;
justify-content: flex-start;
flex-direction: row;
align-items: center;
overflow: auto;
gap: 10rpx;
padding: 10rpx;
// position: fixed;
// top: 0;
height: 60rpx;
// z-index: 9999;
background-color: #fff;
border-bottom: 2rpx solid gainsboro;
border-top: 2rpx solid gainsboro;
.filter-type-inner {
align-items: center;
background-color: rgba(0, 0, 0, .05);
border-radius: 16rpx;
box-sizing: border-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex: 0 0 auto;
font-size: 28rpx;
gap: 15rpx;
padding: 10rpx 20rpx;
// image {
// height: 22px;
// width: 22px;
// }
}
.filter-type-inner.active {
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
}
.tabs-container {
display: flex;
.tab-pane-inner {
height: 600rpx;
}
.tabs-inner {
overflow-y: scroll;
height: 600rpx;
width: 160rpx;
background-color: #F5F5F5;
.tab-inner {
display: flex;
height: 60rpx;
padding: 10rpx;
font-size: 28rpx;
display: flex;
align-items: center;
background: #F5F5F5;
text {
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
}
}
.tab-inner-active {
// background: #FFF;
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
}
}
.degree-inner {
display: flex;
flex: 1;
flex-wrap: wrap;
// gap: 20rpx;
gap: 10rpx;
// padding: 11px;
width: 100%;
margin-bottom: 60rpx;
}
.degree-item {
align-items: center;
background-color: rgba(0, 0, 0, .05);
border-radius: 10rpx;
box-sizing: border-box;
display: flex;
flex: 0 0 auto;
font-size: 26rpx;
gap: 10rpx;
justify-content: center;
min-height: 80rpx;
width: calc(50% - 10rpx);
}
.degree-item.active {
background-color: rgba(250, 44, 25, .1);
color: var(--nutui-color-primary);
}
.product-btns {
display: flex;
width: 100%;
padding: 20rpx 0;
// border-bottom: 2rpx solid gainsboro;
// border-top: 2rpx solid gainsboro;
.reset {
flex: 1;
}
.confirm {
flex: 2;
}
}
.degree-btns {
display: flex;
width: 100%;
.reset {
flex: 1;
/* 重置按钮占 1 份 */
}
.confirm {
flex: 2;
/* 确认按钮占 2 份 */
}
}
.main-nav-container {
display: flex;
justify-content: space-between;
background-color: #fff;
padding: 20rpx;
}
.nav-button {
display: flex;
align-items: center;
width: 45%;
height: 160rpx;
border-radius: 20rpx;
overflow: hidden;
padding: 0 10rpx;
}
.phone-button {
background: linear-gradient(135deg, #6a5ae0, #8d7bfb);
color: white;
}
.parts-button {
background: linear-gradient(135deg, #ff6b6b, #ee5253);
color: white;
}
.nav-button-bg {
position: absolute;
right: 0;
top: 0;
height: 100%;
width: 50%;
opacity: 0.2;
object-fit: cover;
}
.nav-button-icon {
width: 90rpx;
height: 90rpx;
margin-right: 20rpx;
// border-radius: 20rpx;
z-index: 2;
}
.nav-button-content {
z-index: 2;
display: flex;
flex-direction: column;
}
.nav-button-title {
font-size: 34rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
.nav-button-desc {
font-size: 24rpx;
opacity: 0.85;
}
</style>