<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache">
|
<title>优惠政策明细选择弹窗</title>
|
|
<script type="text/javascript">
|
var pageVue = null;
|
function loadJsCss(callback) {
|
var jscss_urls = [];
|
window.top.initJsCss(document, jscss_urls, callback);
|
};
|
|
function initVue() {
|
new ListVue({
|
el: "#vbody",
|
data: {
|
dataname: "",
|
sku_dataname: "md_prod_sku",
|
|
title: "优惠政策明细选择弹窗",
|
pageAttr: {
|
heightType: "popuppage"
|
},
|
dataRequest: [
|
{
|
name: "md_bu_product", // 产品下拉项
|
dataname: "md_bu_product",
|
isnotoption: false, //true:不是选项
|
code:"id",//是下拉选项时设置
|
label:"product_name",//是下拉选项时设置
|
filter: "",
|
orderby: "product_name"
|
},
|
],
|
md_bu_product_obj: {},
|
productobj_map: {},
|
|
tableFields: [
|
{isshow: "T", field: "date_to", name: "到期日期", width: "150", align: "left"},
|
{isshow: "T", field: "type_name", name: "备案类型", width: "100", align: "center"},
|
{isshow: "T", field: "record_name", name: "备案名称", width: "200", align: "left", isminwidth: true},
|
{isshow: "T", field: "record_no", name: "备案编号", width: "130", align: "center"},
|
{isshow: "T", field: "record_value", name: "备案内容", width: "90", align: "center"},
|
{isshow: "T", field: "bu_name", name: "BU", width: "100", align: "center"},
|
{isshow: "T", field: "product_name", name: "产品名称", width: "150", align: "left"},
|
|
],
|
formFields: [],
|
formData: {},
|
filterAttr: {
|
columnnumber: 3,
|
labelwidth: "100px",
|
labelposition: "right",//"left",//"right",
|
size: "medium",
|
border: "0px solid #c6c6c600"
|
},
|
filterfieldClick: {},
|
tablefieldClick: {},
|
formfieldClick: {},
|
|
tableFields_sku_metas: [
|
{
|
"field": "spec",
|
"align": "center",
|
"labelchinese": "规格",
|
"labelenglish": "spec",
|
"isfilter": true,
|
"filterfield": "md_prod_sku.spec",
|
"filteroperator": "like",
|
"width": 120
|
},
|
{
|
"field": "product_name",
|
"align": "left",
|
"labelchinese": "产品名称",
|
"labelenglish": "product_name",
|
"isfilter": true,
|
"filterfield": "md_prod_sku.product_name",
|
"filteroperator": "like",
|
"width": 230,
|
"isminwidth": true
|
},
|
{
|
"field": "product_id",
|
"labelchinese": "产品编码",
|
"width": 100
|
}
|
],
|
tableFields_sku: [],
|
filterFields_sku: [],
|
filterFieldsObj_sku: {},
|
tableFieldsObj_sku: {},
|
filterTxt_sku: "",
|
|
tableData_sku: [],
|
tableloading_sku: false,
|
pagesize_sku: 10,
|
pagenum_sku: 1,
|
total_sku: 0,
|
filterObj_sku: {},
|
|
company_id: "",
|
bu_id: "",
|
customer_id: "",
|
order_id: "",
|
},
|
created() {
|
this.popupParames = clone(Root.popupParames);
|
this.title = this.popupParames.title || this.popupParames.text
|
if (this.popupParames.filter) {
|
this.filterTxt = this.popupParames.filter
|
}
|
if (this.popupParames.dataname) {
|
this.dataname = this.popupParames.dataname;
|
}
|
|
if (this.popupParames.delta) {
|
this.company_id = clone(this.popupParames.delta.company_id);
|
this.bu_id = clone(this.popupParames.delta.bu_id);
|
this.customer_id = clone(this.popupParames.delta.customer_id);
|
this.order_id = clone(this.popupParames.delta.order_id);
|
|
}
|
if (this.popupParames.sceneCode) {
|
if (this.popupParames.sceneCode == "add") {//新增
|
this.isedit = true;
|
// 买赠优惠政策
|
var onsiteGift = {
|
name: "onsiteGift",
|
dataname: "agm_record_gift",
|
// url: "root/data/newEntity",
|
// paramsobj: {dataname: "md_org_data", type_code:"Distributor"},
|
isnotoption: true, //true:不是选项
|
// filter: " (customer_id is null or customer_id='"+this.customer_id+"')",
|
filter: "(category_code='Onsite' or (category_code='Coupon' and (order_id is null or order_id='" + this.order_id + "'))) and state_code='Open' and agm_record.bu_id='" + this.bu_id + "' and (customer_id is null or customer_id='"+this.customer_id+"')",
|
}
|
this.dataRequest.push(onsiteGift);
|
// 价格优惠政策
|
var onsitePrice = {
|
name: "onsitePrice",
|
dataname: "agm_record_price",
|
// url: "root/data/newEntity",
|
// paramsobj: {dataname: "md_org_data", type_code:"Distributor"},
|
isnotoption: true, //true:不是选项
|
// filter: " (org_id is null or org_id='"+this.customer_id+"')",
|
filter: "(type_code='Onsite' or (type_code='Coupon' and (order_id is null or order_id='" + this.order_id + "'))) and state_code='Open' and md_prod_price_detail.bu_id='" + this.bu_id + "' and (org_id is null or org_id='"+this.customer_id+"')",
|
}
|
this.dataRequest.push(onsitePrice);
|
}
|
}
|
},
|
|
mounted() {
|
var me = this;
|
var title_h = 0;
|
if (me.popupParames.totab){
|
title_h = 42;
|
}
|
me.dheight = document.documentElement.clientHeight - 50 - title_h;
|
//预加载数据
|
if (this.dataRequest && this.dataRequest.length) {
|
var result = {};
|
this.loadRequestData(this.dataRequest, result, function(data) {
|
me.dataRequestObj = data;
|
if (me.dataRequestObj.md_bu_product) {
|
var md_bu_product_array_ = clone(me.dataRequestObj.md_bu_product);
|
var md_bu_product_obj_ = {};
|
var productobj_map_ = {};
|
|
md_bu_product_array_.map(p=>{
|
if (!md_bu_product_obj_[p.bu_id]) {
|
md_bu_product_obj_[p.bu_id] = {
|
children: [],
|
}
|
}
|
var p_ = {
|
code: p.product_id,
|
value: p.product_name,
|
product_id: p.product_id,
|
}
|
productobj_map_[p.product_id] = p.product_name;
|
md_bu_product_obj_[p.bu_id].children.push(p_);
|
})
|
me.md_bu_product_obj = clone(md_bu_product_obj_)
|
me.productobj_map = clone(productobj_map_);
|
}
|
|
var tableData_ = [];
|
var tableData_obj_ = {};
|
if (me.dataRequestObj.onsiteGift) {
|
me.dataRequestObj.onsiteGift.map(onsite=>{
|
onsite.date_to = dateFormat(new Date(onsite.date_to), "yyyy-MM-dd");
|
tableData_obj_[onsite.id] = clone(onsite);
|
if (onsite.type_code == "gift") {
|
var type_code_ = clone(onsite.category_code)
|
var type_name_ = clone(onsite.category_name)
|
|
if (onsite.category_code == "Onsite") {
|
type_code_ = "OnsiteQty"
|
type_name_ = "即时买赠"
|
}
|
else if (onsite.category_code == "Coupon") {
|
type_code_ = "OnceQty"
|
type_name_ = "一次性买赠"
|
}
|
|
var row_ = {
|
bu_id: onsite.bu_id,
|
bu_name: onsite.bu_name,
|
product_id:onsite.gift_product_id,
|
product_name:onsite.gift_product_name,
|
sku_id:onsite.sku_id,
|
spec:onsite.spec,
|
type_code: type_code_,
|
type_name: type_name_,
|
record_name: onsite.record_name,
|
record_no: onsite.record_no,
|
record_value: onsite.emption_qty ? "买" + onsite.emption_qty + "赠" + onsite.gift_qty : "",
|
price: 0,
|
id: onsite.id,
|
date_to: onsite.date_to
|
}
|
tableData_.push(row_);
|
}
|
})
|
}
|
if (me.dataRequestObj.onsitePrice) {
|
me.dataRequestObj.onsitePrice.map(onsite=>{
|
onsite.date_to = dateFormat(new Date(onsite.date_to), "yyyy-MM-dd");
|
tableData_obj_[onsite.id] = clone(onsite);
|
if (onsite.type_code == "Onsite") {
|
var type_code_ = "OnsitePrice"
|
var type_name_ = "即时优惠价"
|
var row_ = {
|
bu_id: onsite.bu_id,
|
bu_name: onsite.bu_name,
|
product_id:onsite.product_id,
|
product_name:onsite.product_name,
|
sku_id:onsite.sku_id,
|
spec:onsite.spec,
|
type_code: type_code_, // ListPrice正常, OnsitePrice即时优惠价, OnsiteQty即时买赠, OncePrice一次性优惠价, OnceQty一次性买赠, RebateQty买赠池
|
type_name: type_name_,
|
record_name: onsite.record_name,
|
record_no: onsite.record_no,
|
record_value: "优惠价" + onsite.price,
|
price: onsite.price,
|
id: onsite.id,
|
date_to: onsite.date_to
|
}
|
tableData_.push(row_);
|
}
|
if (onsite.type_code == "Coupon") {
|
var type_code_ = "OncePrice"
|
var type_name_ = "一次性优惠价"
|
var row_ = {
|
bu_id: onsite.bu_id,
|
bu_name: onsite.bu_name,
|
product_id:onsite.product_id,
|
product_name:onsite.product_name,
|
sku_id:onsite.sku_id,
|
spec:onsite.spec,
|
type_code: type_code_, // ListPrice正常, OnsitePrice即时优惠价, OnsiteQty即时买赠, OncePrice一次性优惠价, OnceQty一次性买赠, RebateQty买赠池
|
type_name: type_name_,
|
record_name: onsite.record_name,
|
record_no: onsite.record_no,
|
record_value: "优惠价" + onsite.price,
|
price: onsite.price,
|
id: onsite.id,
|
date_to: onsite.date_to
|
}
|
tableData_.push(row_);
|
}
|
})
|
}
|
|
if (tableData_.length) {
|
me.tableData = clone(tableData_)
|
me.tableData_obj = clone(tableData_obj_)
|
|
me.tableDataAfter();
|
}
|
else {
|
//获取数据
|
me.initData();
|
}
|
|
me.getSKUTableMeta();
|
me.$nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
|
hideLoading();
|
});
|
})
|
}
|
|
},
|
|
methods:{
|
//关闭弹窗
|
closeDialog() {
|
this.docloseDialog(true);
|
},
|
|
//关闭前调回调
|
saveAfter() {
|
var me = this;
|
if(this.popupParames.callback) {
|
let obj = {
|
row: clone(this.selectedrow)
|
}
|
this.popupParames.callback(obj, function(notclosemessage) {
|
if (!notclosemessage) {
|
me.docloseDialog();
|
}
|
else {
|
Root.message({
|
type: 'warning',
|
message: notclosemessage
|
});
|
return;
|
}
|
});
|
}
|
else {
|
me.docloseDialog();
|
}
|
},
|
|
initData() {
|
var me = this;
|
//页面信息
|
var params = {
|
customer_id: this.customer_id, // "36645687653e46bab928a12135b6022d",
|
bu_id: this.bu_id, // "BU-SJ", //
|
filter: "",
|
//userId: this.userId
|
}
|
|
Server.call("root/policy/getOnsiteDiscounts", params, function(result) {
|
var tableData_ = [];
|
var tableData_obj_ = {};
|
if (result && result.onsitediscounts && result.onsitediscounts.lines) {
|
result.onsitediscounts.lines.map(onsite=>{
|
onsite.date_to = dateFormat(new Date(onsite.date_to), "yyyy-MM-dd");
|
tableData_obj_[onsite.id] = clone(onsite);
|
if (onsite.type_code == "gift") {
|
var type_code_ = clone(onsite.category_code)
|
var type_name_ = clone(onsite.category_name)
|
|
if (onsite.category_code == "Onsite") {
|
type_code_ = "OnsiteQty"
|
type_name_ = "即时买赠"
|
}
|
else if (onsite.category_code == "Coupon") {
|
type_code_ = "OnceQty"
|
type_name_ = "一次性买赠"
|
}
|
|
var row_ = {
|
bu_id: onsite.bu_id,
|
bu_name: onsite.bu_name,
|
product_id:onsite.gift_product_id,
|
product_name:onsite.gift_product_name,
|
sku_id:onsite.sku_id,
|
spec:onsite.spec,
|
type_code: type_code_, // ListPrice正常, OnsitePrice即时优惠价, OnsiteQty即时买赠, OncePrice一次性优惠价, OnceQty一次性买赠, RebateQty买赠池
|
type_name: type_name_,
|
record_name: onsite.record_name,
|
record_no: onsite.record_no,
|
record_value: onsite.emption_qty ? "买" + onsite.emption_qty + "赠" + onsite.gift_qty : "",
|
price: 0,
|
id: onsite.id,
|
date_to: onsite.date_to
|
}
|
tableData_.push(row_);
|
}
|
if (onsite.type_code == "Onsite") {
|
var type_code_ = "OnsitePrice"
|
var type_name_ = "即时优惠价"
|
var row_ = {
|
bu_id: onsite.bu_id,
|
bu_name: onsite.bu_name,
|
product_id:onsite.product_id,
|
product_name:onsite.product_name,
|
sku_id:onsite.sku_id,
|
spec:onsite.spec,
|
type_code: type_code_, // ListPrice正常, OnsitePrice即时优惠价, OnsiteQty即时买赠, OncePrice一次性优惠价, OnceQty一次性买赠, RebateQty买赠池
|
type_name: type_name_,
|
record_name: onsite.record_name,
|
record_no: onsite.record_no,
|
record_value: "优惠价" + onsite.price,
|
price: onsite.price,
|
id: onsite.id,
|
date_to: onsite.date_to
|
}
|
tableData_.push(row_);
|
}
|
if (onsite.type_code == "Coupon") {
|
var type_code_ = "OncePrice"
|
var type_name_ = "一次性优惠价"
|
var row_ = {
|
bu_id: onsite.bu_id,
|
bu_name: onsite.bu_name,
|
product_id:onsite.product_id,
|
product_name:onsite.product_name,
|
sku_id:onsite.sku_id,
|
spec:onsite.spec,
|
type_code: type_code_, // ListPrice正常, OnsitePrice即时优惠价, OnsiteQty即时买赠, OncePrice一次性优惠价, OnceQty一次性买赠, RebateQty买赠池
|
type_name: type_name_,
|
record_name: onsite.record_name,
|
record_no: onsite.record_no,
|
record_value: "优惠价" + onsite.price,
|
price: onsite.price,
|
id: onsite.id,
|
date_to: onsite.date_to
|
}
|
tableData_.push(row_);
|
}
|
})
|
}
|
me.tableData = clone(tableData_)
|
me.tableData_obj = clone(tableData_obj_)
|
|
me.tableDataAfter();
|
});
|
|
// this.onQuery(function(result, callback) {//查询后的回调,用于获取字段的
|
// if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) {
|
// var metas = clone(result.meta[me.dataname].fields);
|
// var filterFields_ = [];
|
// var tableFields_ = [];
|
// var formFields_ = [];
|
|
// metas.map(f=>{
|
// f.isshow = "T";
|
// if (f.field == "company_name" || f.field == "bu_name") {
|
// f.inputtype = "span";
|
// }
|
// if (f.field == "spec") {
|
// f.inputtype = "select"
|
// f.props = {label: "value", value: "code", multiple: true};
|
// formFields_.push(clone(f))
|
// }
|
// if (f.isfilter) {
|
// filterFields_.push(clone(f));
|
// }
|
// else {
|
// var filter_f = clone(f);
|
// filter_f.isshow = "F";
|
// filterFields_.push(filter_f);
|
// }
|
|
// tableFields_.push(clone(f));
|
// })
|
// if (!me.filterFields || (me.filterFields && me.filterFields.length == 0)) {
|
// me.filterFields = clone(filterFields_);
|
// me.tableFields = clone(tableFields_);
|
// me.formFields = clone(formFields_)
|
|
// //字段数组转字段obj,目的为了筛选时获取字段属性
|
// me.fieldsToFieldsObj();
|
|
// //设置字段事件
|
// me.tableFieldClick();
|
// }
|
|
// }
|
|
// if (callback) {
|
// callback();
|
// }
|
// });
|
},
|
|
tableFieldClick() {
|
var me = this;
|
//筛选字段事件设置
|
this.filterfieldClick = {
|
};
|
//表格字段事件设置
|
this.tablefieldClick = {
|
};
|
},
|
|
// onRowDblClick() {
|
// if (this.isedit) {
|
// this.saveAfter();
|
// }
|
// },
|
onRowClick() {
|
this.filterTxt_sku = "";
|
if (this.selectedrow.sku_id) { // 指定sku,则只能选该SKU
|
this.filterTxt_sku = " md_prod_sku.id='" + this.selectedrow.sku_id + "'";
|
}
|
else if (this.selectedrow.product_id) { // 没有指定sku,但指定了产品,则根据产品查询SKU
|
this.filterTxt_sku = " md_prod_sku.product_id='" + this.selectedrow.product_id + "'";
|
}
|
else if (this.selectedrow.bu_id) { // 没有指定sku,也没有指定了产品,但指定了BU,则根据BU查询SKU
|
if (this.md_bu_product_obj[this.selectedrow.bu_id] && this.md_bu_product_obj[this.selectedrow.bu_id].children && this.md_bu_product_obj[this.selectedrow.bu_id].children.length) {
|
var filterTxt_pids = "";
|
this.md_bu_product_obj[this.selectedrow.bu_id].children.map(p=>{
|
if (!filterTxt_pids) {
|
filterTxt_pids = p.product_id
|
}
|
else {
|
filterTxt_pids += "','" + p.product_id;
|
}
|
})
|
filterTxt_pids = " md_prod_sku.product_id in ('" + filterTxt_pids + "')"
|
this.filterTxt_sku = filterTxt_pids;
|
}
|
else {
|
this.filterTxt_sku = "1<>1";
|
}
|
}
|
this.onQuery_sku()
|
},
|
|
// sku
|
getSKUTableMeta() {
|
var me = this;
|
var param_ = {
|
dataname: this.sku_dataname,
|
attachMeta: true,
|
filter: "1<>1"
|
}
|
Server.call("root/data/getEntitySet", param_, function(result) {
|
if (result.meta && result.meta[me.sku_dataname] && result.meta[me.sku_dataname].fields) {
|
// var metas = clone(result.meta[me.sku_dataname].fields);
|
var metas = clone(me.tableFields_sku_metas)
|
var filterFields_ = [];
|
var tableFields_ = [];
|
|
metas.map(f=>{
|
f.isshow = "T";
|
if(f.field == 'bu_name' ||f.field == 'unit' || f.field == 'create_time' || f.field == 'update_time') {
|
f.isshow = false
|
}
|
|
if (f.isfilter) {
|
filterFields_.push(clone(f));
|
}
|
else {
|
var filter_f = clone(f);
|
filter_f.isshow = "F";
|
filterFields_.push(filter_f);
|
}
|
tableFields_.push(clone(f));
|
})
|
me.filterFields_sku = clone(filterFields_);
|
me.tableFields_sku = clone(tableFields_);
|
|
me.fieldsToFieldsObj_sku()
|
}
|
})
|
},
|
fieldsToFieldsObj_sku() {
|
//查询的字段转换
|
var filterFieldsObj_ = {};
|
var tableFieldsObj_ = {};
|
this.filterFieldsObj_sku = {};
|
this.tableFieldsObj_sku = {};
|
|
this.filterFields_sku.map(f=>{
|
if (f.inputtype == "date") {
|
f.type = "daterange";
|
f.filteroperator = "inScopeInclude";
|
}
|
if (f.inputtypefilter) {
|
f.type = f.inputtypefilter;
|
}
|
filterFieldsObj_[f.field] = f;
|
});
|
|
this.filterFieldsObj_sku = clone(filterFieldsObj_);
|
|
if (this.tableFields_sku && this.tableFields_sku.length) {
|
var tableFields_ = TreeToArray(this.tableFields_sku, "field");
|
tableFields_.map(f=>{
|
tableFieldsObj_[f.field] = f;
|
});
|
|
this.tableFieldsObj_sku = clone(tableFieldsObj_);
|
}
|
},
|
getData_sku(page) {
|
this.pagesize_sku = page.pagesize;
|
this.pagenum_sku = page.pagenum;
|
if (page.filtersobj) { // && Object.keys(page.filtersobj).length
|
this.filterObj_sku = page.filtersobj;
|
}
|
this.doQuery_sku();
|
},
|
|
//查询
|
onQuery_sku: function(callback) {
|
//查询
|
this.$refs["table2"].emptyShoppingcart();
|
this.pagenum_sku = 1;
|
this.doQuery_sku(callback);
|
},
|
|
doQuery_sku: function(callback) {
|
let me = this;
|
let filter_ = "1=1";
|
for(var k in this.filterObj_sku) {
|
let k_val = this.filterObj_sku[k];
|
/* let fieldObj_ = this.filterFieldsObj[k];
|
|
let type_ = fieldObj_.type;
|
let field_ = fieldObj_.field; */
|
|
if (k_val && typeof(k_val) == "string") {
|
//去除两端的空格
|
this.filterObj_sku[k] = k_val = k_val.replace(/(^\s*)|(\s*$)/g, "");
|
|
//去除两端的Tab
|
this.filterObj_sku[k] = k_val = k_val.replace(/(^\t*)|(\t*$)/g, "");
|
}
|
|
let fieldObj_ = this.filterFieldsObj_sku[k];
|
|
if (!fieldObj_) {
|
continue
|
}
|
if (!fieldObj_) {
|
fieldObj_ = {
|
field: k
|
}
|
}
|
|
let type_ = fieldObj_.type;
|
let valfield_ = fieldObj_.valfield;
|
if (type_ == "popup" && valfield_) {
|
k_val = this.filterObj_sku[valfield_];
|
}
|
|
let field_ = fieldObj_.field;
|
|
let filteroperator_ = "equal";
|
|
let isnull = false;
|
let ornullval_ = fieldObj_.ornullval;
|
if (ornullval_) {
|
var nullvals_ = ornullval_.split(";");
|
nullvals_.map(v=>{
|
if (v == k_val) {
|
isnull = true;
|
}
|
});
|
}
|
|
if (fieldObj_.filterfield) {
|
field_ = fieldObj_.filterfield
|
}
|
if (fieldObj_.filteroperator) {
|
filteroperator_ = fieldObj_.filteroperator
|
}
|
|
//传条件数据有前端拼接
|
if (k_val && k_val != "" && k_val.length) { filter_ = getFilterByFilterType(filter_, type_, field_, k_val, filteroperator_, isnull, fieldObj_); }
|
}
|
|
if (this.filterTxt_sku) {
|
filter_ += " and " + this.filterTxt_sku;
|
}
|
|
var attachmeta_ = false;
|
if (!this.tableFields_sku || (this.tableFields_sku && this.tableFields_sku.length == 0)) {
|
attachmeta_ = true;
|
}
|
|
let param_ = {
|
dataname: this.sku_dataname,
|
filter: filter_,
|
orderby: "spec",
|
page: {
|
pageno: this.pagenum_sku,
|
pagesize: this.pagesize_sku
|
},
|
attachMeta: attachmeta_,
|
|
}
|
|
// if (Object.keys(this.paramObjBydefault).length) {
|
// for(var k in this.paramObjBydefault) {
|
// let k_val = this.paramObjBydefault[k];
|
// param_[k] = k_val;
|
// }
|
// }
|
me.tableData_sku = [];
|
|
if (!this.filterTxt_sku) {
|
me.total_sku = 0;
|
return
|
}
|
me.tableloading_sku = true;
|
|
Server.call(me.dataurl, param_, function(result) {
|
me.tableloading_sku = false;
|
|
if (result && result.data && result.data.entityset) {
|
var data_ = result.data.entityset;
|
me.tableData_sku = data_;
|
me.total_sku = result.data.page ? result.data.page.recordcount : 0;
|
}
|
else {
|
me.total_sku = 0;
|
}
|
|
if (callback) {
|
callback(result);
|
}
|
|
}, function(){
|
me.tableloading_sku = false;
|
});
|
},
|
|
saveListAfter() {
|
let me = this;
|
//获取购物车的数据
|
var skus = this.$refs["table2"].getShoppingcart();
|
var rows = [];
|
/* var
|
product_name: popupobj.row.product_name,
|
product_code: popupobj.row.product_code,
|
product_id: popupobj.row.product_id,
|
sku_id: popupobj.row.sku_id,
|
|
spec: popupobj.row.spec,
|
unit: popupobj.row.unit,
|
type_code: "gift",
|
type_name: "买赠",
|
// rebate_id: popupobj.row.id, // 买赠的id
|
// rebate_code: popupobj.row.code, //买赠的code,
|
record_id:popupobj.row.id,
|
record_no: popupobj.row.code, // 使用现实买赠备案编码字段接收
|
qty_available:popupobj.row.qty_available, //接收可用数量
|
qty_net:popupobj.row.qty_net,
|
|
*/
|
if (skus && skus.length) {
|
this.selectedrow
|
var r_row = clone(this.selectedrow);
|
skus.map(sku=>{
|
var row = {}
|
row.product_id = sku.product_id
|
row.product_name = sku.product_name
|
row.sku_id = sku.id
|
row.spec = sku.spec
|
row.unit = sku.unit
|
row.price = r_row.price
|
row.record_id = r_row.id
|
row.record_no = r_row.record_no
|
row.record_name = r_row.record_name
|
row.price = r_row.price
|
row.type_code = r_row.type_code
|
row.type_name = r_row.type_name
|
|
rows.push(row);
|
})
|
}
|
else {
|
Root.message({
|
type: 'errer',
|
message: '请先选取买赠明细'
|
});
|
return
|
}
|
if (rows && rows.length) {
|
let obj = {
|
rowlist: clone(rows)
|
}
|
this.popupParames.notCloseCallback(obj, function(notclosemessage) {
|
if (!notclosemessage) {
|
me.docloseDialog();
|
}
|
else {
|
Root.message({
|
type: 'warning',
|
message: notclosemessage
|
});
|
return;
|
}
|
});
|
}
|
|
|
},
|
|
}
|
});
|
};
|
|
loadJsCss(function () {
|
initVue();
|
});
|
</script>
|
<style>
|
/* 在vue.js中 v-cloak 这个指令是防止页面加载时出现 vuejs 的变量名而设计的 */
|
[v-cloak] {
|
display: none !important;
|
}
|
|
.h_dialog__body .h_table .h_h_table .h_table_tool .h_basicfilter {
|
width: 80%;
|
}
|
|
.el-dialog__footer {
|
position: absolute;
|
bottom: 0px;
|
left: 10px;
|
right: 10px;
|
}
|
</style>
|
|
</head>
|
|
<body style="margin: 0px;">
|
<div v-cloak id="vbody">
|
<div id="page_root">
|
<div ref="popup_body" style="padding: 0 20px;">
|
<div class="h_dialog__body">
|
<el-row :gutter="10">
|
<el-col :span="14">
|
<h-table
|
v-if="isRefresh"
|
ref="table1"
|
:table-fields="tableFields"
|
:table-data="tableData"
|
:pagesize="pagesize"
|
:pagenum="pagenum"
|
:total="total"
|
:table-height="tableHeight - 32"
|
:table-field-click="tablefieldClick"
|
:is-highlight-row="isedit"
|
:is-show-index="false"
|
:filtersobj="filterObj"
|
:isdraggableorder="false"
|
:isfilterfield="false"
|
:is-pagination="false"
|
:isshowtool="false"
|
v-on:get-data="getData"
|
v-on:row-click="rowClick"
|
>
|
</h-table>
|
<!--
|
v-on:row-dblclick="rowDblclick"
|
-->
|
|
<div>
|
|
</div>
|
</el-col>
|
<el-col :span="10">
|
<h-table
|
v-if="tableFields_sku.length"
|
ref="table2"
|
:table-fields="tableFields_sku"
|
:table-data="tableData_sku"
|
:pagesize="pagesize_sku"
|
:pagenum="pagenum_sku"
|
:total="total_sku"
|
:table-height="tableHeight - 64"
|
:filtersobj="filterObj_sku"
|
:isdraggableorder="false"
|
:isfilterfield="false"
|
:is-selection="true"
|
:is-highlight-row="true"
|
|
v-on:get-data="getData_sku"
|
>
|
</h-table>
|
</el-col>
|
</el-row>
|
</div>
|
<!-- 底部工具栏 -->
|
<div class="el-dialog__footer">
|
<el-button size="small" type="default" @click="closeDialog">取 消</el-button>
|
<el-button size="small" v-if="isedit" type="primary" @click="saveListAfter">确 定</el-button>
|
</div>
|
</div>
|
</div>
|
</div>
|
|
<div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;">
|
<div class="spinner">
|
<div class="cube1"></div>
|
<div class="cube2"></div>
|
</div>
|
</div>
|
|
</body>
|
</html>
|