|
|
@@ -1,5 +1,5 @@
|
|
|
import { queryPermancePlanTmp } from "../../../../services/api/orders/index"
|
|
|
-import { accountid, clientType, getErrorMsg, isEncrypted, marketID, marketid, protoHeader, timetample, userid } from "../../../../services/utils"
|
|
|
+import { accountid, clientType, getErrorMsg, isEncrypted, marketID, protoHeader, timetample, userid } from "../../../../services/utils"
|
|
|
import { hideLoading, showLoading, showModel, showToast } from "../../../../utils/message/index"
|
|
|
import services from "../../../../services/index"
|
|
|
import { formatDate, getDecimalNum } from "../../../../utils/util"
|
|
|
@@ -32,9 +32,7 @@ Page({
|
|
|
/// 结束日期
|
|
|
enddate: formatDate(new Date()),
|
|
|
/// 文件上传列表
|
|
|
- fileList: [],
|
|
|
- /// 上传的文件路径
|
|
|
- filePath: '',
|
|
|
+ fileList: <GuangZuan.UploadRsp[]>[],
|
|
|
/// 商品名称
|
|
|
wrstandname: '',
|
|
|
/// 预售总量
|
|
|
@@ -83,7 +81,7 @@ Page({
|
|
|
/// 显示信息
|
|
|
actions: [''],
|
|
|
/// 数据信息
|
|
|
- datas: [{ price: '', qty: '0.0', step: 1 }]
|
|
|
+ datas: [{ price: '', qty: '0.01' }]
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -149,6 +147,12 @@ Page({
|
|
|
showToast('请输入采购保证金比例')
|
|
|
return false
|
|
|
}
|
|
|
+
|
|
|
+ /// 请上传附件
|
|
|
+ if (this.data.fileList.length === 0) {
|
|
|
+ showToast('请上传附件')
|
|
|
+ return false
|
|
|
+ }
|
|
|
return true
|
|
|
},
|
|
|
|
|
|
@@ -216,11 +220,9 @@ Page({
|
|
|
return
|
|
|
}
|
|
|
// 上传完成需要更新 fileList
|
|
|
- const { fileList = [] } = this.data;
|
|
|
- fileList.push({ ...file, url: res.data});
|
|
|
- this.setData({ fileList });
|
|
|
- /// 设置文件路径
|
|
|
- this.setData({ filePath: JSON.parse(res.data)[0].filePath })
|
|
|
+ const { fileList = [] } = this.data
|
|
|
+ fileList.push({ ...file, url: JSON.parse(res.data) })
|
|
|
+ this.setData({ fileList })
|
|
|
},
|
|
|
});
|
|
|
},
|
|
|
@@ -254,19 +256,28 @@ Page({
|
|
|
doSubmit() {
|
|
|
/// 校验不合规
|
|
|
if (!this.check()) { return }
|
|
|
+ /// 地址拼接
|
|
|
+ var fileUrl = ''
|
|
|
+ for (let i = 0; i < this.data.fileList.length; i++) {
|
|
|
+ const obj = this.data.fileList[i];
|
|
|
+ fileUrl = fileUrl+obj.url[0].filePath
|
|
|
+ if (i != this.data.fileList.length-1) { fileUrl = fileUrl+"," }
|
|
|
+ }
|
|
|
|
|
|
/// showModel
|
|
|
showModel(() => {
|
|
|
/// showLoading
|
|
|
showLoading(() => {
|
|
|
/// 钻石属性
|
|
|
- var list = this.data.datas.map(obj => {
|
|
|
- return {
|
|
|
- StepIndex: obj.step,
|
|
|
+ var list: { Price: number, Qty: number, StepIndex: number }[] = []
|
|
|
+ for (let i = 0; i < this.data.datas.length; i++) {
|
|
|
+ const obj = this.data.datas[i]
|
|
|
+ list.push({
|
|
|
+ StepIndex: i+1,
|
|
|
Qty: Number(obj.qty),
|
|
|
Price: Number(obj.price)
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
/// 请求参数
|
|
|
const info = JSON.stringify({
|
|
|
@@ -281,7 +292,7 @@ Page({
|
|
|
StartDate: this.data.startdate,
|
|
|
EndDate: this.data.enddate,
|
|
|
BuyMarginAlgorithm: 1,
|
|
|
- BuyMarginValue: this.data.buymarginvalue,
|
|
|
+ BuyMarginValue: Number(this.data.buymarginvalue)/100.0,
|
|
|
PerformanceTemplateID: this.data.tmp.autoid,
|
|
|
YSZSCategory: this.data.category,
|
|
|
ZSShapeTypeStr: this.data.zsshape,
|
|
|
@@ -292,7 +303,7 @@ Page({
|
|
|
ZSPolishTypeStr: this.data.zspolish,
|
|
|
ZSFluorescenceTypeStr: this.data.zsfluorescence,
|
|
|
SizeStr: this.data.zssize,
|
|
|
- PictureUrls: this.data.filePath,
|
|
|
+ PictureUrls: fileUrl,
|
|
|
Remark: this.data.remark,
|
|
|
GZCenterPurchasePriceLists: list,
|
|
|
YieldRate: this.data.zsyield,
|
|
|
@@ -360,7 +371,7 @@ Page({
|
|
|
*/
|
|
|
addPrice() {
|
|
|
this.setData({
|
|
|
- datas: this.data.datas.concat([{ price: '', qty: '', step: this.data.datas.length+1 }])
|
|
|
+ datas: this.data.datas.concat([{ price: '', qty: '' }])
|
|
|
})
|
|
|
},
|
|
|
|
|
|
@@ -369,14 +380,16 @@ Page({
|
|
|
*/
|
|
|
deleteRow(e: any) {
|
|
|
const row = e.target.id
|
|
|
- var obj = this.data.datas[row-1]
|
|
|
- if ( Number(obj.qty) === 0 && row === '1') {
|
|
|
+
|
|
|
+ var obj = this.data.datas[row]
|
|
|
+ console.log(e, obj)
|
|
|
+ if ( Number(obj.qty) === 0.01 && row === '0') {
|
|
|
showToast('第一条数据信息不能删除')
|
|
|
return
|
|
|
}
|
|
|
/// 删除数据
|
|
|
- this.data.datas.splice(row-1, 1)
|
|
|
- this.setData({ datas: this.data.datas })
|
|
|
+ this.data.datas.splice(row, 1)
|
|
|
+ this.setData({ datas: this.data.datas})
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -387,14 +400,14 @@ Page({
|
|
|
const ids = (<string> e.target.id).split(' ')
|
|
|
const row = <number><unknown>ids[0]
|
|
|
const id = ids[1]
|
|
|
- var obj = this.data.datas[row-1]
|
|
|
+ var obj = this.data.datas[row]
|
|
|
/// 截取两位小数
|
|
|
let num = getDecimalNum(e.detail)
|
|
|
/// 数据赋值
|
|
|
if (id === "qty") { obj.qty = num } else { obj.price = num }
|
|
|
/// 删除数据
|
|
|
- this.data.datas.splice(row-1, 1)
|
|
|
- this.data.datas.splice(row-1, 0, obj)
|
|
|
+ this.data.datas.splice(row, 1)
|
|
|
+ this.data.datas.splice(row, 0, obj)
|
|
|
this.setData({ datas: this.data.datas })
|
|
|
},
|
|
|
|