|
|
@@ -1,3 +1,10 @@
|
|
|
+import { EOrderSrc } from "../../../constants/enum/index";
|
|
|
+import { FunCode } from "../../../constants/enum/funcode";
|
|
|
+import { sendMsgToMQ } from "../../../services/api/common/index";
|
|
|
+import { accountid, clientType, getEnumList, isEncrypted, marketid, protoHeader, timetample, userid } from "../../../services/utils";
|
|
|
+import { hideLoading, showLoading, showModel, showToast } from "../../../utils/message/index";
|
|
|
+import { queryPermancePlanTmp } from "../../../services/api/orders/index";
|
|
|
+
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
@@ -7,104 +14,79 @@ Page({
|
|
|
/// 底部安全区域
|
|
|
safeBottom: getApp().globalData.safeBottom,
|
|
|
/// tabs
|
|
|
- tabs: [{id: 2, name: '单颗裸钻'}, {id: 5, name: '单颗彩钻'}],
|
|
|
+ tabs: [{ id: 2, name: '单颗裸钻' }, { id: 5, name: '单颗彩钻' }],
|
|
|
/// tab索引
|
|
|
active: 0,
|
|
|
- /// 款式
|
|
|
- styles: [{id: 1, name: '戒指', isCheck: true},
|
|
|
- {id: 2, name: '吊坠', isCheck: false},
|
|
|
- {id: 3, name: '耳环', isCheck: false},
|
|
|
- {id: 4, name: '手镯', isCheck: false},
|
|
|
- {id: 5, name: '其他', isCheck: false}],
|
|
|
- /// 选中形状
|
|
|
- style: '戒指',
|
|
|
+ /// 币种信息
|
|
|
+ currencys: [{ value: 1, text: '人民币' }],
|
|
|
+ /// 币种类型
|
|
|
+ currency: 1,
|
|
|
/// 形状
|
|
|
- shapes: [{id: 1, name: '圆形', isCheck: true},
|
|
|
- {id: 2, name: '公主方', isCheck: false},
|
|
|
- {id: 3, name: '祖母绿', isCheck: false},
|
|
|
- {id: 4, name: '垫形', isCheck: false},
|
|
|
- {id: 5, name: '阿斯切', isCheck: false},
|
|
|
- {id: 6, name: '心形', isCheck: false},
|
|
|
- {id: 7, name: '梨形', isCheck: false},
|
|
|
- {id: 8, name: '雷迪恩', isCheck: false},
|
|
|
- {id: 9, name: '椭圆', isCheck: false},
|
|
|
- {id: 10, name: '马眼', isCheck: false}],
|
|
|
+ shapes: [{ id: 1, name: '圆形', isCheck: true }],
|
|
|
/// 选中形状
|
|
|
- shape: '圆形',
|
|
|
+ shape: 0,
|
|
|
/// 颜色
|
|
|
- colors: [{id: 1, name: 'D', isCheck: true},
|
|
|
- {id: 2, name: 'E', isCheck: false},
|
|
|
- {id: 3, name: 'F', isCheck: false},
|
|
|
- {id: 4, name: 'G', isCheck: false},
|
|
|
- {id: 5, name: 'H', isCheck: false},
|
|
|
- {id: 6, name: 'I', isCheck: false},
|
|
|
- {id: 7, name: 'J', isCheck: false},
|
|
|
- {id: 8, name: 'K', isCheck: false},
|
|
|
- {id: 9, name: 'L', isCheck: false}],
|
|
|
- /// 选中颜色
|
|
|
- color: '',
|
|
|
+ colors: [{ value: 1, text: 'D' }],
|
|
|
+ /// 选中颜色1
|
|
|
+ color1: 1,
|
|
|
+ /// 选中颜色2
|
|
|
+ color2: 1,
|
|
|
/// 切工
|
|
|
- qiegongs: [{id: 1, name: 'EX', isCheck: true},
|
|
|
- {id: 2, name: 'VG', isCheck: false},
|
|
|
- {id: 3, name: 'G', isCheck: false}],
|
|
|
- /// 选中切工
|
|
|
- qiegong: '',
|
|
|
- /// 晶体
|
|
|
- jingxings: [{id: 1, name: 'Makeable', isCheck: true},
|
|
|
- {id: 2, name: 'Sawable', isCheck: false},
|
|
|
- {id: 3, name: 'Heart', isCheck: false},
|
|
|
- {id: 4, name: 'Melee', isCheck: false},
|
|
|
- {id: 5, name: 'Trilliant', isCheck: false},
|
|
|
- {id: 6, name: 'Mixed', isCheck: false},
|
|
|
- {id: 7, name: 'Others', isCheck: false}],
|
|
|
- /// 选中晶体
|
|
|
- jingxing: '',
|
|
|
+ qiegongs: [{ value: 1, text: 'EX' }],
|
|
|
+ /// 选中切工1
|
|
|
+ qiegong1: 1,
|
|
|
+ /// 选中切工2
|
|
|
+ qiegong2: 1,
|
|
|
/// 对称
|
|
|
- duichengs: [{id: 1, name: 'EX', isCheck: true},
|
|
|
- {id: 2, name: 'VG', isCheck: false},
|
|
|
- {id: 3, name: 'G', isCheck: false}],
|
|
|
- /// 选中对称
|
|
|
- duicheng: '',
|
|
|
- /// 抛光
|
|
|
- paoguangs: [{id: 1, name: 'EX', isCheck: true},
|
|
|
- {id: 2, name: 'VG', isCheck: false},
|
|
|
- {id: 3, name: 'G', isCheck: false}],
|
|
|
- /// 选中抛光
|
|
|
- paoguang: '',
|
|
|
+ duichengs: [{ value: 1, text: 'EX' }],
|
|
|
+ /// 选中对称1
|
|
|
+ duicheng1: 1,
|
|
|
+ /// 选中对称2
|
|
|
+ duicheng2: 2,
|
|
|
+ /// 抛光
|
|
|
+ paoguangs: [{ value: 1, text: 'EX' }],
|
|
|
+ /// 选中抛光1
|
|
|
+ paoguang1: 1,
|
|
|
+ /// 选中抛光2
|
|
|
+ paoguang2: 2,
|
|
|
/// 莹光
|
|
|
- yingguangs: [{id: 1, name: 'N', isCheck: true},
|
|
|
- {id: 2, name: 'VSL/F', isCheck: false},
|
|
|
- {id: 3, name: 'M', isCheck: false},
|
|
|
- {id: 4, name: 'S', isCheck: false}],
|
|
|
- /// 选中莹光
|
|
|
- yingguang: '',
|
|
|
+ yingguangs: [{ value: 1, text: 'N' }],
|
|
|
+ /// 选中莹光1
|
|
|
+ yingguang1: 1,
|
|
|
+ /// 选中莹光2
|
|
|
+ yingguang2: 2,
|
|
|
/// 净度
|
|
|
- neatness: [{id: 1, name: 'FL/IF', isCheck: true},
|
|
|
- {id: 2, name: 'VVS1', isCheck: false},
|
|
|
- {id: 3, name: 'VVS2', isCheck: false},
|
|
|
- {id: 4, name: 'VS1', isCheck: false},
|
|
|
- {id: 5, name: 'VS2', isCheck: false},
|
|
|
- {id: 6, name: 'Sl1', isCheck: false},
|
|
|
- {id: 7, name: 'Sl2', isCheck: false},
|
|
|
- {id: 8, name: 'l1', isCheck: false}],
|
|
|
- /// 选中净度
|
|
|
- neatnes: '',
|
|
|
+ neatness: [{ value: 1, text: 'FL/IF' }],
|
|
|
+ /// 选中净度1
|
|
|
+ neatnes1: 1,
|
|
|
+ /// 选中净度2
|
|
|
+ neatnes2: 1,
|
|
|
+ /// 履约模板信息
|
|
|
+ tmps: <GuangZuan.PermancePlanTmp[]>[],
|
|
|
+ /// 选中履约模板
|
|
|
+ tmp: <GuangZuan.PermancePlanTmp>({}),
|
|
|
+ /// 是否显示
|
|
|
+ show: false,
|
|
|
+ /// 显示信息
|
|
|
+ actions: [''],
|
|
|
+ /// 最小尺寸
|
|
|
+ minSize: 0.0,
|
|
|
+ /// 最大尺寸
|
|
|
+ maxSize: 0.0
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* tab触发事件
|
|
|
*/
|
|
|
onTabChange(e: any) {
|
|
|
- this.setData({
|
|
|
- active: e.detail.index
|
|
|
- })
|
|
|
+ /// 激活项
|
|
|
+ this.setData({ active: e.detail.index })
|
|
|
},
|
|
|
|
|
|
/// 单选框
|
|
|
onChange(e: any) {
|
|
|
switch (e.target.id) {
|
|
|
- default:
|
|
|
- break;
|
|
|
+ default: break;
|
|
|
}
|
|
|
},
|
|
|
|
|
|
@@ -121,7 +103,6 @@ Page({
|
|
|
const ids = (<string> e.target.id).split(' ')
|
|
|
let id = (<string> e.target.id).split(' ')[0]
|
|
|
const index = <number> <unknown>ids[1]
|
|
|
-
|
|
|
switch (id) {
|
|
|
case 'shape': /// 形状
|
|
|
this.setData({ shapes: this.data.shapes.map(item => {
|
|
|
@@ -132,104 +113,214 @@ Page({
|
|
|
}
|
|
|
return item
|
|
|
}) })
|
|
|
- break;
|
|
|
- case 'color': /// 颜色
|
|
|
- this.setData({ colors: this.data.colors.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
- case 'jingxing': /// 晶型
|
|
|
- this.setData({ jingxings: this.data.jingxings.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
- case 'style': /// 款式
|
|
|
- this.setData({ styles: this.data.styles.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
- case 'neatness': /// 净度
|
|
|
- this.setData({ neatness: this.data.neatness.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
- case 'qiegong': /// 切工
|
|
|
- this.setData({ qiegongs: this.data.qiegongs.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
- case 'duicheng': /// 对称
|
|
|
- this.setData({ duichengs: this.data.duichengs.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
- case 'polishing': /// 抛光
|
|
|
- this.setData({ paoguangs: this.data.paoguangs.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
- case 'yingguang': /// 荧光
|
|
|
- this.setData({ yingguangs: this.data.yingguangs.map(item => {
|
|
|
- if (item.id == index) {
|
|
|
- item.isCheck = true
|
|
|
- } else {
|
|
|
- item.isCheck = false
|
|
|
- }
|
|
|
- return item
|
|
|
- }) })
|
|
|
- break;
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * 按钮点击响应事件
|
|
|
- */
|
|
|
- toSubmit() {
|
|
|
-
|
|
|
+ /// 显示履约模板
|
|
|
+ showPlanTmps() {
|
|
|
+ this.setData({ show: true })
|
|
|
+ },
|
|
|
+
|
|
|
+ /// 关闭
|
|
|
+ onClose() {
|
|
|
+ this.setData({ show: false })
|
|
|
+ },
|
|
|
+
|
|
|
+ onSelect(e: any) {
|
|
|
+ /// 默认显示项
|
|
|
+ const { index } = e.detail;
|
|
|
+ this.setData({ tmp: this.data.tmps[index], show: false })
|
|
|
+ },
|
|
|
+
|
|
|
+ onRadioChange(e: any) {
|
|
|
+ console.log(e)
|
|
|
+ },
|
|
|
+
|
|
|
+ /// 重量范围值更改
|
|
|
+ syncNumRange(e: any) {
|
|
|
+ this.setData({
|
|
|
+ minSize: e.detail.value[0],
|
|
|
+ maxSize: e.detail.value[1],
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /// 获取履约模板信息
|
|
|
+ queryPermancePlanTmp() {
|
|
|
+ /// showLoading
|
|
|
+ showLoading(() => {
|
|
|
+ queryPermancePlanTmp({
|
|
|
+ data: {
|
|
|
+ marketid: marketid()
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ /// 获取数据
|
|
|
+ this.setData({
|
|
|
+ tmps: res.data,
|
|
|
+ tmp: res.data[0],
|
|
|
+ actions: res.data.map(obj => { return obj.templatename })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ /// hideLoading
|
|
|
+ hideLoading()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /// 发布求购
|
|
|
+ doListingBuy() {
|
|
|
+ /// showModel
|
|
|
+ showModel(() => {
|
|
|
+ /// showLoading
|
|
|
+ showLoading(() => {
|
|
|
+ /// 钻石属性
|
|
|
+ const exinfo = {
|
|
|
+ UserID: userid(),
|
|
|
+ AccountID: accountid(),
|
|
|
+ ZSCategory: this.data.tabs[this.data.active].id,
|
|
|
+ ZSCurrencyType: [this.data.currency],
|
|
|
+ ZSShapeType: [this.data.shape],
|
|
|
+ ZSColorType: [this.data.color1, this.data.color2],
|
|
|
+ ZSClarityType: [this.data.neatnes1, this.data.neatnes2],
|
|
|
+ ZSCutType: [this.data.qiegong1, this.data.qiegong2],
|
|
|
+ ZSSymmetryType: [this.data.duicheng1, this.data.duicheng2],
|
|
|
+ ZSPolishType: [this.data.paoguang1, this.data.paoguang2],
|
|
|
+ ZSFluorescenceType: [this.data.yingguang1, this.data.yingguang2],
|
|
|
+ Size: [this.data.minSize, this.data.maxSize],
|
|
|
+ ZSCZColor1Type: [this.data.color1, this.data.color2],
|
|
|
+ }
|
|
|
+ /// 请求参数
|
|
|
+ const params = {
|
|
|
+ Header: protoHeader(FunCode.ZSBuyOrderListingReq),
|
|
|
+ UserID: userid(),
|
|
|
+ AccountID: accountid(),
|
|
|
+ GZ_BuyOrderDetailExInfo: exinfo,
|
|
|
+ PerformanceTemplateID: this.data.tmp.autoid,
|
|
|
+ MarketID: marketid(),
|
|
|
+ OrderSrc: EOrderSrc.ORDERSRC_CLIENT,
|
|
|
+ ClientType: clientType(),
|
|
|
+ ClientSerialNo: timetample().toString()
|
|
|
+ }
|
|
|
+ /// 发送请求
|
|
|
+ sendMsgToMQ({
|
|
|
+ data: {
|
|
|
+ data: JSON.stringify(params),
|
|
|
+ funCodeReq: FunCode.ZSBuyOrderListingReq,
|
|
|
+ funCodeRsp: FunCode.ZSBuyOrderListingRsp,
|
|
|
+ isEncrypted: isEncrypted()
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ /// 请求失败
|
|
|
+ if (res.code != 0) {
|
|
|
+ hideLoading(()=>{}, '求购请求失败,原因:'+res.msg, 'error')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ /// 求购发布请求成功
|
|
|
+ hideLoading(() => {
|
|
|
+ wx.navigateBack()
|
|
|
+ }, '求购发布请求成功', 'success')
|
|
|
+ },
|
|
|
+ fail: (emsg) => {
|
|
|
+ hideLoading(()=>{}, '求购请求失败,原因:'+emsg, 'error')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, '求购请求中....')
|
|
|
+ }, '提示', '确认要发布求购吗?')
|
|
|
+ },
|
|
|
+
|
|
|
+ /// 合规性校验
|
|
|
+ check(): boolean {
|
|
|
+ /// 请选择形状
|
|
|
+ if (this.data.shape === 0) {
|
|
|
+ showToast('请选择形状')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad() {
|
|
|
-
|
|
|
+ this.setData({
|
|
|
+ /// 形状
|
|
|
+ shapes: getEnumList('ZSShapeType').map(obj => {
|
|
|
+ return {
|
|
|
+ id: obj.enumitemname,
|
|
|
+ name: obj.enumdicname,
|
|
|
+ isCheck: false
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ shape: getEnumList('ZSShapeType')[0].enumitemname,
|
|
|
+ /// 颜色
|
|
|
+ colors: getEnumList('ZSColorType').map(obj => {
|
|
|
+ return {
|
|
|
+ value: obj.enumitemname,
|
|
|
+ text: obj.enumdicname
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ color1: getEnumList('ZSColorType')[0].enumitemname,
|
|
|
+ color2: getEnumList('ZSColorType')[0].enumitemname,
|
|
|
+ /// 净度
|
|
|
+ neatness: getEnumList('ZSClarityType').map(obj => {
|
|
|
+ return {
|
|
|
+ value: obj.enumitemname,
|
|
|
+ text: obj.enumdicname
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ neatnes1: getEnumList('ZSClarityType')[0].enumitemname,
|
|
|
+ neatnes2: getEnumList('ZSClarityType')[0].enumitemname,
|
|
|
+ /// 切工
|
|
|
+ qiegongs: getEnumList('ZSCutType').map(obj => {
|
|
|
+ return {
|
|
|
+ value: obj.enumitemname,
|
|
|
+ text: obj.enumdicname
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ qiegong1: getEnumList('ZSCutType')[0].enumitemname,
|
|
|
+ qiegong2: getEnumList('ZSCutType')[0].enumitemname,
|
|
|
+ /// 对称
|
|
|
+ duichengs: getEnumList('ZSSymmetryType').map(obj => {
|
|
|
+ return {
|
|
|
+ value: obj.enumitemname,
|
|
|
+ text: obj.enumdicname
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ duicheng1: getEnumList('ZSSymmetryType')[0].enumitemname,
|
|
|
+ duicheng2: getEnumList('ZSSymmetryType')[0].enumitemname,
|
|
|
+ /// 抛光
|
|
|
+ paoguangs: getEnumList('ZSPolishType').map(obj => {
|
|
|
+ return {
|
|
|
+ value: obj.enumitemname,
|
|
|
+ text: obj.enumdicname
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ paoguang1: getEnumList('ZSPolishType')[0].enumitemname,
|
|
|
+ paoguang2: getEnumList('ZSPolishType')[0].enumitemname,
|
|
|
+ /// 荧光
|
|
|
+ yingguangs: getEnumList('ZSFluorescenceType').map(obj => {
|
|
|
+ return {
|
|
|
+ value: obj.enumitemname,
|
|
|
+ text: obj.enumdicname
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ yingguang1: getEnumList('ZSFluorescenceType')[0].enumitemname,
|
|
|
+ yingguang2: getEnumList('ZSFluorescenceType')[0].enumitemname,
|
|
|
+ /// 币种信息
|
|
|
+ currencys: getEnumList('ZSCurrencyType').map(obj => {
|
|
|
+ return {
|
|
|
+ value: obj.enumitemname,
|
|
|
+ text: obj.enumdicname
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ currency: getEnumList('ZSCurrencyType')[0].enumitemname,
|
|
|
+ })
|
|
|
+ /// 获取履约模板信息
|
|
|
+ this.queryPermancePlanTmp()
|
|
|
},
|
|
|
|
|
|
/**
|