电子结算单

pull/9/head
zhangyouji 1 year ago
parent a0b52f8a4c
commit dfbafd8ea8
  1. 18
      api/packageElectron/packageElectron.js
  2. 7
      api/packageIntegral/productList.js
  3. 16
      components/my-sign/index.js
  4. 320
      components/my-sign/my-sign.vue
  5. 186
      packageElectron/components/autograph.vue
  6. 221
      packageElectron/index.vue
  7. 192
      packageElectron/reconciliationDetails/index.vue
  8. 150
      packageIntegral/productAddition/index.vue
  9. 23
      packageIntegral/productList/index.vue
  10. 151
      packageIntegral/productUpdate/index.vue
  11. 18
      pages.json

@ -0,0 +1,18 @@
import request from '@/utils/request'
export default{
getByPage(data) {
return request({
url: `/oil-finance/xoilSiteElectronicStatement/getByPage`,
method: 'post',
data
})
},
update(data) {
return request({
url: `/oil-finance/xoilSiteElectronicStatement/update`,
method: 'PUT',
data
})
}
}

@ -66,4 +66,11 @@ export default{
data
})
},
deleteProductById(data) { // 删除商品接口
return request({
url: `/oil-mall/mobile/deleteProductById`,
method: 'post',
data
})
},
}

@ -0,0 +1,16 @@
/**
* 判断是否未数值
* @param {Object} val
*/
export function isNumber(val) {
return !isNaN(Number(val))
}
/**
* 处理大小单位
* @param {Object} val
*/
export function formatSize(val, unit = 'rpx') {
return isNumber(val) ? `${val}${unit}` : val
}

@ -0,0 +1,320 @@
<template>
<view class="signature-wrap">
<canvas
:canvas-id="cid"
:id="cid"
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
disable-scroll
:style="[
{
width: width && formatSize(width),
height: height && formatSize(height)
},
customStyle
]"
></canvas>
<slot />
</view>
</template>
<script>
/**
* sign canvas 手写签名
* @description 设置线条宽度颜色撤回清空
* @tutorial
* @property {String} cid canvas id 不设置则默认为 v-sign-时间戳
* @property {String, Number} width canvas 宽度
* @property {String, Number} height canvas 高度
* @property {bgColor} bgColor 画布背景颜色
* @property {Object} customStyle canvas 自定义样式
* @property {String} lineWidth 画笔大小权重小于 v-sign-pen 组件设置的画笔大小
* @property {Number} lineColor 画笔颜色权重小于 v-sign-pen 组件设置的画笔大小
* @event {Function} init 当创建完 canvas 实例后触发向外提供 canvas实例撤回清空方法
* @example <v-sign @init="signInit"></v-sign>
*/
import { formatSize } from './index.js'
export default {
name: 'my-sign',
props: {
// canvas id
cid: {
type: String,
default: `v-sign-${Date.now()}`
// required: true
},
// canvas
width: {
type: [String, Number]
},
// canvas
height: {
type: [String, Number]
},
// v-sign-pen penLineWidth
lineWidth: {
type: Number,
default: 4
},
// 线 v-sign-color penLineColor
lineColor: {
type: String,
default: '#333'
},
//
bgColor: {
type: String,
default: '#fff'
},
// canvas
customStyle: {
type: Object,
default: () => ({})
}
},
provide() {
return {
getSignInterface: this.provideSignInterface
}
},
data() {
return {
formatSize,
lineData: [],
winWidth: 0,
winHeight: 0,
penLineWidth: null, // v-sign-pen
penLineColor: null // v-sign-color
}
},
created() {
//
const { windowWidth, windowHeight } = uni.getSystemInfoSync()
this.winWidth = windowWidth
this.winHeight = windowHeight
},
mounted() {
this.canvasCtx = uni.createCanvasContext(this.cid, this)
// h5
// #ifdef H5
setTimeout(() => {
// #endif
this.setBackgroundColor(this.bgColor)
// #ifdef H5
}, 10)
// #endif
// init
this.$emit('init', this.provideSignInterface())
},
methods: {
onTouchStart(e) {
const pos = e.touches[0]
this.lineData.push({
style: {
color: this.penLineColor || this.lineColor,
width: this.penLineWidth || this.lineWidth
},
//
coordinates: [
{
type: e.type,
x: pos.x,
y: pos.y
}
]
})
this.drawLine()
},
onTouchMove(e) {
const pos = e.touches[0]
this.lineData[this.lineData.length - 1].coordinates.push({
type: e.type,
x: pos.x,
y: pos.y
})
this.drawLine()
},
onTouchEnd(e) {
this.$emit('end', this.lineData)
},
//
clear() {
this.lineData = []
this.canvasCtx.clearRect(0, 0, this.winWidth, this.winHeight)
this.canvasCtx.draw()
this.setBackgroundColor(this.bgColor)
this.$emit('clear')
},
//
revoke() {
this.setBackgroundColor(this.bgColor)
this.lineData.pop()
this.lineData.forEach((item, index) => {
this.canvasCtx.beginPath()
this.canvasCtx.setLineCap('round')
this.canvasCtx.setStrokeStyle(item.style.color)
this.canvasCtx.setLineWidth(item.style.width)
if (item.coordinates.length < 2) {
const pos = item.coordinates[0]
this.canvasCtx.moveTo(pos.x, pos.y)
this.canvasCtx.lineTo(pos.x + 1, pos.y)
} else {
item.coordinates.forEach(pos => {
if (pos.type == 'touchstart') {
this.canvasCtx.moveTo(pos.x, pos.y)
} else {
this.canvasCtx.lineTo(pos.x, pos.y)
}
})
}
this.canvasCtx.stroke()
})
this.canvasCtx.draw(true)
this.$emit('revoke', this.lineData)
},
// 线
drawLine() {
const lineDataLen = this.lineData.length
if (!lineDataLen) return
const currentLineData = this.lineData[lineDataLen - 1]
const coordinates = currentLineData.coordinates
const coordinatesLen = coordinates.length
if (!coordinatesLen) return
let startPos
let endPos
if (coordinatesLen < 2) {
// only start, no move event
startPos = coordinates[coordinatesLen - 1]
endPos = {
x: startPos.x + 1,
y: startPos.y
}
} else {
startPos = coordinates[coordinatesLen - 2]
endPos = coordinates[coordinatesLen - 1]
}
const style = currentLineData.style
this.canvasCtx.beginPath()
this.canvasCtx.setLineCap('round')
this.canvasCtx.setStrokeStyle(style.color)
this.canvasCtx.setLineWidth(style.width)
this.canvasCtx.moveTo(startPos.x, startPos.y)
this.canvasCtx.lineTo(endPos.x, endPos.y)
// const P1 = this.caculateBezier(startPos, endPos, centerPos)
// console.log(P1.x, P1.y)
// this.canvasCtx.moveTo(startPos.x, startPos.y)
// this.canvasCtx.quadraticCurveTo(P1.x, P1.y, endPos.x, endPos.y)
this.canvasCtx.stroke()
this.canvasCtx.draw(true)
},
// png filename h5
async saveImage(filename = '签名') {
const tempFilePath = await this.canvasToTempFilePath()
return new Promise((resolve, reject) => {
// #ifdef H5
try {
const a = document.createElement('a')
a.href = tempFilePath
a.download = filename
document.body.appendChild(a)
a.click()
a.remove()
resolve({
errMsg: 'saveImageH5:ok'
})
} catch (e) {
console.error(e)
reject(e)
}
// #endif
// #ifndef H5
uni.saveImageToPhotosAlbum({
filePath: tempFilePath,
success(resObj) {
resolve(resObj)
},
fail(err) {
reject(err)
}
})
// #endif
})
},
// canvas h5 base64
canvasToTempFilePath(conf = {}) {
return new Promise((resolve, reject) => {
uni.canvasToTempFilePath(
{
canvasId: this.cid,
...conf,
success: res => {
resolve(res.tempFilePath)
},
fail: err => {
console.log('fail', err)
reject(err)
}
},
this
)
})
},
setBackgroundColor(color = '#fff') {
this.canvasCtx.beginPath()
this.canvasCtx.setFillStyle(color)
this.canvasCtx.fillRect(0, 0, this.winWidth, this.winHeight)
this.canvasCtx.fill()
this.canvasCtx.draw(true)
},
setLineWidth(numberVal) {
this.penLineWidth = numberVal
},
setLineColor(strValue) {
this.penLineColor = strValue
},
//
provideSignInterface() {
return {
cid: this.cid,
ctx: this.canvasCtx,
clear: this.clear,
revoke: this.revoke,
saveImage: this.saveImage,
canvasToTempFilePath: this.canvasToTempFilePath,
setLineWidth: this.setLineWidth,
setLineColor: this.setLineColor,
setBackgroundColor: this.setBackgroundColor,
getLineData: () => this.lineData
}
},
/**
* 计算二次贝塞尔曲线 控制点 P1
* 起点 P0(x0,y0)控制点P1(x1, y1)P2(x2, y2)曲线上任意点B(x, y)
* 二次贝塞尔公式B(t) = (1-t)²P0 + 2t(1-t)P1 + t²P2
* 代入坐标得
* x = (1-t)²*x0 + 2t(1-t)*x1 + *x2
* y = (1-t)²*y0 + 2t(1-t)*y1 + *y2
*/
caculateBezier(P0, P2, B, t = 0.5) {
const { x: x0, y: y0 } = P0
const { x: x2, y: y2 } = P2
const { x, y } = B
let x1 = (x - (1 - t) * (1 - t) * x0 - t * t * x2) / (2 * t * (1 - t))
let y1 = (y - (1 - t) * (1 - t) * y0 - t * t * y2) / (2 * t * (1 - t))
return {
x: x1,
y: y1
}
}
}
}
</script>
<style lang="scss" scoped>
.signature-wrap {
position: relative;
}
</style>

@ -1,8 +1,192 @@
<template>
<view class="sign-contain">
<view class="sign-top">
请在空白处签字
</view>
<my-sign @init="onSignInit" @end="endConfirm" bgColor="#fff" width="100%" :height="signHeight">
</my-sign>
<!-- 按钮 -->
<view class="signBtn-box">
<view class="signBtn-item1">
<button type="default" plain="true" class="lnvestor-btn" hover-class="hover"
@click="cancelBtn">取消</button>
</view>
<view class="signBtn-item2">
<button type="default" plain="true" class="lnvestor-btn1" hover-class="hover"
@click="clear">清空重写</button>
<button type="primary" class="lnvestor-btn2" hover-class="hover"
@click="submitBtn" :disabled="vsignDisabled">提交签名</button>
</view>
</view>
</view>
</template>
<script>
import utils from '@/utils/encode'
export default {
data() {
return {
signHeight: '375px',
vsignDisabled: true,
detailsData:{}
}
},
onLoad(option) {
if(option!='{}'){
let stationData = JSON.parse(option.data)
this.detailsData = stationData
}
var that = this;
uni.getSystemInfo({
success: function(res) {
console.log('屏幕信息', res)
that.signHeight = (res.windowHeight-130)+"px";
}
})
},
methods: {
submitBtn(){
let File = this.signCtx.canvasToTempFilePath()
let imageUrl = ''
File.then(res=>{
let _that = this
const JSESSIONID = utils.uuid()
uni.uploadFile({
url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/uploadFile',
filePath: res,
formData: {
ossKey: 'xingyou',
pathKey: 'publicxingyou',
encrypt: 'PUBLIC',
},
name: 'file',
header: {
"Content-Type": "multipart/form-data",
"Authorization": uni.getStorageSync('Authorization'),
'dataSources': 'MP',
"imei": uni.getStorageSync('unionid'),
"openId": uni.getStorageSync('openid'),
'JSESSIONID': JSESSIONID,
'token': utils.md5Salt(JSESSIONID)
},
success(e) {
let obj = JSON.parse(e.data),
imageUrl = obj.data.publicUrl
_that.getImage(imageUrl)
},
fail(err) {}
})
})
},
getImage(imageUrl){
this.detailsData.signatureUrl = imageUrl
let stationInfo = JSON.stringify(this.detailsData)
uni.redirectTo({
url: `../reconciliationDetails/index?data=${stationInfo}`
})
},
//
cancelBtn(){
uni.navigateBack({
delta: 1
})
},
//
clear() {
this.signCtx.clear();
this.vsignDisabled = true;
},
onSignInit(signCtx) {
this.signCtx = signCtx
},
//
endConfirm() {
this.vsignDisabled = false;
}
}
}
</script>
<style>
<style lang="scss">
.sign-contain {
padding-left: 35rpx;
padding-right: 35rpx;
.sign-top {
width: 100%;
height: 50px;
line-height: 50px;
font-size: 16px;
text-align: center;
color: #999999;
}
.signBtn-box {
display: flex;
justify-content: space-between;
align-items: center;
.signBtn-item1 {
//
.lnvestor-btn {
margin-top: 11px;
width: 94px;
height: 40px;
border-radius: 20px;
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
}
.hover {
border: 1px solid #ccc !important;
color: #ccc !important;
font-size: 16px !important;
}
}
.signBtn-item2 {
display: flex;
//
.lnvestor-btn1 {
margin-top: 11px;
width: 128px;
height: 40px;
border-radius: 20px;
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
margin-right: 16px;
}
.lnvestor-btn2 {
margin-top: 11px;
width: 128px;
height: 40px;
border-radius: 20px;
display: flex;
justify-content: center;
align-items: center;
background: #b99c65;
font-size: 16px;
}
.hover {
border: 1px solid #ccc !important;
color: #ccc !important;
font-size: 16px !important;
}
}
}
}
</style>

@ -2,29 +2,33 @@
<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 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>
@click="selectOptions(index)">{{item.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 v-if="item.status!=0" class="introduce" @click="openDetails(item)">
<view>{{item.id}}</view>
<view>
结算周期
<view>{{item.beginReconciliationTime}} {{item.endReconciliationTime}}</view>
</view>
<view>结算金额{{item.statementAmount}}</view>
<view>推送时间{{item.reviewTime?item.reviewTime:'暂无'}}</view>
<view class="footer">
<view class="button">删除</view>
<view class="button">编辑</view>
<view v-if="item.status ==1" class="button" @click="openDetails(item)">点击确认</view>
<view v-if="item.status ==2" class="buttonConfirmed">已确认</view>
<view v-if="item.status ==3" class="buttonError">金额有误</view>
</view>
</view>
<view style="height: 30rpx; background: #fff;"></view>
</view>
</scroll-view>
<view v-else class="empty">
<image src="https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/yunsite-empty.png"></image>
@ -35,12 +39,9 @@
</template>
<script>
import serve from '@/api/packageIntegral/productList.js'
import serve from '@/api/packageElectron/packageElectron.js'
export default {
options: {
styleIsolation: 'shared'
},
data() {
return {
currentIndex: 0,
@ -49,22 +50,18 @@
pagesize: 20,
params: {},
},
dataList: [{},{}],
dataList: [],
optionsList: [{
text: '全部',
count: 0,
value: ''
}, {
text: '待确认',
count: 0,
value: ''
}, {
text: '已确认',
count: 0,
value: ''
}, {
text: '金额异常',
count: 0,
value: ''
}],
@ -73,36 +70,58 @@
},
onLoad() {
// this.productByPage()
// this.getTopInfo()
this.getByPage()
},
methods: {
selectOptions(index) {
this.currentIndex = index
console.log(index,'index')
this.paramter.currentPage = 1
if(index == 0){
this.paramter.params ={}
this.paramter.params.status = '5'
}else if(index ==1){
this.paramter.params ={}
this.paramter.params.productStatus = 1
this.paramter.params.status = '1'
}else if(index ==2){
this.paramter.params ={}
this.paramter.params.productStatus = 2
this.paramter.params.status = '2'
}else if(index ==3){
this.paramter.params ={}
this.paramter.params.auditStatus = 1
this.paramter.params.status = '3'
}
// this.productByPage()
this.getByPage()
},
getByPage(){
serve.getByPage(this.paramter).then(res=>{
if (res.code === 20000) {
if (!res.data.list.length&&this.paramter.currentPage!=1) {
uni.showToast({
title: '没有更多结算单啦~',
icon: 'none'
})
return
}
if (this.paramter.currentPage == 1) {
this.dataList = []
}
this.dataList = this.dataList.concat(res.data.list)
}
})
},
lower() {
this.paramter.currentPage += 1
// this.productByPage()
this.getByPage()
},
openDetails(item){
let stationInfo = JSON.stringify(item)
uni.navigateTo({
url: `./reconciliationDetails/index?data=${stationInfo}`
})
}
}
}
@ -117,8 +136,8 @@
>.options-frame {
display: flex;
justify-content: space-between;
margin-top: 43rpx;
padding: 0 31rpx;
background: #fff;
>view {
@ -128,110 +147,39 @@
line-height: 66rpx;
text-align: center;
color: #000000;
background: #F7F7F7;
>text {
color: #F83D3D;
}
&.active {
color: #FFF;
background: #F83D3D;
>text {
color: #fff;
}
color: #e19555;
border-bottom: 4rpx solid #e19555;
}
}
}
>.list {
margin-top: 35rpx;
margin: 30rpx;
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;
}
}
margin: 20rpx 60rpx 0 0;
.introduce {
position: relative;
padding: 24rpx 29rpx 31rpx 268rpx;
padding: 12rpx 24rpx 24rpx;
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;
}
}
background: #fff;
border: 2rpx solid #d7d7d7;
border-radius: 10rpx;
>view{
padding: 10rpx 0;
}
.examine{
width: 120rpx;
height: 45rpx;
color: #FFF;
text-align: center;
line-height: 45rpx;
position: absolute;
right: 50rpx;
top: 180rpx;
>view:nth-child(1){
font-weight: bold;
padding-bottom: 12rpx;
border-bottom: 2rpx solid #d7d7d7;
}
>.footer {
position: relative;
height: 58rpx;
@ -244,30 +192,49 @@
.button {
position: absolute;
top: 0;
width: 128rpx;
right: 10rpx;
width: 150rpx;
height: 58rpx;
line-height: 58rpx;
text-align: center;
font-size: 28rpx;
color: #999;
background: #FFF;
border: 1px solid #999;
color: #fff;
background: #169bd5;
border-radius: 10rpx;
}
>.button{
&:nth-of-type(1){
right: 360rpx;
}
&:nth-of-type(2){
right: 200rpx;
.buttonConfirmed{
position: absolute;
top: -85rpx;
right: 10rpx;
width: 150rpx;
height: 150rpx;
line-height: 150rpx;
text-align: center;
font-size: 28rpx;
color: #fff;
background: #7f7f7f;
border-radius: 75rpx;
transform: rotate(-45deg);
}
&:nth-of-type(3){
right: 40rpx;
.buttonError{
position: absolute;
top: -85rpx;
right: 10rpx;
width: 150rpx;
height: 150rpx;
line-height: 150rpx;
text-align: center;
font-size: 28rpx;
color: #fff;
background: #d9001b;
border-radius: 75rpx;
transform: rotate(-45deg);
}
}
}
}
}

@ -1,8 +1,198 @@
<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="body">
<view class="borderItem">
<text>结算周期</text>
<view>{{detailsData.beginReconciliationTime}} {{detailsData.endReconciliationTime}}</view>
</view>
<view class="borderItem">
<text>上期结转金额</text>{{detailsData.lastBalance}}
</view>
<view class="borderItem">
<text>打款金额</text>{{detailsData.amount}}
</view>
<view class="borderItem">
<text>消耗体积</text>{{detailsData.volume}}
</view>
<view class="borderItem">
<text>结算金额</text>{{detailsData.statementAmount}}
</view>
<view class="borderItem">
<text>余额</text>{{detailsData.balance}}
</view>
<view class="borderItem">
<text>充值应返返利金额</text>{{detailsData.rechargeRebateAmount?detailsData.rechargeRebateAmount:0}}
</view>
<view class="borderItem">
<text>充值已返返利金额</text>{{detailsData.realRechargeRebateAmount?detailsData.realRechargeRebateAmount:0}}
</view>
<view class="borderItem">
<text>消费应返返利金额</text>{{detailsData.consumeRebateAmount?detailsData.consumeRebateAmount:0}}
</view>
<view class="borderItem">
<text>消费已返返利金额</text>{{detailsData.realConsumeRebateAmount?detailsData.realConsumeRebateAmount:0}}
</view>
<view class="borderarea">
<view>备注</view>
<view class="uni-textarea" style="height: 100rpx;">
<textarea style="height: 100rpx;" v-model="detailsData.remark" />
</view>
</view>
<view v-if="detailsData.signatureUrl">
<image :src="detailsData.signatureUrl" style="height: 240rpx;"></image>
</view>
<view>
<view class="footer">
<view v-if="detailsData.status==1" class="button" @click="updateStatus(3)">金额有误</view>
<view v-if="!detailsData.signatureUrl&&detailsData.status==1" class="button" @click="toAutograph">确认无误并签字</view>
<view v-if="detailsData.signatureUrl&&detailsData.status==1" class="button" @click="updateStatus(2)">保存并提交</view>
</view>
</view>
</view>
</view>
</template>
<script>
import serve from '@/api/packageElectron/packageElectron.js'
export default {
data() {
return {
detailsData:{}
}
},
onLoad(option) {
if(option!='{}'){
let stationData = JSON.parse(option.data)
this.detailsData = stationData
}
},
methods: {
toAutograph(){
let stationInfo = JSON.stringify(this.detailsData)
uni.redirectTo({
url: `../components/autograph?data=${stationInfo}`
})
},
updateStatus(val){
if(val==3){
this.detailsData.signatureUrl = ''
delete this.detailsData.signatureUrl
}
this.detailsData.status = val
serve.update(this.detailsData).then(res=>{
if (res.code === 20000) {
uni.showToast({
title: res.msg,
icon: 'none'
})
wx.redirectTo({
url: `../index`
})
}
})
}
}
}
</script>
<style>
<style lang="scss" scoped>
.container {
height: 100vh;
display: flex;
flex-direction: column;
background: #f1f2f7 !important;
.body {
height: calc(100vh - 48rpx);
margin: 24rpx;
background: #ffffff;
padding: 30rpx;
border-radius: 20rpx;
.borderItem {
border-bottom: 1px solid #aaaaaa;
margin: 15rpx 0;
>text{
display: inline-block;
width: 300rpx;
}
}
>view:nth-child(1) {
margin: 0;
padding: 0 0 30rpx 0;
font-size: 32rpx;
}
.borderarea {
display: flex;
>view:nth-child(1) {
width: 100rpx;
}
>view:nth-child(2) {
width: 550rpx;
>textarea {
width: 550rpx;
height: 300rpx;
border: 1px solid #aaaaaa;
}
}
}
.footer {
position: relative;
height: 58rpx;
line-height: 58rpx;
padding: 0 34rpx 40rpx;
font-size: 32rpx;
color: #000;
font-weight: 550;
margin-top: 40rpx;
.button {
position: absolute;
top: 0;
width: 220rpx;
height: 58rpx;
line-height: 58rpx;
text-align: center;
font-size: 28rpx;
color: #fff;
border-radius: 10rpx;
}
>.button {
&:nth-of-type(1) {
right: 260rpx;
background: #d9001b;
}
&:nth-of-type(2) {
right: 0rpx;
background: #169bd5;
}
}
}
}
}
</style>

@ -51,12 +51,12 @@
<view id="instruction" :class="currentBoxId == 'instruction' ? 'show' : 'hidden'">
<uni-forms :modelValue="productDate" label-width="200rpx">
<uni-forms-item label="属性类别:">
<uni-forms-item label="选择规格:">
<uni-data-select v-model="productDate.attributesTypeId" :localdata="attributesTypeList"
placeholder="请选择商品品牌" @change="attributesData"></uni-data-select>
placeholder="请选择规格" @change="attributesData"></uni-data-select>
</uni-forms-item>
<view class="content" v-show="productDate.attributesTypeId">
<view style="margin: 10rpx 0;">商品类型</view>
<view style="margin: 10rpx 0;">商品规格</view>
<view>
<uni-section type="line">
<view class="uni-px-5" v-for="(item,index) in attributesList">
@ -170,6 +170,7 @@
isBoxShow: false,
productDate: {
productStatus: '1',
newMark: 1,
images: []
},
productList: [],
@ -268,16 +269,18 @@
checkbox(e) {
var index = e; //
var checkboxArr = this.radioItem; //
// if (checkboxArr[index].checked) return;//
// checkboxArr.forEach(item => {
// item.checked = false
// })
if (checkboxArr[index].checked == false) {
if (checkboxArr[index].checked) return; //
checkboxArr.forEach(item => {
item.checked = false
})
checkboxArr[index].checked = true; //checked
} else {
checkboxArr[index].checked = false; //checked
}
// if (checkboxArr[index].checked == false) {
// checkboxArr[index].checked = true; //checked
// } else {
// checkboxArr[index].checked = false; //checked
// }
if (checkboxArr[0].checked == true) {
this.productDate.newMark = 1
} else {
@ -294,6 +297,13 @@
let currentFlag = e.currentTarget.id;
if (currentFlag == 'next') {
this.$refs.productForm.validate().then(res => {
if (this.isNumber(this.productDate.price) == false) {
uni.showToast({
title: '商品售价不是数字',
icon: 'none'
})
return
}
switch (currentFlag) {
case 'next':
this.currentBoxId = 'instruction'
@ -383,7 +393,7 @@
if (this.checkedList.length < index + 1) {
this.checkedList.push({
attributeId: item.id,
checked: this.radioAttributes
checked: item.attributesList[index].value
})
} else {
let checked = []
@ -456,7 +466,7 @@
let _that = this
let imageUrl = ''
uni.chooseImage({
count: 10, //9
count: 1, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: function(res) {
@ -493,6 +503,7 @@
})
},
getImage(imageUrl) {
if (this.productDate.images.length < 10) {
if (JSON.stringify(this.productDate.images) == '[]') {
this.productDate.images.push({
url: imageUrl,
@ -504,6 +515,13 @@
mainMark: ''
})
}
} else {
uni.showToast({
title: '最多只能上传十张图片~',
icon: 'none'
})
}
},
setMainImage(items, index) {
let obj = items
@ -528,6 +546,9 @@
url: '/pages/index/index'
})
},
isNumber(value) {
return /^[0-9]+$/.test(value);
},
addCompleted() {
if (this.radioItem[0].checked = true) {
this.productDate.newMark == '1'
@ -539,6 +560,109 @@
} else {
this.productDate.recommend == '2'
}
if (!this.productDate.attributesTypeId) {
uni.showToast({
title: '请选择请选择规格',
icon: 'none'
})
return
}
if(this.attributesList.length==1){
if(!this.radioAttributes){
uni.showToast({
title: '请选择商品规格',
icon: 'none'
})
return
}
}
if(this.attributesList.length>1){
if(JSON.stringify(this.checkboxAttributes) == '[]'){
uni.showToast({
title: '请选择商品规格',
icon: 'none'
})
return
}
}
if (JSON.stringify(this.stockList.length) == '[]') {
uni.showToast({
title: '请选择商品规格',
icon: 'none'
})
return
} else {
this.stockList.forEach(tab => {
if (!tab.marketPrice) {
uni.showToast({
title: '市场价格必填!',
icon: 'none'
})
throw Error(`市场价格必填!`)
} else {
if (this.isNumber(tab.marketPrice) == false) {
uni.showToast({
title: '市场价格不是数字!',
icon: 'none'
})
throw Error(`市场价格不是数字!`)
}
}
if (!tab.sellPrice) {
uni.showToast({
title: '销售价格必填!',
icon: 'none'
})
throw Error(`销售价格必填!`)
} else {
if (this.isNumber(tab.sellPrice) == false) {
uni.showToast({
title: '销售价格不是数字!',
icon: 'none'
})
throw Error(`销售价格不是数字!`)
}
}
if (!tab.stock) {
uni.showToast({
title: '库存数量必填!',
icon: 'none'
})
throw Error(`库存数量必填!`)
} else {
if (this.isNumber(tab.stock) == false) {
uni.showToast({
title: '库存数量不是数字!',
icon: 'none'
})
throw Error(`库存数量不是数字!`)
}
}
if (!tab.integral) {
uni.showToast({
title: '积分价值必填!',
icon: 'none'
})
throw Error(`积分价值必填!`)
} else {
if (this.isNumber(tab.integral) == false) {
uni.showToast({
title: '积分价值不是数字!',
icon: 'none'
})
throw Error(`积分价值不是数字!`)
}
}
})
}
if (JSON.stringify(this.productDate.images) == '[]') {
uni.showToast({
title: '请上传商品图片',
icon: 'none'
})
return
}
this.productDate.checkedList = this.checkedList
this.productDate.stockList = this.stockList
serve.saveProduct(this.productDate).then(res => {

@ -31,9 +31,9 @@
:style="{background:statusEnum[item.auditStatus].color}">{{statusEnum[item.auditStatus].value}}
</view>
<view class="footer">
<view class="button" @click="orderDelete">删除</view>
<view class="button" @click="orderDelete(item)">删除</view>
<view class="button" @click="toEditOrder(item)">编辑</view>
<view class="button" @click="upDownFrame(item)">{{item.productStatus =='1'?'':''}}</view>
<view class="button" @click="upDownFrame(item)">{{item.productStatus =='1'?'':''}}</view>
</view>
</view>
<view style="height: 30rpx; background: #fff;"></view>
@ -72,7 +72,7 @@
<view class="title">是否删除该商品</view>
<view class="buttons">
<view @click="$refs.delete.close()">取消</view>
<view>确认</view>
<view @click="deleteIntegral">确认</view>
</view>
</view>
</uni-popup>
@ -167,7 +167,7 @@
methods: {
selectOptions(index) {
this.currentIndex = index
console.log(index, 'index')
this.paramter.currentPage = 1
if (index == 0) {
this.paramter.params = {}
} else if (index == 1) {
@ -215,7 +215,7 @@
productByPage() {
serve.productByPage(this.paramter).then(res => {
if (res.code === 20000) {
if (!res.data.list.length) {
if (!res.data.list.length&&this.paramter.currentPage!=1) {
uni.showToast({
title: '没有更多订单啦~',
icon: 'none'
@ -241,8 +241,19 @@
})
this.$refs.detail.open('center')
},
orderDelete() {
orderDelete(item) {
this.$refs.delete.open('center')
this.deleteData = item
},
deleteIntegral(){
serve.deleteProductById({id:this.deleteData.id}).then(res=>{
uni.showToast({
title: res.msg,
icon: 'none'
})
this.$refs.delete.close()
this.search()
})
},
toEditOrder(item) {
uni.navigateTo({

@ -51,12 +51,12 @@
<view id="instruction" :class="currentBoxId == 'instruction' ? 'show' : 'hidden'">
<uni-forms :modelValue="productDate" label-width="200rpx">
<uni-forms-item label="属性类别:">
<uni-forms-item label="选择规格:">
<uni-data-select v-model="productDate.attributesTypeId" :localdata="attributesTypeList"
placeholder="请选择商品品牌" @change="attributesData"></uni-data-select>
placeholder="请选择规格" @change="attributesData"></uni-data-select>
</uni-forms-item>
<view class="content" v-show="productDate.attributesTypeId">
<view style="margin: 10rpx 0;">商品类型</view>
<view style="margin: 10rpx 0;">商品规格</view>
<view>
<uni-section type="line">
<view class="uni-px-5" v-for="(item,index) in attributesList">
@ -323,16 +323,18 @@
checkbox(e) {
var index = e; //
var checkboxArr = this.radioItem; //
// if (checkboxArr[index].checked) return;//
// checkboxArr.forEach(item => {
// item.checked = false
// })
if (checkboxArr[index].checked == false) {
if (checkboxArr[index].checked) return; //
checkboxArr.forEach(item => {
item.checked = false
})
checkboxArr[index].checked = true; //checked
} else {
checkboxArr[index].checked = false; //checked
}
// if (checkboxArr[index].checked == false) {
// checkboxArr[index].checked = true; //checked
// } else {
// checkboxArr[index].checked = false; //checked
// }
if (checkboxArr[0].checked == true) {
this.productDate.newMark = 1
} else {
@ -349,6 +351,13 @@
let currentFlag = e.currentTarget.id;
if (currentFlag == 'next') {
this.$refs.productForm.validate().then(res => {
if (this.isNumber(this.productDate.price) == false) {
uni.showToast({
title: '商品售价请输入数字',
icon: 'none'
})
return
}
switch (currentFlag) {
case 'next':
this.currentBoxId = 'instruction'
@ -439,7 +448,7 @@
if (this.checkedList.length < index + 1) {
this.checkedList.push({
attributeId: item.id,
checked: this.radioAttributes
checked: item.attributesList[index].value
})
} else {
let checked = []
@ -541,12 +550,13 @@
fail(err) {}
})
},
fail() {
console.log('相机调用失败')
fail(err) {
console.log('相机调用失败',err)
}
})
},
getImage(imageUrl) {
if (this.productDate.images.length < 10) {
if (JSON.stringify(this.productDate.images) == '[]') {
this.productDate.images.push({
url: imageUrl,
@ -558,6 +568,12 @@
mainMark: ''
})
}
} else {
uni.showToast({
title: '最多只能上传十张图片~',
icon: 'none'
})
}
},
setMainImage(items, index) {
let obj = items
@ -580,6 +596,9 @@
closed() {
uni.navigateBack()
},
isNumber(value) {
return /^[0-9]+$/.test(value);
},
addCompleted() {
if (this.radioItem[0].checked = true) {
this.productDate.newMark == '1'
@ -591,6 +610,108 @@
} else {
this.productDate.recommend == '2'
}
if(this.attributesList.length==1){
if(!this.radioAttributes){
uni.showToast({
title: '请选择商品规格',
icon: 'none'
})
return
}
}
if(this.attributesList.length>1){
if(JSON.stringify(this.checkboxAttributes) == '[]'){
uni.showToast({
title: '请选择商品规格',
icon: 'none'
})
return
}
}
if (!this.productDate.attributesTypeId) {
uni.showToast({
title: '请选择规格',
icon: 'none'
})
return
}
if (JSON.stringify(this.stockList.length) == '[]') {
uni.showToast({
title: '请选择商品规格',
icon: 'none'
})
return
} else {
this.stockList.forEach(tab => {
if (!tab.marketPrice) {
uni.showToast({
title: '市场价格必填!',
icon: 'none'
})
throw Error(`市场价格必填!`)
} else {
if (this.isNumber(tab.marketPrice) == false) {
uni.showToast({
title: '市场价格不是数字!',
icon: 'none'
})
throw Error(`市场价格不是数字!`)
}
}
if (!tab.sellPrice) {
uni.showToast({
title: '销售价格必填!',
icon: 'none'
})
throw Error(`销售价格必填!`)
} else {
if (this.isNumber(tab.sellPrice) == false) {
uni.showToast({
title: '销售价格不是数字!',
icon: 'none'
})
throw Error(`销售价格不是数字!`)
}
}
if (!tab.stock) {
uni.showToast({
title: '库存数量必填!',
icon: 'none'
})
throw Error(`库存数量必填!`)
} else {
if (this.isNumber(tab.stock) == false) {
uni.showToast({
title: '库存数量不是数字!',
icon: 'none'
})
throw Error(`库存数量不是数字!`)
}
}
if (!tab.integral) {
uni.showToast({
title: '积分价值必填!',
icon: 'none'
})
throw Error(`积分价值必填!`)
} else {
if (this.isNumber(tab.integral) == false) {
uni.showToast({
title: '积分价值不是数字!',
icon: 'none'
})
throw Error(`积分价值不是数字!`)
}
}
})
}
if (JSON.stringify(this.productDate.images) == '[]') {
uni.showToast({
title: '请上传商品图片',
icon: 'none'
})
return
}
this.productDate.checkedList = this.checkedList
this.productDate.stockList = this.stockList
serve.updateProduct(this.productDate).then(res => {
@ -598,7 +719,7 @@
title: res.msg,
icon: 'none'
})
uni.navigateTo({
wx.navigateBack({
url: `../productList/index`
})
})

@ -91,19 +91,19 @@
"pages": [{
"path": "takeGoods/index",
"style": {}
},{
}, {
"path": "orderDetails/index",
"style": {}
},{
}, {
"path": "orderList/index",
"style": {}
},{
}, {
"path": "productList/index",
"style": {}
},{
}, {
"path": "productAddition/index",
"style": {}
},{
}, {
"path": "productUpdate/index",
"style": {}
}]
@ -119,7 +119,13 @@
"style": {}
}, {
"path": "components/autograph",
"style": {}
"style": {
"navigationBarTitleText": "签字",
"enablePullDownRefresh": false,
"pageOrientation": "landscape",
"backgroundColor": "#f8f8f8",
"navigationStyle": "custom"
}
}
]
},

Loading…
Cancel
Save