积分商城

pull/9/head
zhangyouji 1 year ago
parent 7cf3af639d
commit a0b52f8a4c
  1. 8
      packageElectron/components/autograph.vue
  2. 293
      packageElectron/index.vue
  3. 8
      packageElectron/reconciliationDetails/index.vue
  4. 260
      packageIntegral/productAddition/index.vue
  5. 23
      packageIntegral/productList/index.vue
  6. 289
      packageIntegral/productUpdate/index.vue
  7. 15
      pages.json
  8. 6
      pages/home/home.vue

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

@ -0,0 +1,293 @@
<template>
<view class="container">
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">商品列表</block>
</cu-custom>
<view class="options-frame">
<view v-for="item,index in optionsList" :key="index" :class="index == currentIndex ? 'active':''"
@click="selectOptions(index)">{{item.text}}<text>({{item.count}})</text></view>
</view>
<scroll-view v-if="dataList.length" class="list" :scroll-y="true" @scrolltolower="lower">
<view class="item" v-for="item,index in dataList" :key="index">
<view class="introduce">
<image :src="item.url"></image>
<view>{{item.productName}}</view>
<view>规格默认</view>
<view>库存{{item.totalStock}}</view>
</view>
<view class="footer">
<view class="button">删除</view>
<view class="button">编辑</view>
</view>
</view>
<view style="height: 30rpx; background: #fff;"></view>
</scroll-view>
<view v-else class="empty">
<image src="https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/yunsite-empty.png"></image>
<view>暂无对账单~</view>
</view>
</view>
</template>
<script>
import serve from '@/api/packageIntegral/productList.js'
export default {
options: {
styleIsolation: 'shared'
},
data() {
return {
currentIndex: 0,
paramter: {
currentPage: 1,
pagesize: 20,
params: {},
},
dataList: [{},{}],
optionsList: [{
text: '全部',
count: 0,
value: ''
}, {
text: '待确认',
count: 0,
value: ''
}, {
text: '已确认',
count: 0,
value: ''
}, {
text: '金额异常',
count: 0,
value: ''
}],
}
},
onLoad() {
// this.productByPage()
// this.getTopInfo()
},
methods: {
selectOptions(index) {
this.currentIndex = index
console.log(index,'index')
if(index == 0){
this.paramter.params ={}
}else if(index ==1){
this.paramter.params ={}
this.paramter.params.productStatus = 1
}else if(index ==2){
this.paramter.params ={}
this.paramter.params.productStatus = 2
}else if(index ==3){
this.paramter.params ={}
this.paramter.params.auditStatus = 1
}
// this.productByPage()
},
lower() {
this.paramter.currentPage += 1
// this.productByPage()
},
}
}
</script>
<style lang="scss" scoped>
.container {
height: 100vh;
display: flex;
flex-direction: column;
background: #f1f2f7 !important;
>.options-frame {
display: flex;
justify-content: space-between;
margin-top: 43rpx;
padding: 0 31rpx;
>view {
width: 144rpx;
height: 66rpx;
font-size: 25rpx;
line-height: 66rpx;
text-align: center;
color: #000000;
background: #F7F7F7;
>text {
color: #F83D3D;
}
&.active {
color: #FFF;
background: #F83D3D;
>text {
color: #fff;
}
}
}
}
>.list {
margin-top: 35rpx;
flex: 1;
overflow-y: hidden;
.item {
position: relative;
margin-top: 20rpx;
background: #fff;
// min-height: 106rpx;
// border-bottom: 12rpx solid #F1F2F7;
&:nth-of-type(1) {
margin-top: 0
}
.header {
// padding: 26rpx 23rpx 0;
height: 60rpx;
// line-height: 83rpx;
width: 100%;
font-size: 30rpx;
color: #666;
border-top: 1rpx solid #D7D7D7;
.identifying{
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
// background-color: #F83D3D;
color: #FFF;
text-align: center;
border-bottom-right-radius: 30rpx;
}
}
.introduce {
position: relative;
padding: 24rpx 29rpx 31rpx 268rpx;
min-height: 220rpx;
>image {
position: absolute;
top: 13rpx;
left: 34rpx;
width: 220rpx;
height: 220rpx;
// border: 1px solid #333;
}
>view {
&:nth-of-type(1) {
font-size: 28rpx;
color: #000;
}
&:nth-of-type(2),
&:nth-of-type(3) {
margin-top: 11rpx;
font-size: 24rpx;
color: #999;
}
&:nth-of-type(3) {
margin-top: 18rpx;
}
&:nth-of-type(4) {
margin-top: 11rpx;
font-size: 28rpx;
color: #F83D3D;
}
}
}
.examine{
width: 120rpx;
height: 45rpx;
color: #FFF;
text-align: center;
line-height: 45rpx;
position: absolute;
right: 50rpx;
top: 180rpx;
}
>.footer {
position: relative;
height: 58rpx;
line-height: 58rpx;
padding: 0 34rpx 40rpx;
font-size: 32rpx;
color: #000;
font-weight: 550;
.button {
position: absolute;
top: 0;
width: 128rpx;
height: 58rpx;
line-height: 58rpx;
text-align: center;
font-size: 28rpx;
color: #999;
background: #FFF;
border: 1px solid #999;
border-radius: 10rpx;
}
>.button{
&:nth-of-type(1){
right: 360rpx;
}
&:nth-of-type(2){
right: 200rpx;
}
&:nth-of-type(3){
right: 40rpx;
}
}
}
}
}
>.empty {
margin: 218rpx auto 0;
>image {
width: 473rpx;
height: 404rpx;
}
>view {
margin-top: 45rpx;
text-align: center;
font-size: 28rpx;
color: #999;
}
}
}
</style>

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

@ -7,18 +7,11 @@
<view id="chooseType" :class="currentBoxId == 'chooseType' ? 'show' : 'hidden'">
<uni-forms ref="productForm" :modelValue="productDate" :rules="rules" label-width="200rpx">
<uni-forms-item label="商品分类:" name="demandRegion">
<mulpicker
v-model="productDate.demandRegion"
:list="productList"
rangekey="categoryName"
code="id"
pidkey="id"
childkey="classificationTwoList"
:emitPath="true"
:level="2"
:placeholder="'选择商品分类'"
/>
<uni-icons color="#666666" type="right" size="22" style="position: absolute;right: 0;top: 10rpx;"></uni-icons>
<mulpicker v-model="productDate.demandRegion" :list="productList" rangekey="categoryName" code="id"
pidkey="id" childkey="classificationTwoList" :emitPath="true" :level="2"
:placeholder="'选择商品分类'" />
<uni-icons color="#666666" type="right" size="22"
style="position: absolute;right: 0;top: 10rpx;"></uni-icons>
</uni-forms-item>
<uni-forms-item label="商品名称:" name="productName">
<input type="text" v-model="productDate.productName" placeholder="请输入商品名称" />
@ -28,22 +21,21 @@
</uni-forms-item>
<uni-forms-item label="商品品牌:" name="brandId">
<!-- <input type="text" v-model="productDate.brandId" placeholder="请输入商品品牌" /> -->
<uni-data-select
v-model="productDate.brandId"
:localdata="brandIdList"
placeholder="请选择商品品牌"
></uni-data-select>
<uni-data-select v-model="productDate.brandId" :localdata="brandIdList"
placeholder="请选择商品品牌"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="商品售价:" name="price">
<input type="text" v-model="productDate.price" placeholder="请输入商品售价" />
</uni-forms-item>
<uni-forms-item label="商品上架:" name="productStatus">
<switch v-model="productDate.productStatus" :checked="productDate.productStatus=='1'" color="#FE0606" @change="switchChange" style="transform:scale(0.7)" />
<switch v-model="productDate.productStatus" :checked="productDate.productStatus=='1'"
color="#FE0606" @change="switchChange" style="transform:scale(0.7)" />
</uni-forms-item>
<uni-forms-item label="商品推荐:" name="age">
<view class='checkbox-con'>
<radio-group>
<label :class="item.checked?'checkbox checked':'checkbox'" @click="checkbox(index)" v-for="(item, index) in radioItem" :key="item.value">
<label :class="item.checked?'checkbox checked':'checkbox'" @click="checkbox(index)"
v-for="(item, index) in radioItem" :key="item.value">
<checkbox :value="item.value" :checked="item.checked" />{{item.name}}
</label>
</radio-group>
@ -60,12 +52,8 @@
<view id="instruction" :class="currentBoxId == 'instruction' ? 'show' : 'hidden'">
<uni-forms :modelValue="productDate" label-width="200rpx">
<uni-forms-item label="属性类别:">
<uni-data-select
v-model="productDate.attributesTypeId"
:localdata="attributesTypeList"
placeholder="请选择商品品牌"
@change="attributesData"
></uni-data-select>
<uni-data-select v-model="productDate.attributesTypeId" :localdata="attributesTypeList"
placeholder="请选择商品品牌" @change="attributesData"></uni-data-select>
</uni-forms-item>
<view class="content" v-show="productDate.attributesTypeId">
<view style="margin: 10rpx 0;">商品类型</view>
@ -74,8 +62,11 @@
<view class="uni-px-5" v-for="(item,index) in attributesList">
<view style="display: inline-block;">{{item.attributeName}}</view>
<view style="display: inline-block;">
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)" v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag" @change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)"
v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag"
@change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes"
:localdata="item.attributesList"></uni-data-checkbox>
</view>
</view>
@ -84,15 +75,29 @@
</view>
<view style="padding-bottom: 20rpx;border-bottom: 1rpx solid #f6f6f6;">
<view>批量填充<text style="color: #999999;margin: 10rpx 0;">批量填充填入信息后可以批量将内容填写到SKU 信息里</text></view>
<view class="tagButton" v-for="item in bottonList">{{item.label}}</view>
<view style="display: inline-block;position: relative;" v-for="item in bottonList">
<view class="tagButton">
<input type="text" v-model="item.marketPrice" placeholder="市场价格" />
</view>
<view class="tagButton">
<input type="text" v-model="item.sellPrice" placeholder="销售价格" />
</view>
<view class="tagButton">
<input type="text" v-model="item.stock" placeholder="库存数量" />
</view>
<view class="tagButton">
<input type="text" v-model="item.integral" placeholder="积分价值" />
</view>
<view class="redButton" @tap="addStockList">确定</view>
</view>
</view>
<view style="padding: 20rpx 0;;border-bottom: 1rpx solid #f6f6f6;" v-for="(items,index) in stockList">
<view style="margin: 10rpx 0;">
<text style="color: red;">*</text>
<text>规格</text>
<text v-if="index==0">{{radioAttributes}}</text>
<text v-if="index!=0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
<text v-if="checkboxAttributes.length==0">{{radioAttributes}}</text>
<text
v-if="checkboxAttributes.length>0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
</view>
<view class="tagButton">
<input type="text" v-model="items.marketPrice" placeholder="市场价格" />
@ -106,7 +111,8 @@
<view class="tagButton">
<input type="text" v-model="items.integral" placeholder="积分价值" />
</view>
<view style="display: inline-block;vertical-align: top;margin-top: 10rpx;" @click="deleteCheckAll(index)">删除</view>
<view style="display: inline-block;vertical-align: top;margin-top: 10rpx;"
@click="deleteCheckAll(index)">删除</view>
</view>
<view>
<view style="margin: 10rpx 0;">
@ -122,7 +128,7 @@
</view>
<view class="imageBlack" v-else-if="items.mainMark!=1">
<image :src="items.url"></image>
<view class="cameraText" @click="setMainImage(index)">设为主图</view>
<view class="cameraText" @click="setMainImage(items,index)">设为主图</view>
<uni-icons class="cameraClear" type="clear" size="20" @tap="clearImage(index)"></uni-icons>
</view>
</view>
@ -176,19 +182,39 @@
checked: false
}],
rules: {
demandRegion:{rules:[{required: true,errorMessage: '请选择商品分类'}]},
productName:{rules:[{required: true,errorMessage: '请输入商品名称'}]},
brandId:{rules:[{required: true,errorMessage: '请选择商品品牌'}]},
price:{rules:[{required: true,errorMessage: '请输入商品售价'}]},
demandRegion: {
rules: [{
required: true,
errorMessage: '请选择商品分类'
}]
},
productName: {
rules: [{
required: true,
errorMessage: '请输入商品名称'
}]
},
brandId: {
rules: [{
required: true,
errorMessage: '请选择商品品牌'
}]
},
price: {
rules: [{
required: true,
errorMessage: '请输入商品售价'
}]
},
},
attributesTypeList: [],
attributesList: [],
bottonList:[
{label:'市场价格',value:'marketPrice',checked:false},
{label:'销售价格',value:'sellPrice',checked:false},
{label:'商品库存',value:'stock',checked:false},
{label:'兑换积分',value:'integral',checked:false}
],
bottonList: [{
marketPrice: '',
sellPrice: '',
stock: '',
integral: ''
}],
radioAttributes: '',
checkboxAttributes: [],
stockList: [],
@ -230,9 +256,11 @@
getProductBrands() {
this.brandIdList = []
serve.getProductBrands().then(res => {
console.log(res)
res.data.forEach(tab => {
this.brandIdList.push({value:tab.id,text:tab.brandName})
this.brandIdList.push({
value: tab.id,
text: tab.brandName
})
})
})
@ -266,7 +294,6 @@
let currentFlag = e.currentTarget.id;
if (currentFlag == 'next') {
this.$refs.productForm.validate().then(res => {
console.log('表单数据信息:', res);
switch (currentFlag) {
case 'next':
this.currentBoxId = 'instruction'
@ -281,9 +308,7 @@
if (currentFlag == 'next') {
this.getAttributesType()
}
}).catch(err =>{
console.log('表单错误信息:', err);
})
}).catch(err => {})
} else {
switch (currentFlag) {
case 'next':
@ -313,14 +338,26 @@
})
},
attributesData() {
this.bottonList = [{
marketPrice: '',
sellPrice: '',
stock: '',
integral: ''
}]
this.stockList = []
this.radioAttributes = ''
this.checkboxAttributes = []
if (this.productDate.attributesTypeId) {
this.attributesTypeList.forEach(tab => {
if(tab.id = this.productDate.attributesTypeId){
if (tab.value == this.productDate.attributesTypeId) {
this.attributesList = tab.attributesList
this.attributesList.forEach(tab => {
tab.attributesList = []
tab.attributeContent.split(',').forEach(item => {
tab.attributesList.push({value:item,text:item})
tab.attributesList.push({
value: item,
text: item
})
})
})
@ -333,14 +370,21 @@
},
changeRadio(item, index) {
if (JSON.stringify(this.checkedList) == '[]') {
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
this.checkedList.push({
attributeId: item.id,
checked: this.radioAttributes
})
} else {
this.checkedList[index].checked = item.attributeName
this.checkedList[index].checked = this.radioAttributes
}
this.stockCheck()
},
changeCheckBox(item, index) {
if (this.checkedList.length < index + 1) {
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
this.checkedList.push({
attributeId: item.id,
checked: this.radioAttributes
})
} else {
let checked = []
this.checkboxAttributes.forEach(tab => {
@ -349,23 +393,9 @@
this.checkedList[index].checked = checked.join(',')
this.checkedList.checked
}
this.stockCheck()
},
deleteCheckAll(i){
if(this.checkboxAttributes.length>1){
this.checkboxAttributes.splice(i,1)
}else{
this.checkboxAttributes.splice(i,1)
this.radioAttributes = ''
}
this.stockList.splice(i,1)
},
deleteRadio(){
this.radioAttributes = ''
},
changeChecked(item){
item.checked = !item.checked
},
addStockList(){
stockCheck() {
this.stockList = []
let obj = {
marketPrice: '',
@ -381,18 +411,45 @@
obj.attributeJson = JSON.stringify(data)
this.stockList.push(obj)
} else {
this.attributesList.forEach((item, ind) => {
if (ind != 0) {
this.checkboxAttributes.forEach((tab, index) => {
let name = this.attributesList[0].attributeName
let value = this.radioAttributes
let tabName = this.attributesList[index+1].attributeName
let data = {}
let tabName = this.attributesList[ind].attributeName
let tabValue = tab
data[name] = value
data[tabName] = tabValue
obj.attributeJson = JSON.stringify(data)
this.stockList.push(obj)
let stockObj = JSON.parse(JSON.stringify(obj))
this.stockList.push(stockObj)
})
}
})
}
},
deleteCheckAll(i) {
if (this.checkboxAttributes.length > 1) {
this.checkboxAttributes.splice(i, 1)
} else {
this.checkboxAttributes.splice(i, 1)
this.radioAttributes = ''
}
this.stockList.splice(i, 1)
},
deleteRadio() {
this.radioAttributes = ''
},
changeChecked(item) {
item.checked = !item.checked
},
addStockList() {
this.stockList.forEach(tab => {
tab.marketPrice = this.bottonList[0].marketPrice
tab.sellPrice = this.bottonList[0].sellPrice
tab.stock = this.bottonList[0].stock
tab.integral = this.bottonList[0].integral
})
},
//
srcFileImage() {
@ -403,7 +460,6 @@
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: function(res) {
console.log(res)
const JSESSIONID = utils.uuid()
uni.uploadFile({
url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile',
@ -428,10 +484,10 @@
imageUrl = obj.data.publicUrl
_that.getImage(imageUrl)
},
fail(err) {
}
fail(err) {}
})
},fail() {
},
fail() {
console.log('相机调用失败')
}
})
@ -449,14 +505,15 @@
})
}
},
setMainImage(index){
setMainImage(items, index) {
let obj = items
obj.mainMark = 1
this.productDate.images.splice(index, 1)
this.productDate.images.forEach((tab, i) => {
if(i == index){
tab.mainMark = 1
}else{
tab.mainMark = ''
}
})
this.productDate.images.unshift(obj)
},
clearImage(index) {
if (this.productDate.images[index].mainMark == 1) {
@ -485,7 +542,6 @@
this.productDate.checkedList = this.checkedList
this.productDate.stockList = this.stockList
serve.saveProduct(this.productDate).then(res => {
console.log(res)
uni.showToast({
title: res.msg,
icon: 'none'
@ -498,11 +554,11 @@
</script>
<style lang="scss" scoped>
.fadeBox {
width: 100%;
margin-bottom: 20rpx;
}
#chooseType {
padding: 30rpx;
@ -510,9 +566,11 @@
height: 72rpx;
line-height: 72rpx;
}
/deep/ .uni-forms {
width: 100%;
}
.content {
font-size: 28rpx;
font-weight: bold;
@ -528,8 +586,10 @@
font-size: 30rpx;
font-weight: 700;
}
/deep/ .uni-forms-item__content {
width: 100%;
input {
height: 72rpx;
line-height: 72rpx;
@ -539,13 +599,16 @@
switch {
margin-top: 9rpx;
}
switch::before {
content: '';
}
switch::after {
content: '';
}
}
#instruction {
padding: 30rpx;
@ -553,9 +616,11 @@
height: 72rpx;
line-height: 72rpx;
}
/deep/ .uni-forms {
width: 100%;
}
/deep/ .uni-forms-item {
width: 100%;
}
@ -565,17 +630,21 @@
font-size: 30rpx;
font-weight: 700;
}
/deep/ .uni-forms-item__content {
width: 100%;
input {
height: 72rpx;
line-height: 72rpx;
}
}
.content {
padding-bottom: 20rpx;
border-bottom: 1rpx solid #F6F6F6;
}
.tagButton {
display: inline-block;
width: 133rpx;
@ -585,12 +654,21 @@
line-height: 58rpx;
text-align: center;
margin: 8rpx;
input {
height: 58rpx;
}
}
.checkedTag {
background-color: #2979ff;
color: #FFFFFF;
}
.redButton {
position: absolute;
right: -84rpx;
top: 10rpx;
display: inline-block;
width: 84rpx;
height: 58rpx;
@ -600,15 +678,18 @@
line-height: 58rpx;
text-align: center;
}
.commodityImage {
display: inline-block;
max-width: calc(100%-150rpx);
}
.imageList {
display: inline-block;
width: 140rpx;
margin: 0 10rpx;
}
.imageBlack {
display: inline-block;
width: 140rpx;
@ -616,10 +697,12 @@
vertical-align: middle;
text-align: center;
position: relative;
>image {
width: 100%;
height: 100%;
}
.cameraText {
width: 140rpx;
height: 30rpx;
@ -632,6 +715,7 @@
left: 0rpx;
top: 110rpx;
}
.cameraClear {
position: absolute;
left: 120rpx;
@ -647,6 +731,7 @@
text-align: center;
position: relative;
}
.checkbox {
width: 180rpx;
height: 76rpx;
@ -659,9 +744,11 @@
margin: 0 10rpx 20rpx 0;
position: absolute;
top: 50rpx;
&:nth-of-type(1) {
left: -190rpx;
}
&:nth-of-type(2) {
left: 50rpx;
}
@ -672,6 +759,7 @@
background: #FE0606;
border: 1rpx solid #FE0606;
}
.checkbox checkbox {
display: none
}
@ -705,10 +793,12 @@
}
}
}
.show {
display: flex;
flex-wrap: wrap;
}
.hidden {
display: none;
}

@ -10,16 +10,15 @@
@click="selectOptions(index)">{{item.text}}<text>({{item.count}})</text></view>
</view>
<view class="search">
<uni-easyinput prefixIcon="search" borderColor="#DCDFE6" v-model="paramter.params.productName" placeholder="请输入商品名称"
@confirm="search" @clear="search" />
<uni-easyinput prefixIcon="search" borderColor="#DCDFE6" v-model="paramter.params.productName"
placeholder="请输入商品名称" @confirm="search" @clear="search" />
</view>
<scroll-view v-if="dataList.length" class="list" :scroll-y="true" @scrolltolower="lower">
<view class="item" v-for="item,index in dataList" :key="index">
<view class="header">
<view class="identifying"
:style="{background:identifying[item.productStatus].background,
<view class="identifying" :style="{background:identifying[item.productStatus].background,
opacity:identifying[item.productStatus].opacity}">{{item.productStatus =='1'?'已上架':'未上架'}}</view>
</view>
<view class="introduce">
@ -29,7 +28,8 @@
<view>库存{{item.totalStock}}</view>
</view>
<view class="examine" @click="examineDetail(item)"
:style="{background:statusEnum[item.auditStatus].color}" >{{statusEnum[item.auditStatus].value}}</view>
:style="{background:statusEnum[item.auditStatus].color}">{{statusEnum[item.auditStatus].value}}
</view>
<view class="footer">
<view class="button" @click="orderDelete">删除</view>
<view class="button" @click="toEditOrder(item)">编辑</view>
@ -234,7 +234,9 @@
this.productByPage()
},
examineDetail(item) {
serve.productAuditHistory({id:item.id}).then(res=>{
serve.productAuditHistory({
id: item.id
}).then(res => {
this.examineDetailList = res.data
})
this.$refs.detail.open('center')
@ -297,6 +299,7 @@
background: #FFF;
}
>.options-frame {
display: flex;
justify-content: space-between;
@ -404,6 +407,7 @@
}
}
}
.examine {
width: 120rpx;
height: 45rpx;
@ -442,9 +446,11 @@
&:nth-of-type(1) {
right: 360rpx;
}
&:nth-of-type(2) {
right: 200rpx;
}
&:nth-of-type(3) {
right: 40rpx;
}
@ -467,11 +473,13 @@
color: #000;
margin-bottom: 20rpx;
}
>uni-icons {
position: absolute;
top: 30rpx;
right: 30rpx;
}
>.item {
display: flex;
justify-content: space-evenly;
@ -479,12 +487,15 @@
font-size: 22rpx;
color: #666;
padding: 10rpx;
view {
width: 240rpx;
line-height: 46rpx;
}
>.status {
width: 160rpx;
>view {
width: 160rpx;
}

@ -2,23 +2,16 @@
<view class="container">
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">新增商品</block>
<block slot="content">编辑商品</block>
</cu-custom>
<view id="chooseType" :class="currentBoxId == 'chooseType' ? 'show' : 'hidden'">
<uni-forms ref="productForm" :modelValue="productDate" :rules="rules" label-width="200rpx">
<uni-forms-item label="商品分类:" name="demandRegion">
<mulpicker
v-model="productDate.demandRegion"
:list="productList"
rangekey="categoryName"
code="id"
pidkey="id"
childkey="classificationTwoList"
:emitPath="true"
:level="2"
:placeholder="'选择商品分类'"
/>
<uni-icons color="#666666" type="right" size="22" style="position: absolute;right: 0;top: 10rpx;"></uni-icons>
<mulpicker v-model="productDate.demandRegion" :list="productList" rangekey="categoryName" code="id"
pidkey="id" childkey="classificationTwoList" :emitPath="true" :level="2"
:placeholder="'选择商品分类'" />
<uni-icons color="#666666" type="right" size="22"
style="position: absolute;right: 0;top: 10rpx;"></uni-icons>
</uni-forms-item>
<uni-forms-item label="商品名称:" name="productName">
<input type="text" v-model="productDate.productName" placeholder="请输入商品名称" />
@ -28,22 +21,21 @@
</uni-forms-item>
<uni-forms-item label="商品品牌:" name="brandId">
<!-- <input type="text" v-model="productDate.brandId" placeholder="请输入商品品牌" /> -->
<uni-data-select
v-model="productDate.brandId"
:localdata="brandIdList"
placeholder="请选择商品品牌"
></uni-data-select>
<uni-data-select v-model="productDate.brandId" :localdata="brandIdList"
placeholder="请选择商品品牌"></uni-data-select>
</uni-forms-item>
<uni-forms-item label="商品售价:" name="price">
<input type="text" v-model="productDate.price" placeholder="请输入商品售价" />
</uni-forms-item>
<uni-forms-item label="商品上架:" name="productStatus">
<switch v-model="productDate.productStatus" :checked="productDate.productStatus=='1'" color="#FE0606" @change="switchChange" style="transform:scale(0.7)" />
<switch v-model="productDate.productStatus" :checked="productDate.productStatus=='1'"
color="#FE0606" @change="switchChange" style="transform:scale(0.7)" />
</uni-forms-item>
<uni-forms-item label="商品推荐:" name="age">
<view class='checkbox-con'>
<radio-group>
<label :class="item.checked?'checkbox checked':'checkbox'" @click="checkbox(index)" v-for="(item, index) in radioItem" :key="item.value">
<label :class="item.checked?'checkbox checked':'checkbox'" @click="checkbox(index)"
v-for="(item, index) in radioItem" :key="item.value">
<checkbox :value="item.value" :checked="item.checked" />{{item.name}}
</label>
</radio-group>
@ -60,12 +52,8 @@
<view id="instruction" :class="currentBoxId == 'instruction' ? 'show' : 'hidden'">
<uni-forms :modelValue="productDate" label-width="200rpx">
<uni-forms-item label="属性类别:">
<uni-data-select
v-model="productDate.attributesTypeId"
:localdata="attributesTypeList"
placeholder="请选择商品品牌"
@change="attributesData"
></uni-data-select>
<uni-data-select v-model="productDate.attributesTypeId" :localdata="attributesTypeList"
placeholder="请选择商品品牌" @change="attributesData"></uni-data-select>
</uni-forms-item>
<view class="content" v-show="productDate.attributesTypeId">
<view style="margin: 10rpx 0;">商品类型</view>
@ -74,8 +62,11 @@
<view class="uni-px-5" v-for="(item,index) in attributesList">
<view style="display: inline-block;">{{item.attributeName}}</view>
<view style="display: inline-block;">
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)" v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag" @change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-if="index==0" mode="tag" @change="changeRadio(item,index)"
v-model="radioAttributes" :localdata="item.attributesList"></uni-data-checkbox>
<uni-data-checkbox v-else-if="index!=0" mode="tag"
@change="changeCheckBox(item,index)" multiple v-model="checkboxAttributes"
:localdata="item.attributesList"></uni-data-checkbox>
</view>
</view>
@ -84,29 +75,47 @@
</view>
<view style="padding-bottom: 20rpx;border-bottom: 1rpx solid #f6f6f6;">
<view>批量填充<text style="color: #999999;margin: 10rpx 0;">批量填充填入信息后可以批量将内容填写到SKU 信息里</text></view>
<view class="tagButton" @tap="changeChecked(item)" v-for="item in bottonList">{{item.label}}</view>
<view style="display: inline-block;position: relative;" v-for="item in bottonList">
<view class="tagButton">
<input type="text" v-model="item.marketPrice" placeholder="市场价格" />
</view>
<view class="tagButton">
<input type="text" v-model="item.sellPrice" placeholder="销售价格" />
</view>
<view class="tagButton">
<input type="text" v-model="item.stock" placeholder="库存数量" />
</view>
<view class="tagButton">
<input type="text" v-model="item.integral" placeholder="积分价值" />
</view>
<view class="redButton" @tap="addStockList">确定</view>
</view>
<view style="padding: 20rpx 0;;border-bottom: 1rpx solid #f6f6f6;" v-for="(items,index) in stockList">
</view>
<view style="padding: 20rpx 0;;border-bottom: 1rpx solid #f6f6f6;" v-for="(tab,index) in stockList"
:key="index">
<view style="margin: 10rpx 0;">
<text style="color: red;">*</text>
<text>规格</text>
<text v-if="index==0">{{radioAttributes}}</text>
<text v-if="index!=0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
<text v-if="checkboxAttributes.length==0">{{radioAttributes}}</text>
<text
v-if="checkboxAttributes.length>0">{{radioAttributes}}+{{checkboxAttributes[index]}}</text>
</view>
<view class="tagButton">
<input type="text" v-model="items.marketPrice" placeholder="市场价格" />
<input type="text" v-model="tab.marketPrice" placeholder="市场价格" />
</view>
<view class="tagButton">
<input type="text" v-model="items.sellPrice" placeholder="销售价格" />
<input type="text" v-model="tab.sellPrice" placeholder="销售价格" />
</view>
<view class="tagButton">
<input type="text" v-model="items.stock" placeholder="库存数量" />
<input type="text" v-model="tab.stock" placeholder="库存数量" />
</view>
<view class="tagButton">
<input type="text" v-model="items.integral" placeholder="积分价值" />
<input type="text" v-model="tab.integral" placeholder="积分价值" />
</view>
<view style="display: inline-block;vertical-align: top;margin-top: 10rpx;" @click="deleteCheckAll(index)">删除</view>
<view style="display: inline-block;vertical-align: top;margin-top: 10rpx;"
@click="deleteCheckAll(index)">删除</view>
</view>
<view>
<view style="margin: 10rpx 0;">
@ -122,7 +131,7 @@
</view>
<view class="imageBlack" v-else-if="items.mainMark!=1">
<image :src="items.url"></image>
<view class="cameraText" @click="setMainImage(index)">设为主图</view>
<view class="cameraText" @click="setMainImage(items,index)">设为主图</view>
<uni-icons class="cameraClear" type="clear" size="20" @tap="clearImage(index)"></uni-icons>
</view>
</view>
@ -176,19 +185,39 @@
checked: false
}],
rules: {
demandRegion:{rules:[{required: true,errorMessage: '请选择商品分类'}]},
productName:{rules:[{required: true,errorMessage: '请输入商品名称'}]},
brandId:{rules:[{required: true,errorMessage: '请选择商品品牌'}]},
price:{rules:[{required: true,errorMessage: '请输入商品售价'}]},
demandRegion: {
rules: [{
required: true,
errorMessage: '请选择商品分类'
}]
},
productName: {
rules: [{
required: true,
errorMessage: '请输入商品名称'
}]
},
brandId: {
rules: [{
required: true,
errorMessage: '请选择商品品牌'
}]
},
price: {
rules: [{
required: true,
errorMessage: '请输入商品售价'
}]
},
},
attributesTypeList: [],
attributesList: [],
bottonList:[
{label:'市场价格',value:'marketPrice',checked:false},
{label:'销售价格',value:'sellPrice',checked:false},
{label:'商品库存',value:'stock',checked:false},
{label:'兑换积分',value:'integral',checked:false}
],
bottonList: [{
marketPrice: '',
sellPrice: '',
stock: '',
integral: ''
}],
radioAttributes: '',
checkboxAttributes: [],
stockList: [],
@ -197,7 +226,6 @@
},
onLoad(options) {
console.log(options,'options')
this.getEdit(options)
this.classfication()
this.getProductBrands()
@ -233,12 +261,15 @@
this.radioItem[1].checked = false
}
this.attributesTypeList.forEach(tab => {
if(tab.id = this.productDate.attributesTypeId){
if (tab.value == this.productDate.attributesTypeId) {
this.attributesList = tab.attributesList
this.attributesList.forEach(tab => {
tab.attributesList = []
tab.attributeContent.split(',').forEach(item => {
tab.attributesList.push({value:item,text:item})
tab.attributesList.push({
value: item,
text: item
})
})
})
}
@ -249,8 +280,13 @@
} else {
this.checkboxAttributes = []
this.productDate.checkedList.forEach((tab, index) => {
if(index!=0){
this.checkboxAttributes.push(tab.checked)
if (index == 0) {
this.radioAttributes = this.productDate.checkedList[0].checked
} else {
tab.checked.split(',').forEach(item => {
this.checkboxAttributes.push(item)
})
}
})
}
@ -258,7 +294,6 @@
}
console.log(res.data)
})
},
switchChange(e) {
@ -276,9 +311,11 @@
getProductBrands() {
this.brandIdList = []
serve.getProductBrands().then(res => {
console.log(res)
res.data.forEach(tab => {
this.brandIdList.push({value:tab.id,text:tab.brandName})
this.brandIdList.push({
value: tab.id,
text: tab.brandName
})
})
})
@ -312,7 +349,6 @@
let currentFlag = e.currentTarget.id;
if (currentFlag == 'next') {
this.$refs.productForm.validate().then(res => {
console.log('表单数据信息:', res);
switch (currentFlag) {
case 'next':
this.currentBoxId = 'instruction'
@ -327,9 +363,7 @@
if (currentFlag == 'next') {
this.getAttributesType()
}
}).catch(err =>{
console.log('表单错误信息:', err);
})
}).catch(err => {})
} else {
switch (currentFlag) {
case 'next':
@ -359,14 +393,26 @@
})
},
attributesData() {
this.bottonList = [{
marketPrice: '',
sellPrice: '',
stock: '',
integral: ''
}]
this.stockList = []
this.radioAttributes = ''
this.checkboxAttributes = []
if (this.productDate.attributesTypeId) {
this.attributesTypeList.forEach(tab => {
if(tab.id = this.productDate.attributesTypeId){
if (tab.value == this.productDate.attributesTypeId) {
this.attributesList = tab.attributesList
this.attributesList.forEach(tab => {
tab.attributesList = []
tab.attributeContent.split(',').forEach(item => {
tab.attributesList.push({value:item,text:item})
tab.attributesList.push({
value: item,
text: item
})
})
})
@ -379,14 +425,22 @@
},
changeRadio(item, index) {
if (JSON.stringify(this.checkedList) == '[]') {
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
this.checkedList.push({
attributeId: item.id,
checked: this.radioAttributes
})
} else {
this.checkedList[index].checked = item.attributeName
this.checkedList[index].checked = this.radioAttributes
}
this.stockCheck()
},
changeCheckBox(item, index) {
if (this.checkedList.length < index + 1) {
this.checkedList.push({attributeId:item.id,checked:item.attributeName})
this.checkedList.push({
attributeId: item.id,
checked: this.radioAttributes
})
} else {
let checked = []
this.checkboxAttributes.forEach(tab => {
@ -395,23 +449,10 @@
this.checkedList[index].checked = checked.join(',')
this.checkedList.checked
}
this.stockCheck()
},
deleteCheckAll(i){
if(this.checkboxAttributes.length>1){
this.checkboxAttributes.splice(i,1)
}else{
this.checkboxAttributes.splice(i,1)
this.radioAttributes = ''
}
this.stockList.splice(i,1)
},
deleteRadio(){
this.radioAttributes = ''
},
changeChecked(item){
item.checked = !item.checked
},
addStockList(){
stockCheck() {
this.stockList = []
let obj = {
marketPrice: '',
@ -427,19 +468,43 @@
obj.attributeJson = JSON.stringify(data)
this.stockList.push(obj)
} else {
this.attributesList.forEach((item, ind) => {
if (ind != 0) {
this.checkboxAttributes.forEach((tab, index) => {
let name = this.attributesList[0].attributeName
let value = this.radioAttributes
let tabName = this.attributesList[index+1].attributeName
let data = {}
let tabName = this.attributesList[ind].attributeName
let tabValue = tab
data[name] = value
data[tabName] = tabValue
obj.attributeJson = JSON.stringify(data)
this.stockList.push(obj)
let stockObj = JSON.parse(JSON.stringify(obj))
this.stockList.push(stockObj)
})
}
})
}
},
deleteCheckAll(i) {
if (this.checkboxAttributes.length > 1) {
this.checkboxAttributes.splice(i, 1)
} else {
this.checkboxAttributes.splice(i, 1)
this.radioAttributes = ''
}
this.stockList.splice(i, 1)
},
deleteRadio() {
this.radioAttributes = ''
},
addStockList() {
this.stockList.forEach(tab => {
tab.marketPrice = this.bottonList[0].marketPrice
tab.sellPrice = this.bottonList[0].sellPrice
tab.stock = this.bottonList[0].stock
tab.integral = this.bottonList[0].integral
})
},
//
srcFileImage() {
let _that = this
@ -473,10 +538,10 @@
imageUrl = obj.data.publicUrl
_that.getImage(imageUrl)
},
fail(err) {
}
fail(err) {}
})
},fail() {
},
fail() {
console.log('相机调用失败')
}
})
@ -494,14 +559,15 @@
})
}
},
setMainImage(index){
setMainImage(items, index) {
let obj = items
obj.mainMark = 1
this.productDate.images.splice(index, 1)
this.productDate.images.forEach((tab, i) => {
if(i == index){
tab.mainMark = 1
}else{
tab.mainMark = ''
}
})
this.productDate.images.unshift(obj)
},
clearImage(index) {
if (this.productDate.images[index].mainMark == 1) {
@ -542,11 +608,11 @@
</script>
<style lang="scss" scoped>
.fadeBox {
width: 100%;
margin-bottom: 20rpx;
}
#chooseType {
padding: 30rpx;
@ -554,9 +620,11 @@
height: 72rpx;
line-height: 72rpx;
}
/deep/ .uni-forms {
width: 100%;
}
.content {
font-size: 28rpx;
font-weight: bold;
@ -572,8 +640,10 @@
font-size: 30rpx;
font-weight: 700;
}
/deep/ .uni-forms-item__content {
width: 100%;
input {
height: 72rpx;
line-height: 72rpx;
@ -583,13 +653,16 @@
switch {
margin-top: 9rpx;
}
switch::before {
content: '';
}
switch::after {
content: '';
}
}
#instruction {
padding: 30rpx;
@ -597,9 +670,11 @@
height: 72rpx;
line-height: 72rpx;
}
/deep/ .uni-forms {
width: 100%;
}
/deep/ .uni-forms-item {
width: 100%;
}
@ -609,13 +684,16 @@
font-size: 30rpx;
font-weight: 700;
}
/deep/ .uni-forms-item__content {
width: 100%;
input {
height: 72rpx;
line-height: 72rpx;
}
}
.tagButton {
display: inline-block;
width: 133rpx;
@ -625,12 +703,21 @@
line-height: 58rpx;
text-align: center;
margin: 8rpx;
input {
height: 58rpx;
}
}
.checkedTag {
background-color: #2979ff;
color: #FFFFFF;
}
.redButton {
position: absolute;
right: -84rpx;
top: 10rpx;
display: inline-block;
width: 84rpx;
height: 58rpx;
@ -640,15 +727,18 @@
line-height: 58rpx;
text-align: center;
}
.commodityImage {
display: inline-block;
max-width: calc(100%-150rpx);
}
.imageList {
display: inline-block;
width: 140rpx;
margin: 0 10rpx;
}
.imageBlack {
display: inline-block;
width: 140rpx;
@ -656,10 +746,12 @@
vertical-align: middle;
text-align: center;
position: relative;
>image {
width: 100%;
height: 100%;
}
.cameraText {
width: 140rpx;
height: 30rpx;
@ -672,6 +764,7 @@
left: 0rpx;
top: 110rpx;
}
.cameraClear {
position: absolute;
left: 120rpx;
@ -687,6 +780,7 @@
text-align: center;
position: relative;
}
.checkbox {
width: 180rpx;
height: 76rpx;
@ -699,9 +793,11 @@
margin: 0 10rpx 20rpx 0;
position: absolute;
top: 50rpx;
&:nth-of-type(1) {
left: -190rpx;
}
&:nth-of-type(2) {
left: 50rpx;
}
@ -712,6 +808,7 @@
background: #FE0606;
border: 1rpx solid #FE0606;
}
.checkbox checkbox {
display: none
}
@ -745,10 +842,12 @@
}
}
}
.show {
display: flex;
flex-wrap: wrap;
}
.hidden {
display: none;
}

@ -108,6 +108,21 @@
"style": {}
}]
},
{
"root": "packageElectron",
"pages": [{
"path": "index",
"style": {}
},
{
"path": "reconciliationDetails/index",
"style": {}
}, {
"path": "components/autograph",
"style": {}
}
]
},
{
"root": "packageOrders",
"pages": [{

@ -445,6 +445,12 @@
obj.color = 'blue',
obj.badge = 0
obj.name = list.roleName
}else if (list.roleName == '电子对账单') {
obj.cuIcon = 'punch',
obj.path = '/packageElectron/index',
obj.color = 'blue',
obj.badge = 0
obj.name = list.roleName
}
return obj
},

Loading…
Cancel
Save