parent
8a67e00e54
commit
fbbef11a37
10 changed files with 689 additions and 64 deletions
@ -1,54 +0,0 @@ |
||||
import request from '@/apis/request.js' |
||||
const { get, post } = request |
||||
|
||||
export const queryCustomer = (data) => { |
||||
return post('nakadai/nakadai/customer/queryCustomer', data) |
||||
} |
||||
|
||||
export const list = (data) => { |
||||
return post('nakadai/nakadai/applets/customer/getCustomerListBasedOnBusinessManagerId', data) |
||||
} |
||||
|
||||
export const all = (data) => { |
||||
return post('nakadai/nakadai/applets/customer/customerList', data) |
||||
} |
||||
|
||||
export const queryCustomerDetails = (data) => { |
||||
return get('nakadai/nakadai/customer/queryCustomerDetails', data) |
||||
} |
||||
|
||||
export const querySchool = (data) => { |
||||
return get('nakadai/nakadai/school/querySchool', data) |
||||
} |
||||
|
||||
export const queryIndustryClass = (data) => { |
||||
return get('nakadai/nakadai/hrIndustryClass/queryIndustryClass', data) |
||||
} |
||||
|
||||
export const queryIndustry = (data) => { |
||||
return get('nakadai/nakadai/hrIndustry/queryIndustry', data) |
||||
} |
||||
|
||||
export const queryCustomerIsExists = (data) => { |
||||
return get('nakadai/nakadai/customer/queryCustomerIsExists', data) |
||||
} |
||||
|
||||
export const addCustomer = (data) => { |
||||
return post('nakadai/nakadai/customer/addCustomer', data) |
||||
} |
||||
|
||||
export const updateCustomer = (data) => { |
||||
return post('nakadai/nakadai/customer/updateCustomer', data) |
||||
} |
||||
|
||||
export const getProductsSubscribedByCustomers = (data) => { |
||||
return get('nakadai/nakadai/customer/getProductsSubscribedByCustomers', data) |
||||
} |
||||
|
||||
export const getTeamsByAccountId = (data) => { |
||||
return post('nakadai/nakadai/applets/customer/getTeamsByAccountId', data) |
||||
} |
||||
|
||||
export const getTheBusinessManagerIdsUnderTheTeam = id => { |
||||
return post(`nakadai/nakadai/applets/customer/getTheBusinessManagerIdsUnderTheTeam?id=${id}`) |
||||
} |
@ -0,0 +1,24 @@ |
||||
import request from '@/apis/request.js' |
||||
const { get, post } = request |
||||
|
||||
export const batchDelete = (data) => { |
||||
return post('nakadai/prod/batchDelete', data) |
||||
} |
||||
export const info = (data) => { |
||||
return get('nakadai/prod/info', data) |
||||
} |
||||
export const page = (data) => { |
||||
return get('nakadai/prod/page', data) |
||||
} |
||||
export const prodStatus = (prodId, prodStatus) => { |
||||
return post(`nakadai/prod/prodStatus?prodId=${prodId}&prodStatus=${prodStatus}`) |
||||
} |
||||
export const save = (data) => { |
||||
return post('nakadai/prod/save', data) |
||||
} |
||||
export const update = (data) => { |
||||
return post('nakadai/prod/update', data) |
||||
} |
||||
export const categoryList = (data) => { |
||||
return get('nakadai/category/list', data) |
||||
} |
@ -0,0 +1,159 @@ |
||||
<template> |
||||
<view> |
||||
<!-- 选择规格弹窗 --> |
||||
<uni-popup ref="popup" background-color="#fff" type="bottom" @change="change"> |
||||
<view class="goodsPopup"> |
||||
<view class="title">发送询价单给商家</view> |
||||
<view class="tips">请填写您需要采购的数量及需求,方便商家更好地为你造型报价</view> |
||||
|
||||
<ul class="tab"> |
||||
<li v-for="(tab, i) in tabs" :key="i" :class="{active: curTab === tab.id}" @click="tabChange(tab)">{{ tab.name }}</li> |
||||
</ul> |
||||
|
||||
<view class="content"> |
||||
<scroll-view v-if="!curTab" class="goods-wrap" scroll-y :show-scrollbar="false"> |
||||
<view class="goods" v-for="(item, i) in goods" :key="i"> |
||||
<view class="info"> |
||||
<view class="item"> |
||||
<view class="name">{{ item.name }}</view> |
||||
<view class="meta">¥23.00</view> |
||||
</view> |
||||
<view class="item"> |
||||
<view class="name">{{ item.name }}</view> |
||||
<view class="meta">库存12</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<u-number-box :value="item.price" :max="100" :min="1"></u-number-box> |
||||
</view> |
||||
</scroll-view> |
||||
<textarea v-else class="msg" placeholder="请输入"></textarea> |
||||
</view> |
||||
|
||||
<view class="btns"> |
||||
<view class="btn" @click="nextStep">个人采购</view> |
||||
<view class="btn" @click="nextStep">组织采购</view> |
||||
<view class="btn back" @click="back">返回</view> |
||||
</view> |
||||
</view> |
||||
</uni-popup> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { page } from '@/apis/modules/goods.js' |
||||
export default { |
||||
name:"order", |
||||
props: { |
||||
goodsPopup: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
}, |
||||
data() { |
||||
return { |
||||
tabs: [ |
||||
{ |
||||
id: 0, |
||||
name: '按产品' |
||||
}, |
||||
{ |
||||
id: 1, |
||||
name: '留言商家' |
||||
}, |
||||
], |
||||
curTab: 0, |
||||
goods: [], |
||||
}; |
||||
}, |
||||
onShow() { |
||||
// this.getGoods() |
||||
}, |
||||
methods: { |
||||
// 获取商品列表 |
||||
async getGoods() { |
||||
const { data } = await page() |
||||
this.goods = data.records |
||||
}, |
||||
change() { |
||||
|
||||
}, |
||||
// 返回 |
||||
back() { |
||||
this.$refs.popup.close() |
||||
}, |
||||
// tab切换 |
||||
tabChange(tab) { |
||||
this.curTab = tab.id |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.goodsPopup { |
||||
position: relative; |
||||
padding: 30rpx; |
||||
.title { |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
} |
||||
.tips { |
||||
margin: 20rpx 0 40rpx; |
||||
font-size: 24rpx; |
||||
color: #a0a0a0; |
||||
} |
||||
.content { |
||||
height: 50vh; |
||||
} |
||||
.goods-wrap { |
||||
height: 100%; |
||||
margin-bottom: 100rpx; |
||||
} |
||||
.goods { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
.info { |
||||
display: inline-flex; |
||||
margin-bottom: 20rpx; |
||||
.name { |
||||
font-size: 26rpx; |
||||
color: #333; |
||||
} |
||||
.meta { |
||||
font-size: 24rpx; |
||||
color: #ccc; |
||||
} |
||||
} |
||||
.msg { |
||||
width: 100%; |
||||
height: 100%; |
||||
padding: 30rpx; |
||||
font-size: 24rpx; |
||||
color: #333; |
||||
border: 1px solid #dedede; |
||||
border-radius: 4px; |
||||
box-sizing: border-box; |
||||
} |
||||
.btns { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
margin-top: 30rpx; |
||||
.btn { |
||||
padding: 12rpx 40rpx; |
||||
font-size: 28rpx; |
||||
color: #fff; |
||||
background-color: $uni-primary; |
||||
border-radius: 20px; |
||||
} |
||||
.back { |
||||
padding: 12rpx 26rpx; |
||||
color: #333; |
||||
background-color: #fff; |
||||
border: 1px solid #ccc; |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,264 @@ |
||||
<template> |
||||
<view class="page"> |
||||
<view class="block"> |
||||
<view class="form-list edit-form"> |
||||
<view class="line"> |
||||
<view class="name">商品名称</view> |
||||
<input type="text" placeholder="请输入商品名称" v-model="form.prodName" /> |
||||
</view> |
||||
<view class="line"> |
||||
<view class="name">产品分类</view> |
||||
<view class="inline"> |
||||
<uni-data-picker class="picker-input" :clear-icon="false" placeholder="请选择产品分类" popup-title="请选择产品分类" preload :localdata="provinces" :map="{text: 'provinceName', value: 'provinceName'}" v-model="form.categoryId"></uni-data-picker> |
||||
</view> |
||||
</view> |
||||
<view class="py"> |
||||
<uni-file-picker v-model="pic" limit="5" title="请上传封面图片,至少一张" :auto-upload="false" @select="uploadDes"></uni-file-picker> |
||||
</view> |
||||
|
||||
</view> |
||||
</view> |
||||
|
||||
<view class="block"> |
||||
<view class="form-list edit-form"> |
||||
<view class="line textarea-line no-bd"> |
||||
<textarea placeholder="描述一下宝贝的品牌型号、货品来源..." v-model="form.brief"></textarea> |
||||
</view> |
||||
<view class="py"> |
||||
<uni-file-picker v-model="pic" limit="10" title="添加优质图片" :auto-upload="false" @select="uploadDes"></uni-file-picker> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
|
||||
<view class="title">产品规格</view> |
||||
<view v-for="(item, i) in form.skuList" :key="i" class="block"> |
||||
<view class="form-list edit-form"> |
||||
<view class="line"> |
||||
<view class="name">规格名称</view> |
||||
<input type="text" placeholder="请输入规格名称" v-model="item.skuName" /> |
||||
</view> |
||||
<view class="line"> |
||||
<view class="name">价格</view> |
||||
<view class="price-select" @click="showPrice">请选择</view> |
||||
</view> |
||||
<view class="line"> |
||||
<view class="name">库存</view> |
||||
<uni-number-box v-model="item.stocks" :max="100" :min="1"></uni-number-box> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="plus-sku"> |
||||
<uni-icons class="icon" type="plus" size="30" color="#007eff" @click="addSku"></uni-icons> |
||||
</view> |
||||
|
||||
|
||||
<view class="btns"> |
||||
<view class="btn" @click="submit(3)">存草稿</view> |
||||
<view class="btn publish" @click="submit(0)">发布</view> |
||||
</view> |
||||
|
||||
|
||||
<uni-popup ref="popup" background-color="#fff" type="bottom"> |
||||
<view class="block"> |
||||
<view class="form-list edit-form"> |
||||
<view class="line"> |
||||
<view class="name">售价:</view> |
||||
<input type="text" placeholder="请输入售价" v-model="form.prodName" /> |
||||
</view> |
||||
<view class="line"> |
||||
<view class="name">优惠价:</view> |
||||
<input type="text" placeholder="请输入优惠价" v-model="form.prodName" /> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</uni-popup> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { queryProvince, queryCity, queryTeamInfo, updateTeamInfo, enterpriseCertificationStatus } from '@/apis/modules/user.js' |
||||
import { save, update, info, categoryList } from '@/apis/modules/goods.js' |
||||
import OSS from '@/libs/Oss/upload' |
||||
export default { |
||||
data() { |
||||
return { |
||||
openId: uni.getStorageSync('openId'), |
||||
info: {}, |
||||
form: { |
||||
brief: '', |
||||
categoryId: '', |
||||
content: '', |
||||
oriPrice: '', |
||||
pic: '', |
||||
price: '', |
||||
prodName: '', |
||||
skuList: [ |
||||
{ |
||||
actualStocks: '', |
||||
oriPrice: '', |
||||
price: '', |
||||
skuName: '', |
||||
stocks: '', |
||||
} |
||||
], |
||||
totalStocks: '' |
||||
}, |
||||
originSku: {}, |
||||
pic: [], |
||||
submiting: false, |
||||
uploading: false, |
||||
classifications: [], |
||||
} |
||||
}, |
||||
computed: { |
||||
// 平台名字 |
||||
platformName() { |
||||
return this.info.platformSource === '6' ? '供应商' : this.info.platformSource === '5' ? '幼儿园' : '' |
||||
}, |
||||
}, |
||||
onLoad() { |
||||
this.originSku = JSON.parse(JSON.stringify(this.form.skuList[0])) |
||||
this.getCategory() |
||||
// this.getProvince() |
||||
}, |
||||
methods: { |
||||
// 企业认证信息 |
||||
async getEnterInfo() { |
||||
const { data } = await enterpriseCertificationStatus(this.openId) |
||||
if (data) { |
||||
this.info = data |
||||
data.platformSource === '6' && this.getClassification() |
||||
} |
||||
}, |
||||
// 供应商分类 |
||||
async getCategory() { |
||||
const { data } = await categoryList() |
||||
this.classifications = data |
||||
}, |
||||
// 获取省份 |
||||
async getProvince() { |
||||
const { list } = await queryProvince() |
||||
this.provinces = list |
||||
this.getInfo() |
||||
}, |
||||
// 获取城市 |
||||
async getCity() { |
||||
const { list } = await queryCity({ |
||||
provinceId: this.provinces.find(e => e.provinceName == this.form.province).provinceId |
||||
}) |
||||
this.cities = list |
||||
this.cityId = '' |
||||
}, |
||||
// 上传logo |
||||
uploadLogo() { |
||||
const that = this |
||||
uni.chooseImage({ |
||||
success: (res) => { |
||||
const file = res.tempFilePaths[0]; |
||||
OSS(file, ({ url }) => { |
||||
that.form.logoUrl = url |
||||
}) |
||||
} |
||||
}); |
||||
}, |
||||
// 上传描述图片 |
||||
uploadDes(e){ |
||||
OSS(e.tempFilePaths[0], (res) => { |
||||
this.pic.push({ |
||||
name: res.name, |
||||
extname: res.ext, |
||||
url: res.url, |
||||
}) |
||||
}) |
||||
}, |
||||
// 显示价格弹框 |
||||
showPrice() { |
||||
this.$refs.popup.open() |
||||
}, |
||||
// 新增sku |
||||
addSku() { |
||||
this.form.skuList.push(this.originSku) |
||||
}, |
||||
// 提交 |
||||
async submit(status) { |
||||
if (this.submiting) return false |
||||
const { form } = this |
||||
if (!form.prodName) return this.$util.errMsg(`请输入商品名称!`) |
||||
if (!this.pic.length) return this.$util.errMsg(`请上传封面图片!`) |
||||
if (!form.brief) return this.$util.errMsg(`请输入商品描述!`) |
||||
if (!form.skuList.length) return this.$util.errMsg(`请输入产品规格!`) |
||||
this.submiting = true |
||||
form.pic = this.pic.map(e => e.url).join() |
||||
form.status = status |
||||
try { |
||||
if (this.id) { |
||||
await update(form) |
||||
this.$util.sucMsg('保存成功!') |
||||
} else { |
||||
await save(form) |
||||
this.$util.sucMsg('发布成功!') |
||||
} |
||||
|
||||
setTimeout(() => { |
||||
uni.navigateBack() |
||||
}, 1500) |
||||
} catch(e) { |
||||
this.submiting = false |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 170rpx; |
||||
-webkit-overflow-scrolling: touch; |
||||
} |
||||
/deep/.picker-input { |
||||
.arrow-area { |
||||
display: none; |
||||
} |
||||
.input-value, .selected-list { |
||||
padding: 0; |
||||
} |
||||
} |
||||
.price-select { |
||||
font-size: 24rpx; |
||||
color: #333; |
||||
} |
||||
.title { |
||||
margin: 40rpx 24rpx 24rpx; |
||||
font-size: 30rpx; |
||||
font-weight: 600; |
||||
color: #333; |
||||
} |
||||
.plus-sku { |
||||
text-align: center; |
||||
} |
||||
.btns { |
||||
z-index: 10; |
||||
position: fixed; |
||||
bottom: env(safe-area-inset-bottom); |
||||
bottom: 0; |
||||
width: 100%; |
||||
padding: 20rpx; |
||||
display: flex; |
||||
justify-content: center; |
||||
box-sizing: border-box; |
||||
background-color: #fff; |
||||
box-shadow: 0px 0px 7rpx 0px rgba(203, 203, 203, 0.55); |
||||
.btn { |
||||
padding: 16rpx 60rpx; |
||||
margin-left: 20rpx; |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
background-color: #d8d8d8; |
||||
border-radius: 20px; |
||||
} |
||||
.publish { |
||||
color: #fff; |
||||
background-color: $uni-primary; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,201 @@ |
||||
<template> |
||||
<view> |
||||
<view class="page"> |
||||
<ul class="tab"> |
||||
<li :class="{active: curTab === ''}" @click="tabChange('')">全部</li> |
||||
<li :class="{active: curTab === 0}" @click="tabChange(0)">已上架</li> |
||||
<li :class="{active: curTab === 2}" @click="tabChange(2)">已下架</li> |
||||
<li :class="{active: curTab === 3}" @click="tabChange(3)">草稿</li> |
||||
<li :class="{active: curTab === 4}" @click="tabChange(4)">审核中</li> |
||||
</ul> |
||||
|
||||
<template v-if="list.length"> |
||||
<view class="list"> |
||||
<view v-for="item in list" @click="toDetail(item)"> |
||||
<view class="metas"> |
||||
<view class="time">2313</view> |
||||
<view class="status">上架中</view> |
||||
</view> |
||||
<view class="info"> |
||||
<image class="pic" :src="item.coverUrl"></image> |
||||
<view class="texts"> |
||||
<view class="name">{{ item.customerName }}</view> |
||||
<view class="meta"> |
||||
市场价:20.00元 |
||||
<text class="sell">售价:10元</text> |
||||
</view> |
||||
<view class="meta"> |
||||
库存:1000 |
||||
已售:500 |
||||
</view> |
||||
<view class="btns"> |
||||
<!-- <view class="btn" @click.stop="toDetail(item)">查看</view> --> |
||||
<view class="btn off" @click.stop="changeStatus(item, 0)">下架</view> |
||||
<view class="btn del" @click.stop="del(item)">删除</view> |
||||
<view class="btn" @click.stop="toEdit(item)">编辑</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<uni-load-more :status="status" /> |
||||
</template> |
||||
<empty v-else text="暂无商品"></empty> |
||||
|
||||
<uni-icons class="plus" type="plus-filled" size="60" color="#007eff" @click="$util.to('../addGoods/addGoods')"></uni-icons> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { page, batchDelete, prodStatus } from '@/apis/modules/goods.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
curTab: '', |
||||
tabs: [], |
||||
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据 |
||||
status: 'more', // 上拉加载状态 more|loading|noMore |
||||
searchTimer: null, |
||||
keyword: '', |
||||
list: [], |
||||
page: 1, |
||||
pageSize: 10 |
||||
} |
||||
}, |
||||
watch: { |
||||
keyword () { |
||||
clearTimeout(this.searchTimer) |
||||
this.searchTimer = setTimeout(() => { |
||||
this.initList() |
||||
}, 500) |
||||
} |
||||
}, |
||||
// 下拉刷新 |
||||
onPullDownRefresh() { |
||||
this.initList() |
||||
setTimeout(() => { |
||||
uni.stopPullDownRefresh() |
||||
}, 1500) |
||||
}, |
||||
// 上拉加载 |
||||
onReachBottom() { |
||||
if (this.reachBottom >= 0) { |
||||
this.reachBottom = 1 |
||||
this.status = 'loading' |
||||
this.getList() |
||||
} |
||||
}, |
||||
onShow() { |
||||
this.initList() |
||||
}, |
||||
methods: { |
||||
// 获取列表 |
||||
getList() { |
||||
uni.showLoading({ |
||||
title: '加载中' |
||||
}) |
||||
page({ |
||||
status: this.curTab |
||||
}).then(({ data }) => { |
||||
uni.hideLoading() |
||||
// 未加载完所有数据,并且不是筛选,则拼接list,否则直接赋值 |
||||
this.list = this.reachBottom > 0 ? [...this.list, ...data.records] : data.records |
||||
this.page++ // 每次获取了数据后page+1 |
||||
const noMore = this.list.length === data.total // 是否加载完所有数据 |
||||
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore |
||||
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1 |
||||
}).catch(e => { |
||||
uni.hideLoading() |
||||
}) |
||||
}, |
||||
initList() { |
||||
this.page = 1 |
||||
this.reachBottom = 0 |
||||
this.getList() |
||||
}, |
||||
// tab切换 |
||||
tabChange(id) { |
||||
this.curTab = id |
||||
this.initList() |
||||
}, |
||||
// 上架下架 |
||||
async changeStatus(item, status) { |
||||
await prodStatus(item.prodId, status) |
||||
this.initList() |
||||
}, |
||||
// 跳转详情 |
||||
toDetail(item) { |
||||
this.$util.to(`../addGoods/addGoods?id=${item.prodId}&show=1`) |
||||
}, |
||||
// 跳转编辑 |
||||
toEdit(item) { |
||||
this.$util.to(`../addGoods/addGoods?id=${item.prodId}`) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
.page { |
||||
padding-bottom: 90px; |
||||
} |
||||
.list { |
||||
margin-top: 20rpx; |
||||
li { |
||||
padding: 20rpx; |
||||
margin-bottom: 20rpx; |
||||
// border-bottom: 1px solid #f1f1f1; |
||||
background-color: #fff; |
||||
} |
||||
.metas { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
margin-bottom: 20rpx; |
||||
} |
||||
.time { |
||||
font-size: 24rpx; |
||||
color: #333; |
||||
} |
||||
.status { |
||||
font-size: 24rpx; |
||||
color: #333; |
||||
} |
||||
.info { |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
.pic { |
||||
width: 150rpx; |
||||
height: 150rpx; |
||||
margin-right: 20rpx; |
||||
} |
||||
.name { |
||||
font-size: 30rpx; |
||||
color: #333; |
||||
} |
||||
.meta { |
||||
display: flex; |
||||
margin: 10rpx 0; |
||||
font-size: 28rpx; |
||||
color: #999; |
||||
} |
||||
.btns { |
||||
text-align: right; |
||||
} |
||||
.btn { |
||||
padding: 8rpx 20rpx; |
||||
margin-left: 20rpx; |
||||
font-size: 28rpx; |
||||
color: #fff; |
||||
background-color: $uni-primary; |
||||
border-radius: 4px; |
||||
&.del { |
||||
background-color: #f00; |
||||
} |
||||
&.off { |
||||
background-color: #ccc; |
||||
} |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue