第一次上传

This commit is contained in:
Ls
2026-03-09 16:39:03 +08:00
commit 3d9efaf15c
924 changed files with 326227 additions and 0 deletions

View File

@@ -0,0 +1,303 @@
<template>
<view style="margin: 20rpx 30rpx;">
<view class="" style="border-radius: 20rpx; background-color: #fff; padding: 20rpx; ">
<view class="" style="font-weight: 600; font-size: 30rpx;">
商品封面
</view>
<view class="" @click="uploadFImg(650,650,'MerchShow','showImg')"
style=" margin-top: 20rpx; width: 100%; height: 650rpx; box-sizing: content-box; border: 4rpx dashed #e2e2e2; border-radius: 20rpx; overflow: hidden; ">
<image v-if="goodsInfo.img" :src="Service.GetMateUrlByImg(goodsInfo.img)" mode="aspectFill" style="width: 100%; height: 100%; " alt="" />
<view class="" v-else
style="width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; ">
<img :src="Service.GetIconImg('/static/goods/photo.png')" style="width: 80rpx; height: 80rpx;"
alt="" />
<view class="" style=" color: #666666; font-size: 28rpx;">
上传图片
</view>
</view>
</view>
</view>
<view class="" style=" margin-top: 20rpx; border-radius: 20rpx; background-color: #fff; padding: 20rpx; ">
<up-form labelWidth='90' :labelStyle="{'font-weight': 600 }" labelPosition="top" :model="goodsInfo"
ref="form1">
<up-form-item label="商品名称" prop="goodsInfo.name" :borderBottom="false" ref="item1">
<up-input v-if="!upImgShow" :customStyle="{'border-radius': '15rpx' }" placeholder="请输入商品名称" border='surround'
v-model="goodsInfo.name"></up-input>
</up-form-item>
<up-form-item label="价格" prop="goodsInfo.sex" :borderBottom="false">
<up-input v-if="!upImgShow" prefixIcon='rmb' :prefixIconStyle="{ 'color':'#000','font-weight': 600 }"
:customStyle="{'border-radius': '15rpx' }" placeholder="请输入价格" v-model="goodsInfo.price"
border="surround"></up-input>
</up-form-item>
<up-form-item label="描述" prop="goodsInfo.sex" :borderBottom="false">
<up-textarea v-if="!upImgShow" v-model="goodsInfo.brief" placeholder="请输入商品描述"></up-textarea>
</up-form-item>
<!-- <up-form-item label="分类" prop="goodsInfo.sex" :borderBottom="false">
<view class=""
style="padding: 12rpx 18rpx; border-radius: 7px; border: 1rpx solid #e2e2e2; width: 100%; ">
<view class="" @click="showClass=true"
style="display: flex; height: 48rpx; align-items: center; justify-content: space-between;">
<view class="" :style="{ 'color':goodsInfo.class? '#000':'#c0c4cc' } ">
{{ goodsInfo.class?goodsInfo.class:'请选择分类'}}
</view>
<view class="">
<up-icon name="arrow-right" size="14" color='#666666' :bold='true'></up-icon>
</view>
</view>
</view>
</up-form-item> -->
<up-form-item label="状态" prop="goodsInfo.status" :borderBottom="false">
<up-radio-group :modelValue="goodsInfo.status" placement="row">
<up-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in radiolist" :key="index"
:label="item.name" :name="item.value" @change="radioChange">
</up-radio>
</up-radio-group>
</up-form-item>
<!-- <up-form-item label="标签" :borderBottom="false">
<view v-for="(item, index) in tabsList" @click="clickTab(index)" :key="index"
:class="{active:!goodsInfo.tabs.includes(index),actived:goodsInfo.tabs.includes(index)}">
{{item}}
</view>
</up-form-item> -->
</up-form>
</view>
<view class="" style="width: 100%; height: 200rpx;">
</view>
<!-- 底部操作按钮 -->
<view class="action-buttons">
<u-button type="primary" @click="Service.GoPageBack()" :custom-style="ButtonStyle">取消</u-button>
<u-button type="primary" @click="save()" :custom-style="ButtonStyle">{{ goodsInfo.goodsId?'修改':'添加' }}</u-button>
</view>
<!-- <up-picker :show="showClass" @cancel="showClass=!showClass" @confirm="confirmClass"
:columns="columns"></up-picker> -->
</view>
<ImageCropperFunc style="z-index: 200;" :show="upImgShow" :url="upImgUrl" :imgName="imgName" :width="upImgwidth"
:height="upImgheight" :upType="upImgType" :retFun="upImgData">
</ImageCropperFunc>
</template>
<script setup lang="ts">
import { onShow, onLoad } from "@dcloudio/uni-app";
import { Service } from "@/Service/Service"
import { ref } from "vue";
import ImageCropperFunc from "@/components/ImageCropper"
import { vpMerchService } from '@/Service/vp/vpMerchService'
interface Goods{
img:string
name: string
price: number
brief: string
status: number
goodsId:string
}
let goodsInfo = ref<Goods>({
img:'',
name: "",
price: null,
brief: "",
status:1,
goodsId:''
})
let radioStatus=ref('上架中')
let showClass = ref(false)
const columns = ref([
['中国', '美国', '日本']
]);
const radiolist = ref([
{
name: '上架中',
value: 1
},
{
name: '已下架',
value: 0
}
]);
let tabsList = ref([
'新品',
'热销',
'推荐',
'折扣',
'特惠'
])
const ButtonStyle = ref({
backgroundColor: '#FF6600',
borderColor: '#FF6600',
color: '#FFFFFF',
fontSize: '28rpx',
height: '75rpx',
borderRadius: '45rpx',
marginLeft: '20rpx'
});
// 裁剪图片参数
let upImgShow = ref<boolean>(false)
let upImgUrl = ref<string>('')
let upImgwidth = ref<number>(0)
let upImgheight = ref<number>(0)
let upImgType = ref<string>('')
let imgName = ref<string>('')
onLoad((dada:any) => {
if(dada.goodsId){
goodsInfo.value.goodsId=dada.goodsId
getData()
}
});
onShow(() => {
});
const getData=()=>{
vpMerchService.GetGoodsInfo(goodsInfo.value.goodsId,1).then(res=>{
goodsInfo.value=res.data.goodsInfo
console.log(goodsInfo.value.status);
})
}
// const confirmClass = (e) => {
// goodsInfo.value.class = e.value[0]
// showClass.value = !showClass.value
// }
const radioChange = (e) => {
goodsInfo.value.status = e
}
// const clickTab = (e : any) => {
// if (goodsInfo.value.tabs.includes(e)) {
// let a = goodsInfo.value.tabs.findIndex((x) => {
// return x == e
// })
// goodsInfo.value.tabs.splice(a, 1)
// return
// }
// goodsInfo.value.tabs.push(e)
// }
const save=()=>{
if(!goodsInfo.value.img){
Service.Msg('请上传图片!')
return
}
if(!goodsInfo.value.name){
Service.Msg('请输入商品名称!')
return
}
if(!goodsInfo.value.price){
Service.Msg('请输入商品价格!')
return
}
if(!goodsInfo.value.brief){
Service.Msg('请输入商品描述!')
return
}
// if(goodsInfo.value.status){
// Service.Msg('请选择商品当前状态!')
// return
// }
vpMerchService.UpdateMerchGoods(goodsInfo.value.goodsId==''?'':goodsInfo.value.goodsId,goodsInfo.value.name,goodsInfo.value.img,goodsInfo.value.price,goodsInfo.value.brief,goodsInfo.value.status).then(res=>{
if(res.code==0){
Service.Msg(goodsInfo.value.goodsId?'修改成功':'添加成功')
setTimeout(()=>{
Service.GoPageBack()
},2500)
}
})
}
const uploadFImg = (width : any, height : any, Type : any, Name : any) => {
uni.chooseImage({
count: 1, // 最多选择3张图片
sizeType: ['original', 'compressed'], // 支持原图和压缩图
sourceType: ['album', 'camera'], // 可从相册选择或使用相机拍照
success: function (res) {
let path = res.tempFiles[0].path
upImgUrl.value = path
upImgwidth.value = width
upImgheight.value = height
upImgType.value = Type
imgName.value = Name
upImgShow.value = true
},
fail: function (err) {
console.error('选择失败:', err.errMsg);
}
})
}
const upImgData = (e : any) => {
upImgShow.value = false
goodsInfo.value.img = e.url
}
</script>
<style lang="scss">
page {
background-color: #f6f6f6;
}
.active {
color: #b5b5b5;
border: 1rpx solid #b5b5b5;
margin-right: 15rpx;
border-radius: 23rpx;
padding: 5rpx 16rpx;
width: fit-content;
}
.actived {
color: var(--nav-mian);
border: 1rpx solid var(--nav-mian);
margin-right: 15rpx;
border-radius: 23rpx;
padding: 5rpx 16rpx;
width: fit-content;
}
/* 底部操作按钮 */
.action-buttons {
display: flex;
padding: 30rpx 30rpx;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background-color: #ffffff;
border-top: 1rpx solid #f0f0f0;
}
</style>

View File

@@ -0,0 +1,27 @@
import { Service } from '@/Service/Service';
/*****用户*****/
class vpUserService {
private static GetUserInfoPath : string = '/User/GetUserInfo';
/*****获取用户信息*****/
static GetUserInfo() {
var result = Service.Request(this.GetUserInfoPath, 'GET', {});
return result;
}
private static GetUserAccInfoPath : string = '/User/GetUserAccInfo';
/*****获取用户账户信息*****/
static GetUserAccInfo(page : number) {
var result = Service.Request(this.GetUserAccInfoPath, 'GET', { page });
return result;
}
private static UpdateUserPath : string = '/User/UpdateUser';
/*****获取用户账户信息*****/
static UpdateUser(headImg:string,nick:string,sex:string,phone:string) {
var result = Service.Request(this.UpdateUserPath, 'POST', { headImg,nick,sex,phone });
return result;
}
}
export { Service, vpUserService };

View File

@@ -0,0 +1,241 @@
{
"easycom": {
// 注意一定要放在custom里否则无效https://ask.dcloud.net.cn/question/131175
"custom": {
"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
"^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
}
},
"pages": [ //pages数组中第一项表示应用启动页参考https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationBarBackgroundColor": "#36394D",
"navigationStyle": "custom",
"backgroundColor": "#F8F8F8"
}
},
{
"path": "pages/index/community",
"style": {
"navigationBarTitleText": "社区",
"navigationStyle": "custom"
}
},
{
"path": "pages/index/user",
"style": {
"navigationBarTitleText": "我的",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/shop",
"style" :
{
"navigationBarTitleText" : "积分商城"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "v派商家",
"navigationBarBackgroundColor": "#fff",
"backgroundColor": "#F8F8F8"
},
"subPackages": [{
"root": "pages/community",
"pages": [{
"path": "noticeList",
"style": {
"navigationBarTitleText": "社区公告"
}
},
{
"path": "merchantCom",
"style": {
"navigationBarTitleText": "社区商家"
}
},
{
"path" : "merchantDetail",
"style" :
{
"navigationBarTitleText" : "美食小店"
}
}
]
},
{
"root": "pages/goods",
"pages": [
{
"path": "integralGoods",
"style": {
"navigationBarTitleText": "积分商品"
}
},
{
"path": "merchant",
"style": {
"navigationBarTitleText": "热门商家"
}
},
{
"path" : "goodsDetail",
"style" :
{
"navigationBarTitleText" : "商品详情"
}
},
{
"path" : "goodsContro",
"style" :
{
"navigationBarTitleText" : "商品管理"
}
},
{
"path" : "addGoods",
"style" :
{
"navigationBarTitleText" : "添加商品"
}
},
{
"path" : "Pay",
"style" :
{
"navigationBarTitleText" : "付款"
}
}]
},
{
"root": "pages/article",
"pages": [{
"path": "articleCom",
"style": {
"navigationBarTitleText": "社区公告"
}
},
{
"path": "newsList",
"style": {
"navigationBarTitleText": "新闻公告"
}
},
{
"path": "news",
"style": {
"navigationBarTitleText": "新闻详情"
}
}
]
}, {
"root": "pages/userFunc",
"pages": [{
"path" : "setData",
"style" :
{
"navigationBarTitleText" : "编辑资料"
}
},
{
"path" : "integration",
"style" :
{
"navigationBarTitleText" : "积分明细"
}
},
{
"path" : "trade",
"style" :
{
"navigationBarTitleText" : "交易记录"
}
},
{
"path" : "editStore",
"style" :
{
"navigationBarTitleText" : "编辑店铺"
}
},
{
"path" : "statistics",
"style" :
{
"navigationBarTitleText" : "数据统计"
}
},
{
"path" : "set",
"style" :
{
"navigationBarTitleText" : "设置"
}
},
{
"path" : "bind",
"style" :
{
"navigationBarTitleText" : "绑定手机号"
}
},
{
"path" : "password",
"style" :
{
"navigationBarTitleText" : "修改支付密码"
}
},
{
"path" : "storeInter",
"style" :
{
"navigationBarTitleText" : "积分明细"
}
}
]
}
],
"tabBar": {
"color": "#8a8a8a",
"selectedColor": "#EC754B",
"backgroundColor": "#ffffff",
"list": [{
"text": "首页",
"pagePath": "pages/index/index",
"iconPath": "/static/tabBar/home.png",
"selectedIconPath": "/static/tabBar/homed.png"
},
// {
// "text": "社区",
// "pagePath": "pages/index/community",
// "iconPath": "/static/tabBar/community.png",
// "selectedIconPath": "/static/tabBar/communityed.png"
// }
// ,
{
"text": "积分商城",
"pagePath": "pages/index/shop",
"iconPath": "/static/tabBar/shop.png",
"selectedIconPath": "/static/tabBar/shoped.png"
},
{
"text": "个人中心",
"pagePath": "pages/index/user",
"iconPath": "/static/tabBar/user.png",
"selectedIconPath": "/static/tabBar/usered.png"
}]
}
}

View File

@@ -0,0 +1,177 @@
<template>
<view class="uni-calendar-item__weeks-box" :class="{
'uni-calendar-item--disable':weeks.disable,
'uni-calendar-item--before-checked-x':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked-x':weeks.afterMultiple,
}" @click="choiceDate(weeks)" @mouseenter="handleMousemove(weeks)">
<view class="uni-calendar-item__weeks-box-item" :class="{
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && (calendar.userChecked || !checkHover),
'uni-calendar-item--checked-range-text': checkHover,
'uni-calendar-item--before-checked':weeks.beforeMultiple,
'uni-calendar-item--multiple': weeks.multiple,
'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable,
}">
<text v-if="selected && weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
<text class="uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text">{{weeks.date}}</text>
</view>
<view :class="{'uni-calendar-item--today': weeks.isToday}"></view>
</view>
</template>
<script>
export default {
props: {
weeks: {
type: Object,
default () {
return {}
}
},
calendar: {
type: Object,
default: () => {
return {}
}
},
selected: {
type: Array,
default: () => {
return []
}
},
checkHover: {
type: Boolean,
default: false
}
},
methods: {
choiceDate(weeks) {
this.$emit('change', weeks)
},
handleMousemove(weeks) {
this.$emit('handleMouse', weeks)
}
}
}
</script>
<style lang="scss" >
$uni-primary: #007aff !default;
.uni-calendar-item__weeks-box {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
margin: 1px 0;
position: relative;
}
.uni-calendar-item__weeks-box-text {
font-size: 14px;
// font-family: Lato-Bold, Lato;
font-weight: bold;
color: darken($color: $uni-primary, $amount: 40%);
}
.uni-calendar-item__weeks-box-item {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
width: 40px;
height: 40px;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-calendar-item__weeks-box-circle {
position: absolute;
top: 5px;
right: 5px;
width: 8px;
height: 8px;
border-radius: 8px;
background-color: #dd524d;
}
.uni-calendar-item__weeks-box .uni-calendar-item--disable {
cursor: default;
}
.uni-calendar-item--disable .uni-calendar-item__weeks-box-text-disable {
color: #D1D1D1;
}
.uni-calendar-item--today {
position: absolute;
top: 10px;
right: 17%;
background-color: #dd524d;
width:6px;
height: 6px;
border-radius: 50%;
}
.uni-calendar-item--extra {
color: #dd524d;
opacity: 0.8;
}
.uni-calendar-item__weeks-box .uni-calendar-item--checked {
background-color: $uni-primary;
border-radius: 50%;
box-sizing: border-box;
border: 3px solid #fff;
}
.uni-calendar-item--checked .uni-calendar-item--checked-text {
color: #fff;
}
.uni-calendar-item--multiple .uni-calendar-item--checked-range-text {
color: #333;
}
.uni-calendar-item--multiple {
background-color: #F6F7FC;
// color: #fff;
}
.uni-calendar-item--multiple .uni-calendar-item--before-checked,
.uni-calendar-item--multiple .uni-calendar-item--after-checked {
background-color: $uni-primary;
border-radius: 50%;
box-sizing: border-box;
border: 3px solid #F6F7FC;
}
.uni-calendar-item--before-checked .uni-calendar-item--checked-text,
.uni-calendar-item--after-checked .uni-calendar-item--checked-text {
color: #fff;
}
.uni-calendar-item--before-checked-x {
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
box-sizing: border-box;
background-color: #F6F7FC;
}
.uni-calendar-item--after-checked-x {
border-top-right-radius: 50px;
border-bottom-right-radius: 50px;
background-color: #F6F7FC;
}
</style>

View File

@@ -0,0 +1,91 @@
<template>
<text class="uni-icons" :style="styleObj">
<slot>{{unicode}}</slot>
</text>
</template>
<script>
import { fontData, IconsDataItem } from './uniicons_file'
/**
* Icons 图标
* @description 用于展示 icon 图标
* @tutorial https://ext.dcloud.net.cn/plugin?id=28
* @property {Number} size 图标大小
* @property {String} type 图标图案,参考示例
* @property {String} color 图标颜色
* @property {String} customPrefix 自定义图标
* @event {Function} click 点击 Icon 触发事件
*/
export default {
name: "uni-icons",
props: {
type: {
type: String,
default: ''
},
color: {
type: String,
default: '#333333'
},
size: {
type: [Number, String],
default: 16
},
fontFamily: {
type: String,
default: ''
}
},
data() {
return {};
},
computed: {
unicode() : string {
let codes = fontData.find((item : IconsDataItem) : boolean => { return item.font_class == this.type })
if (codes !== null) {
return codes.unicode
}
return ''
},
iconSize() : string {
const size = this.size
if (typeof size == 'string') {
const reg = /^[0-9]*$/g
return reg.test(size as string) ? '' + size + 'px' : '' + size;
// return '' + this.size
}
return this.getFontSize(size as number)
},
styleObj() : UTSJSONObject {
if (this.fontFamily !== '') {
return { color: this.color, fontSize: this.iconSize, fontFamily: this.fontFamily }
}
return { color: this.color, fontSize: this.iconSize }
}
},
created() { },
methods: {
/**
* 字体大小
*/
getFontSize(size : number) : string {
return size + 'px';
},
},
}
</script>
<style scoped>
@font-face {
font-family: UniIconsFontFamily;
src: url('./uniicons.ttf');
}
.uni-icons {
font-family: UniIconsFontFamily;
font-size: 18px;
font-style: normal;
color: #333;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB