|
@@ -0,0 +1,923 @@
|
|
|
+$(function () {
|
|
|
+ $("#jqGrid").jqGrid({
|
|
|
+ url: '../goods/list',
|
|
|
+ datatype: "json",
|
|
|
+ colModel: [
|
|
|
+ // {label: 'ID', name: 'id', index: 'id', width: 60, key: true},
|
|
|
+ {label: '商户名称', name: 'merchName', index: 'merchName', width: 100, align: 'center'},
|
|
|
+ {label: '第三方商户编号', name: 'thirdPartyMerchCode', index: 'thirdPartyMerchCode', width: 160, align: 'center'},
|
|
|
+ {label: '商品编码', name: 'goodsSn', index: 'goods_Sn', width: 180, align: 'center'},
|
|
|
+ {label: 'SKU', name: 'sku', index: 'sku', width: 180, align: 'center'},
|
|
|
+ {label: 'PLU', name: 'plu', index: 'plu', width: 180, align: 'center'},
|
|
|
+ {label: '英文名称', name: 'englishName', index: 'englishName', width: 180, align: 'center'},
|
|
|
+ {label: '产品条码', name: 'prodBarcode', index: 'prod_barcode', width: 160, align: 'center'},
|
|
|
+ // {label: '商品类型', name: 'categoryName', index: 'category_id', width: 40, align: 'center'},
|
|
|
+ {label: '名称', name: 'name', index: 'name', width: 500, align: 'left'},
|
|
|
+ {
|
|
|
+ label: '货品业务类型', name: 'goodsBizType', index: 'goods_biz_type', width: 100, align: 'center',
|
|
|
+ formatter: function (value) {
|
|
|
+ if (value == '00') {
|
|
|
+ return '保税备货';
|
|
|
+ } else if (value == '02') {
|
|
|
+ return '保税展示补货';
|
|
|
+ } else if (value == '10') {
|
|
|
+ return '保税展示跨境';
|
|
|
+ }
|
|
|
+ return '普通货物';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {label: '库存是否共享', name: 'isStockShare', index: 'isStockShare', width: 100, align: 'center',
|
|
|
+ formatter: function (value) {
|
|
|
+ if (value == '0') {
|
|
|
+ return '否';
|
|
|
+ } else if (value == '1') {
|
|
|
+ return '是';
|
|
|
+ }
|
|
|
+ return '-';
|
|
|
+ }},
|
|
|
+ {label: '商品库存', name: 'goodsNumber', index: 'goodsNumber', width: 100, align: 'right'},
|
|
|
+ // {label: '零售价格', name: 'retailPrice', index: 'retail_price', width: 80, align: 'center'},
|
|
|
+ // {label: '市场价', name: 'marketPrice', index: 'market_price', width: 80, align: 'center'},
|
|
|
+ {
|
|
|
+ label: '上架', name: 'isOnSale', index: 'is_on_sale', width: 50, align: 'center',
|
|
|
+ formatter: function (value) {
|
|
|
+ return transIsNot(value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '热销', name: 'isHot', index: 'is_hot', width: 50, align: 'center',formatter: function (value) {
|
|
|
+ return transIsNot(value);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /*{
|
|
|
+ label: '活动', name: 'goodsType', index: 'goodsType', width: 80,
|
|
|
+ formatter: function (value) {
|
|
|
+ if (value == 2) {
|
|
|
+ return '<span class="label label-warning">团购</span>';
|
|
|
+ } else {
|
|
|
+ return '<span class="label label-success">无活动</span>';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },*/
|
|
|
+ {
|
|
|
+ label: '录入日期', name: 'addTime', index: 'add_time', width: 200, align: 'center',
|
|
|
+ formatter: function (value) {
|
|
|
+ return transDate(value, 'yyyy-MM-dd hh:mm:ss');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ viewrecords: true,
|
|
|
+ height: 475,
|
|
|
+ rowNum: 10,
|
|
|
+ rowList: [10, 30, 50],
|
|
|
+ rownumbers: true,
|
|
|
+ rownumWidth: 25,
|
|
|
+ autowidth: true,
|
|
|
+ shrinkToFit: false,
|
|
|
+ autoScroll: true, //开启水平滚动条
|
|
|
+ width: 1600,
|
|
|
+ multiselect: true,
|
|
|
+ pager: "#jqGridPager",
|
|
|
+ jsonReader: {
|
|
|
+ root: "page.list",
|
|
|
+ page: "page.currPage",
|
|
|
+ total: "page.totalPage",
|
|
|
+ records: "page.totalCount"
|
|
|
+ },
|
|
|
+ prmNames: {
|
|
|
+ page: "page",
|
|
|
+ rows: "limit",
|
|
|
+ order: "order"
|
|
|
+ },
|
|
|
+ gridComplete: function () {
|
|
|
+ $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#goodsDesc').editable({
|
|
|
+ inlineMode: false,
|
|
|
+ alwaysBlank: true,
|
|
|
+ height: '500px', //高度
|
|
|
+ minHeight: '200px',
|
|
|
+ language: "zh_cn",
|
|
|
+ spellcheck: false,
|
|
|
+ plainPaste: true,
|
|
|
+ enableScript: false,
|
|
|
+ imageButtons: ["floatImageLeft", "floatImageNone", "floatImageRight", "linkImage", "replaceImage", "removeImage"],
|
|
|
+ allowedImageTypes: ["jpeg", "jpg", "png", "gif"],
|
|
|
+ imageUploadURL: '../sys/oss/upload',
|
|
|
+ imageUploadParams: {id: "edit"},
|
|
|
+ imagesLoadURL: '../sys/oss/queryAll'
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ $("#branchJqGrid").jqGrid({
|
|
|
+ url: '../productstorerela/list',
|
|
|
+ datatype: "json",
|
|
|
+ colModel: [
|
|
|
+ {label: '所属门店', name: 'storeName', index: 'storeName', width: 180, align: 'center'},
|
|
|
+ {label: '商品类型', name: 'categoryName', index: 'categoryName', width: 120, align: 'center'},
|
|
|
+ {label: '批次编号', name: 'batchSn', index: 'batchSn', width: 140, align: 'center'},
|
|
|
+ {label: '批次到期日期', name: 'batchExpireDate', index: 'batchExpireDate', width: 160, align: 'center',formatter: function (value) {
|
|
|
+ return transDate(value,'yyyy-MM-dd hh:mm:ss');
|
|
|
+ }},
|
|
|
+ {label: '门店库存', name: 'stockNum', index: 'stockNum', width: 80, align: 'center'},
|
|
|
+ {label: '园区库存', name: 'parkStock', index: 'parkStock', width: 80, align: 'center'},
|
|
|
+ {label: '零售价格', name: 'retailPrice', index: 'retailPrice', width: 80, align: 'right'},
|
|
|
+ {label: '市场价', name: 'marketPrice', index: 'marketPrice', width: 80, align: 'right'},
|
|
|
+ {label: '底线价格', name: 'bottomLinePrice', index: 'bottomLinePrice', width: 80, align: 'right',formatter: function (value) {
|
|
|
+ if (value){
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ return '-';
|
|
|
+ }},
|
|
|
+ {
|
|
|
+ label: '销售量',
|
|
|
+ name: 'sellVolume',
|
|
|
+ index: 'a.sell_volume',
|
|
|
+ width: 80,
|
|
|
+ sortable: true, align: 'center',
|
|
|
+ onSortCol: function (index, colindex, sortorder) {
|
|
|
+ //列排序事件
|
|
|
+ jQuery("#jqGrid").jqGrid('setGridParam', {page: $('#XtoPage').val()});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ viewrecords: true,
|
|
|
+ height: 475,
|
|
|
+ rowNum: 10,
|
|
|
+ rowList: [10, 30, 50],
|
|
|
+ rownumbers: true,
|
|
|
+ rownumWidth: 25,
|
|
|
+ autowidth: true,
|
|
|
+ shrinkToFit: false,
|
|
|
+ autoScroll: true, //开启水平滚动条
|
|
|
+ width: 1600,
|
|
|
+ pager: "#branchJqGridPager",
|
|
|
+ jsonReader: {
|
|
|
+ root: "page.list",
|
|
|
+ page: "page.currPage",
|
|
|
+ total: "page.totalPage",
|
|
|
+ records: "page.totalCount"
|
|
|
+ },
|
|
|
+ prmNames: {
|
|
|
+ page: "page",
|
|
|
+ rows: "limit",
|
|
|
+ order: "order"
|
|
|
+ },
|
|
|
+ gridComplete: function () {
|
|
|
+ $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ $("#barcodeJqGrid").jqGrid({
|
|
|
+ url: '../goods/list',
|
|
|
+ datatype: "json",
|
|
|
+ colModel: [
|
|
|
+ // {label: 'ID', name: 'id', index: 'id', width: 60, key: true},
|
|
|
+ {label: '商户名称', name: 'merchName', index: 'merchName', width: 100, align: 'center'},
|
|
|
+ {label: '商品编码', name: 'goodsSn', index: 'goods_Sn', width: 180, align: 'center'},
|
|
|
+ {label: 'SKU', name: 'sku', index: 'sku', width: 180, align: 'center'},
|
|
|
+ {label: 'PLU', name: 'plu', index: 'plu', width: 180, align: 'center'},
|
|
|
+ {label: '英文名称', name: 'englishName', index: 'englishName', width: 180, align: 'center'},
|
|
|
+ {label: '产品条码', name: 'prodBarcode', index: 'prod_barcode', width: 160, align: 'center'}
|
|
|
+ ],
|
|
|
+ viewrecords: true,
|
|
|
+ height: 475,
|
|
|
+ rowNum: 10,
|
|
|
+ rowList: [10, 30, 50],
|
|
|
+ rownumbers: true,
|
|
|
+ rownumWidth: 25,
|
|
|
+ autowidth: true,
|
|
|
+ shrinkToFit: false,
|
|
|
+ autoScroll: true, //开启水平滚动条
|
|
|
+ width: 1600,
|
|
|
+ multiselect: true,
|
|
|
+ pager: "#barcodeJqGridPager",
|
|
|
+ jsonReader: {
|
|
|
+ root: "page.list",
|
|
|
+ page: "page.currPage",
|
|
|
+ total: "page.totalPage",
|
|
|
+ records: "page.totalCount"
|
|
|
+ },
|
|
|
+ prmNames: {
|
|
|
+ page: "page",
|
|
|
+ rows: "limit",
|
|
|
+ order: "order"
|
|
|
+ },
|
|
|
+ gridComplete: function () {
|
|
|
+ $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ $("#salesJqGrid").jqGrid({
|
|
|
+ url: '../order/offilineOrderList',
|
|
|
+ datatype: "json",
|
|
|
+ colModel: [
|
|
|
+ {label: '所属门店', name: 'storeName', index: 'storeName',align: 'center', width: 180},
|
|
|
+ {label: '订单号', name: 'orderSn', index: 'order_sn', align: 'center',width: 180},
|
|
|
+ {label: '会员', name: 'consignee', index: 'consignee',align: 'center', width: 80},
|
|
|
+ {label: '商户订单号', name: 'merchOrderSn', index: 'merchOrderSn', align: 'center',width: 150},
|
|
|
+ {
|
|
|
+ label: '订单状态', name: 'orderStatus', index: 'order_status', align: 'center',width: 120,
|
|
|
+ formatter: function (value) {
|
|
|
+ if (value == '0') {
|
|
|
+ return '订单创建成功等待付款';
|
|
|
+ } else if (value == '100') {
|
|
|
+ return '订单付款中';
|
|
|
+ } else if (value == '101') {
|
|
|
+ return '订单已取消';
|
|
|
+ } else if (value == '102') {
|
|
|
+ return '订单已删除';
|
|
|
+ } else if (value == '201') {
|
|
|
+ return '订单已付款';
|
|
|
+ } else if (value == '300') {
|
|
|
+ return '订单已发货';
|
|
|
+ } else if (value == '301') {
|
|
|
+ return '用户确认收货';
|
|
|
+ } else if (value == '401') {
|
|
|
+ return '没有发货,退款';
|
|
|
+ } else if (value == '402') {
|
|
|
+ return '已收货,退款退货';
|
|
|
+ }
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '订付人核验', name: 'buyerPayCheck', index: 'buyer_pay_check', align: 'center',width: 80,
|
|
|
+ formatter: function (value) {//订购人支付人校验,0:未知,1:一致,2:不一致,3:校验异常
|
|
|
+ if (value == '0') {
|
|
|
+ return '未知';
|
|
|
+ } else if (value == '1') {
|
|
|
+ return '一致';
|
|
|
+ } else if (value == '2') {
|
|
|
+ return '不一致';
|
|
|
+ }
|
|
|
+ return "-";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '付款状态', name: 'payStatus', index: 'pay_status', align: 'center',width: 80,
|
|
|
+ formatter: function (value) {
|
|
|
+ if (value == '0') {
|
|
|
+ return '未付款';
|
|
|
+ } else if (value == '1') {
|
|
|
+ return '付款中';
|
|
|
+ } else if (value == '2') {
|
|
|
+ return '已付款';
|
|
|
+ } else if (value == '3') {
|
|
|
+ return '退款中';
|
|
|
+ } else if (value == '4') {
|
|
|
+ return '退款';
|
|
|
+ }
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {label: '实际支付', name: 'actualPrice', index: 'actual_price', align: 'right',width: 80},
|
|
|
+ {label: '订单总价', name: 'orderPrice', index: 'order_price', align: 'right',width: 80},
|
|
|
+ {
|
|
|
+ label: '下单时间', name: 'addTime', index: 'add_time',align: 'center', width: 160,
|
|
|
+ formatter: function (value) {
|
|
|
+ return transDate(value, 'yyyy-MM-dd hh:mm:ss');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ viewrecords: true,
|
|
|
+ height: 550,
|
|
|
+ rowNum: 10,
|
|
|
+ rowList: [10, 30, 50],
|
|
|
+ rownumbers: true,
|
|
|
+ rownumWidth: 25,
|
|
|
+ autowidth: true,
|
|
|
+ shrinkToFit: false,
|
|
|
+ autoScroll: true, //开启水平滚动条
|
|
|
+ width: 1500,
|
|
|
+ pager: "#salesJqGridPager",
|
|
|
+ jsonReader: {
|
|
|
+ root: "page.list",
|
|
|
+ page: "page.currPage",
|
|
|
+ total: "page.totalPage",
|
|
|
+ records: "page.totalCount"
|
|
|
+ },
|
|
|
+ prmNames: {
|
|
|
+ page: "page",
|
|
|
+ rows: "limit",
|
|
|
+ order: "order"
|
|
|
+ },
|
|
|
+ gridComplete: function () {
|
|
|
+ $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
+var ztree;
|
|
|
+
|
|
|
+var setting = {
|
|
|
+ data: {
|
|
|
+ simpleData: {
|
|
|
+ enable: true,
|
|
|
+ idKey: "id",
|
|
|
+ pIdKey: "parentId",
|
|
|
+ rootPId: -1
|
|
|
+ },
|
|
|
+ key: {
|
|
|
+ url: "nourl"
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+var vm = new Vue({
|
|
|
+ el: '#rrapp',
|
|
|
+ data: {
|
|
|
+ showList: true,
|
|
|
+ fileList: true,
|
|
|
+ title: null,
|
|
|
+ uploadList: [],
|
|
|
+ imgName: '',
|
|
|
+ visible: false,
|
|
|
+ stores: [],
|
|
|
+ goods: {primaryPicUrl: '', listPicUrl: '',videoUrl:'', categoryId: '', isOnSale: 1, isAppExclusive: 0, isLimited: 0, isHot: 0, categoryName: '', retailPrice: '', marketPrice: '', goodsRate: '', sortOrder: '',goodsNumber: '' },
|
|
|
+ ruleValidate: {
|
|
|
+ },
|
|
|
+ q: {name: '', goodsSn: '', prodBarcode: '',goodsBizType:'', merchSn: '',thirdPartyMerchCode:''},
|
|
|
+ attributes: [],
|
|
|
+ attributeEntityList: [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}],
|
|
|
+ productEntityList: [{'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0}],
|
|
|
+ queryMerch: [],
|
|
|
+ macros: [],//商品单位
|
|
|
+ specifications: [],
|
|
|
+ showInput: true,
|
|
|
+ cusUnitCodeList: [],
|
|
|
+ cusNationCodeList: [],
|
|
|
+ merchList: [],
|
|
|
+ suppliers: [],
|
|
|
+ thirdMerchantBizList: [],
|
|
|
+ thirdMerchantBizViewList: [],
|
|
|
+ isStockShare: false,
|
|
|
+ goodsBizType: '',
|
|
|
+ isOperator: '',
|
|
|
+ share: ''
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ delSpeRow: function (index) {
|
|
|
+ //最后一行时禁止删除
|
|
|
+ if (vm.productEntityList.length == 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ vm.productEntityList[index].isDelete = 1;
|
|
|
+ },
|
|
|
+ addSpeRow: function () {
|
|
|
+ let goodsId = '';
|
|
|
+ if (vm.goods) {
|
|
|
+ goodsId = vm.goods.id;
|
|
|
+ }
|
|
|
+ vm.productEntityList.push({'id': '', 'goodsId': '', 'goodsSpecificationIds': '', 'goodsSpecificationNameValue': '', 'goodsSn': '', 'goodsNumber': '', 'isDelete': 0, 'goodsDefault': 0});
|
|
|
+ },
|
|
|
+ reloadSearch: function () {
|
|
|
+ vm.q = {
|
|
|
+ name: '',
|
|
|
+ goodsSn: '',
|
|
|
+ prodBarcode: '',
|
|
|
+ goodsBizType: '',
|
|
|
+ merchSn: '',
|
|
|
+ thirdPartyMerchCode:''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ query: function () {
|
|
|
+ vm.reload(1);
|
|
|
+ },
|
|
|
+ add: function () {
|
|
|
+ vm.showList = false;
|
|
|
+ vm.isOperator='add';
|
|
|
+ vm.title = "新增";
|
|
|
+ vm.uploadList = [];
|
|
|
+ vm.goods = {primaryPicUrl: '', listPicUrl: '',videoUrl:'', categoryId: '', isOnSale: 1, isAppExclusive: 0, isLimited: 0,
|
|
|
+ isHot: 0, categoryName: '', retailPrice: '', marketPrice: '', goodsRate: '', sortOrder: '',goodsNumber: '' };
|
|
|
+ $('#goodsDesc').editable('setHTML', '');
|
|
|
+ vm.getCategory();
|
|
|
+ vm.macros = [];
|
|
|
+ vm.brands = [];
|
|
|
+ // vm.freights = [];
|
|
|
+ vm.cusUnitCodeList = [];
|
|
|
+ vm.cusNationCodeList = [];
|
|
|
+ // vm.attributeEntityList = [{'id': '', 'goodsId': '', 'attributeId': '', 'value': '', 'isDelete': 0}];
|
|
|
+ vm.getMacro();
|
|
|
+ vm.getCusUnitCodeList();
|
|
|
+ vm.getCusNationCode();
|
|
|
+ vm.getMerchList();
|
|
|
+ vm.showInput = true;
|
|
|
+ },
|
|
|
+ update: function (event) {
|
|
|
+ var id = getSelectedRow();
|
|
|
+ if (id == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ vm.isOperator='update';
|
|
|
+ vm.showList = false;
|
|
|
+ vm.title = "修改";
|
|
|
+ vm.uploadList = [];
|
|
|
+ // vm.goods = {primaryPicUrl: '', listPicUrl: '',videoUrl:'', categoryId: '', isOnSale: 1, isAppExclusive: 0, isLimited: 0,
|
|
|
+ // isHot: 0, categoryName: '', retailPrice: '', marketPrice: '', goodsRate: '', sortOrder: '',goodsNumber: '' };
|
|
|
+ vm.getInfo(id);/*
|
|
|
+ var opt = {};
|
|
|
+ opt.value = vm.goods.categoryId;
|
|
|
+ opt.flag = 1;
|
|
|
+ vm.getAttributes(opt);*/
|
|
|
+
|
|
|
+ vm.thirdMerchantBizList = [];
|
|
|
+ vm.getCusUnitCodeList();
|
|
|
+ vm.getCusNationCode();
|
|
|
+ vm.showInput = true;
|
|
|
+ if (vm.goods.goodsBizType == '10' || vm.goods.goodsBizType == '02') {
|
|
|
+ vm.showInput = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ vm.price();
|
|
|
+ vm.discount();
|
|
|
+ vm.detail();
|
|
|
+
|
|
|
+ },
|
|
|
+ getInfo: function () {
|
|
|
+ var postData = {"goodsSn":vm.q.goodsSn,'prodBarcode':vm.q.prodBarcode,'storeId':vm.q.storeId};
|
|
|
+ vm.getCusUnitCodeList();
|
|
|
+ vm.getCusNationCode();
|
|
|
+ $.post("../goods/infoByQuery",postData,function(r){
|
|
|
+
|
|
|
+ vm.goods = r.goods;
|
|
|
+ // vm.goodsBizType = r.goods.goodsBizType;
|
|
|
+ });
|
|
|
+ // $.get("../goods/info/" + id, function (r) {
|
|
|
+ // vm.goods = r.goods;
|
|
|
+ // vm.goodsBizType = r.goods.goodsBizType;
|
|
|
+ //
|
|
|
+ // // vm.branch(r.goods.goodsSn);
|
|
|
+ // // vm.barcode(r.goods.goodsSn);
|
|
|
+ // // vm.sales(r.goods.goodsSn);
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ branch:function(){
|
|
|
+
|
|
|
+ var postData = {"goodsSn":vm.q.goodsSn,'prodBarcode':vm.q.prodBarcode,'storeId':vm.q.storeId};
|
|
|
+
|
|
|
+ $("#branchJqGrid").jqGrid('setGridParam',{
|
|
|
+ datatype:'json',
|
|
|
+ postData:postData,
|
|
|
+ }).trigger("reloadGrid");
|
|
|
+ },
|
|
|
+ price:function(){
|
|
|
+
|
|
|
+ },
|
|
|
+ discount:function(){
|
|
|
+
|
|
|
+ },
|
|
|
+ barcode:function(){
|
|
|
+ var postData = {"goodsSn":vm.q.goodsSn,'prodBarcode':vm.q.prodBarcode,'storeId':vm.q.storeId};
|
|
|
+
|
|
|
+ $("#barcodeJqGrid").jqGrid('setGridParam',{
|
|
|
+ datatype:'json',
|
|
|
+ postData:postData,
|
|
|
+ }).trigger("reloadGrid");
|
|
|
+ },
|
|
|
+ detail:function(){
|
|
|
+
|
|
|
+ },
|
|
|
+ sales:function(){
|
|
|
+ var postData = {"goodsSn":vm.q.goodsSn,'prodBarcode':vm.q.prodBarcode,'storeId':vm.q.storeId};
|
|
|
+
|
|
|
+ $("#salesJqGrid").jqGrid('setGridParam',{
|
|
|
+ datatype:'json',
|
|
|
+ postData:postData,
|
|
|
+ }).trigger("reloadGrid");
|
|
|
+ },
|
|
|
+ getMacro: function () {
|
|
|
+ // 获取货品业务类型
|
|
|
+ $.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
|
|
|
+ vm.macros = r.list;
|
|
|
+ });
|
|
|
+ },/*
|
|
|
+ getBrand: function (merchSn) {
|
|
|
+ $.get("../brand/queryAll?merchSn=" + merchSn, function (r) {
|
|
|
+ vm.brands = r.list;
|
|
|
+ });
|
|
|
+ },*/
|
|
|
+ getSuppliers: function (thirdMerchantCode) {
|
|
|
+ $.get("../supplier/queryAll?thirdPartyMerchCode=" + thirdMerchantCode, function (r) {
|
|
|
+ vm.suppliers = r.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getCusUnitCodeList: function () {
|
|
|
+ $.get("../syscusunitcode/queryAll", function (r) {
|
|
|
+ vm.cusUnitCodeList = r.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getCusNationCode: function () {
|
|
|
+ $.get("../syscusnationcode/queryAll", function (r) {
|
|
|
+ vm.cusNationCodeList = r.list;
|
|
|
+ });
|
|
|
+ },/*
|
|
|
+ getFreights: function(merchSn) {
|
|
|
+ $.get("../freight/queryAll?merchSn=" + merchSn, function (r) {
|
|
|
+ vm.freights = r.list;
|
|
|
+ });
|
|
|
+ },*/
|
|
|
+ getGoodsGallery: function (id) {//获取商品顶部轮播图
|
|
|
+ $.get("../goodsgallery/queryAll?goodsId=" + id, function (r) {
|
|
|
+ vm.uploadList = r.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getMerchList: function() {
|
|
|
+ $.get("../merch/queryAll", function (r) {
|
|
|
+ vm.merchList = r.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getThirdMerchantBizList: function(merchSn) {
|
|
|
+ $.get("../thirdmerchantbiz/queryAll?merchSn=" + merchSn, function (r) {
|
|
|
+ vm.thirdMerchantBizList = r.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ saveOrUpdate: function (event) {
|
|
|
+ var url = vm.goods.id == null ? "../goods/save" : "../goods/update";
|
|
|
+ vm.goods.goodsDesc = $('#goodsDesc').editable('getHTML');
|
|
|
+ vm.goods.goodsImgList = vm.uploadList;
|
|
|
+ // vm.goods.attributeEntityList = vm.attributeEntityList;
|
|
|
+ vm.goods.productEntityList = vm.productEntityList;
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: url,
|
|
|
+ dataType: "json",
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(vm.goods),
|
|
|
+ success: function (r) {
|
|
|
+ if (r.code === 0) {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ vm.reload();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ alert(r.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ enSale: function () {
|
|
|
+ var ids = getSelectedRows();
|
|
|
+ if (ids == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ confirm('确定要上架选中的商品?', function () {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "../goods/enSaleBatch",
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(ids),
|
|
|
+ success: function (r) {
|
|
|
+ if (r.code == 0) {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ $("#jqGrid").trigger("reloadGrid");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ alert(r.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ openSpe: function () {
|
|
|
+ var id = getSelectedRow();
|
|
|
+ if (id == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ openWindow({
|
|
|
+ type: 2,
|
|
|
+ title: '商品规格',
|
|
|
+ content: '../shop/goodsspecification.html?goodsId=' + id
|
|
|
+ })
|
|
|
+ },
|
|
|
+ openPro: function () {
|
|
|
+ var id = getSelectedRow();
|
|
|
+ if (id == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ openWindow({
|
|
|
+ type: 2,
|
|
|
+ title: '产品设置',
|
|
|
+ content: '../shop/product.html?goodsId=' + id
|
|
|
+ });
|
|
|
+ },
|
|
|
+ unSale: function () {
|
|
|
+ var ids = getSelectedRows();
|
|
|
+ if (ids == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ confirm('确定要下架选中的商品?', function () {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "../goods/unSaleBatch",
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(ids),
|
|
|
+ success: function (r) {
|
|
|
+ if (r.code == 0) {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ $("#jqGrid").trigger("reloadGrid");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ alert(r.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ del: function (event) {
|
|
|
+ var ids = getSelectedRows();
|
|
|
+ if (ids == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ confirm('确定要删除选中的记录?', function () {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: "../goods/delete",
|
|
|
+ contentType: "application/json",
|
|
|
+ data: JSON.stringify(ids),
|
|
|
+ success: function (r) {
|
|
|
+ if (r.code == 0) {
|
|
|
+ alert('操作成功', function (index) {
|
|
|
+ $("#jqGrid").trigger("reloadGrid");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ alert(r.msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ reload: function (event) {
|
|
|
+ vm.sales();
|
|
|
+ vm.branch();
|
|
|
+ vm.barcode();
|
|
|
+ vm.getInfo();
|
|
|
+ vm.showList = true;
|
|
|
+ // let page = event;
|
|
|
+ // if (event != 1) {
|
|
|
+ // page = $("#jqGrid").jqGrid('getGridParam', 'page');
|
|
|
+ // }
|
|
|
+ // $("#jqGrid").jqGrid('setGridParam', {
|
|
|
+ // postData: {
|
|
|
+ // 'name': vm.q.name,
|
|
|
+ // 'englishName': vm.q.englishName,
|
|
|
+ // 'goodsSn': vm.q.goodsSn,
|
|
|
+ // 'prodBarcode': vm.q.prodBarcode,
|
|
|
+ // 'goodsBizType': vm.q.goodsBizType,
|
|
|
+ // 'merchSn': vm.q.merchSn,
|
|
|
+ // 'thirdPartyMerchCode': vm.q.thirdPartyMerchCode
|
|
|
+ // },
|
|
|
+ // page: page
|
|
|
+ // }).trigger("reloadGrid");
|
|
|
+ // vm.handleReset('formValidate');
|
|
|
+ },
|
|
|
+ getCategory: function () {
|
|
|
+ //加载分类树
|
|
|
+ $.get("../category/query", function (r) {
|
|
|
+ ztree = $.fn.zTree.init($("#categoryTree"), setting, r.list);
|
|
|
+ var node = ztree.getNodeByParam("id", vm.goods.categoryId);
|
|
|
+ if (node) {
|
|
|
+ ztree.selectNode(node);
|
|
|
+ vm.goods.categoryName = node.name;
|
|
|
+ } else {
|
|
|
+ node = ztree.getNodeByParam("id", 0);
|
|
|
+ ztree.selectNode(node);
|
|
|
+ vm.goods.categoryName = node.name;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ categoryTree: function () {
|
|
|
+ openWindow({
|
|
|
+ title: "选择类型",
|
|
|
+ area: ['300px', '450px'],
|
|
|
+ content: jQuery("#categoryLayer"),
|
|
|
+ btn: ['确定', '取消'],
|
|
|
+ btn1: function (index) {
|
|
|
+ var node = ztree.getSelectedNodes();
|
|
|
+ if (node[0].isParent) {
|
|
|
+ alert("只能选择");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //选择上级菜单
|
|
|
+ vm.goods.categoryId = node[0].id;
|
|
|
+ vm.goods.categoryName = node[0].name;
|
|
|
+
|
|
|
+ layer.close(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ showStockShare:function(opt){
|
|
|
+ var thirdMerchantCode = opt.value;
|
|
|
+ /*$.get("../thirdmerchantbiz/infoByCode?thirdMerchantCode=" + thirdMerchantCode, function (r) {
|
|
|
+ if(r.thirdMerchantBiz){
|
|
|
+ vm.share = r.thirdMerchantBiz.isStockShare;
|
|
|
+ if(vm.goods.goodsBizType == '00' && r.thirdMerchantBiz.isStockShare == 1){
|
|
|
+ // vm.isStockShare = true;
|
|
|
+ }else{
|
|
|
+ // vm.isStockShare = false;
|
|
|
+ vm.goods.goodsNumber= '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });*/
|
|
|
+ vm.getSuppliers(thirdMerchantCode);
|
|
|
+ },
|
|
|
+ changeGoodsBizType: function(opt) {
|
|
|
+ var goodsBizType = opt.value;
|
|
|
+ if (vm.goods.goodsBizType == '10' || vm.goods.goodsBizType == '02') {
|
|
|
+ vm.showInput = false;
|
|
|
+ } else {
|
|
|
+ vm.showInput = true;
|
|
|
+ }
|
|
|
+ // console.log('goodsBizType:'+vm.goods.goodsBizType)
|
|
|
+ // console.log('share:'+vm.share)
|
|
|
+ // if(vm.goods.goodsBizType == '00' && vm.share == 1){
|
|
|
+ // vm.isStockShare = true;
|
|
|
+ // }else{
|
|
|
+ // vm.isStockShare = false;
|
|
|
+ // // vm.goods.goodsNumber= '';
|
|
|
+ // // console.log('错错错')
|
|
|
+ // }
|
|
|
+
|
|
|
+ },
|
|
|
+ handleView(name) {
|
|
|
+ this.imgName = name;
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
+ /*changeQueryCategories: function (opt) {
|
|
|
+ var value = opt.value;
|
|
|
+ $.get("../category/getCategorySelectByParent?parentId=" + value, function (r) {
|
|
|
+ vm.queryCategoriesTwo = r.list;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ getAttributes: function (opt) {
|
|
|
+ var value = opt.value;
|
|
|
+ $.get("../attribute/query?attributeCategoryId=" + value, function (r) {
|
|
|
+ vm.attributes = r.list;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (opt.flag != 1 && !(value === vm.categoryId)) {
|
|
|
+ if (vm.attributeEntityList.length > 0 && vm.attributeEntityList[0].attributeId != '') {
|
|
|
+ for (var i = 0; i < vm.attributeEntityList.length; i++) {
|
|
|
+ if (!(vm.attributeEntityList[0].attributeId === '')) {
|
|
|
+ vm.attributeEntityList[i].isDelete = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var goodsId = '';
|
|
|
+ if (vm.goods) {
|
|
|
+ goodsId = vm.goods.id;
|
|
|
+ }
|
|
|
+ vm.attributeEntityList.unshift({'id': '', 'goodsId': goodsId, 'attributeId': '', 'value': '', 'isDelete': 0});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeCategories: function (opt) {
|
|
|
+ var value = opt.value;
|
|
|
+ $.get("../category/getCategorySelectByParent?isShow=1&parentId=" + value, function (r) {
|
|
|
+ vm.categoriesTwo = r.list;
|
|
|
+ });
|
|
|
+ },*/
|
|
|
+ uploadExcelSuccess: function (data) {
|
|
|
+ // console.log(data);
|
|
|
+ if(data.code==0){
|
|
|
+ alert('导入成功', function (index) {
|
|
|
+ $("#jqGrid").trigger("reloadGrid");
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ alert(data.msg);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ uploadExcelError: function () {
|
|
|
+ alert('上传出现异常,请重试!');
|
|
|
+ },
|
|
|
+ uploadExcelFormatError: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '文件格式不正确',
|
|
|
+ desc: '文件 ' + file.name + ' 格式不正确,请上传 xls 或 xlsx 格式的文件。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleRemove(file) {
|
|
|
+ // 从 upload 实例删除数据
|
|
|
+ const fileList = vm.uploadList;
|
|
|
+ vm.uploadList.splice(fileList.indexOf(file), 1);
|
|
|
+ },
|
|
|
+ handleSuccess(res, file) {
|
|
|
+ // 因为上传过程为实例,这里模拟添加 url
|
|
|
+ file.imgUrl = res.url;
|
|
|
+ file.name = res.url;
|
|
|
+ vm.uploadList.add(file);
|
|
|
+ },
|
|
|
+ handleBeforeUpload() {
|
|
|
+ const check = vm.uploadList.length < 5;
|
|
|
+ if (!check) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '最多只能上传 5 张图片。'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return check;
|
|
|
+ },
|
|
|
+ handleSubmit: function (name) {
|
|
|
+ // handleSubmitValidate(this, name, function () {
|
|
|
+ vm.saveOrUpdate()
|
|
|
+ // });
|
|
|
+ },
|
|
|
+ handleFormatError: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '文件格式不正确',
|
|
|
+ desc: '文件 ' + file.name + ' 格式不正确,请上传 jpg 或 png 格式的图片。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleMaxSize: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '超出文件大小限制',
|
|
|
+ desc: '文件 ' + file.name + ' 太大,不能超过 100k。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleMaxSizeByInfo: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '超出文件大小限制',
|
|
|
+ desc: '文件 ' + file.name + ' 太大,不能超过 300k。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleReset: function (name) {
|
|
|
+ handleResetForm(this, name);
|
|
|
+ },
|
|
|
+ handleSuccessPicUrl: function (res, file) {
|
|
|
+ vm.goods.primaryPicUrl = file.response.url;
|
|
|
+ },
|
|
|
+ handleSuccessListPicUrl: function (res, file) {
|
|
|
+ vm.goods.listPicUrl = file.response.url;
|
|
|
+ },
|
|
|
+ eyeImagePicUrl: function () {
|
|
|
+ var url = vm.goods.primaryPicUrl;
|
|
|
+ eyeImage(url);
|
|
|
+ },
|
|
|
+ eyeImageListPicUrl: function () {
|
|
|
+ var url = vm.goods.listPicUrl;
|
|
|
+ eyeImage(url);
|
|
|
+ },
|
|
|
+ eyeImage: function (e) {
|
|
|
+ eyeImage($(e.target).attr('src'));
|
|
|
+ },
|
|
|
+ eyeImageListVideoUrl: function (e) {
|
|
|
+ var url = vm.goods.videoUrl;
|
|
|
+ eyeVideo(url);
|
|
|
+ },
|
|
|
+ handleVideoFormatError: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '文件格式不正确',
|
|
|
+ desc: '文件 ' + file.name + ' 格式不正确,请上传 mp4 格式的图片。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleVideoMaxSize: function (file) {
|
|
|
+ this.$Notice.warning({
|
|
|
+ title: '超出文件大小限制',
|
|
|
+ desc: '文件 ' + file.name + ' 太大,不能超过 1M。'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleSuccessListVideoUrl: function (res, file) {
|
|
|
+ vm.goods.videoUrl = file.response.url;
|
|
|
+ },
|
|
|
+ goodsExport: function () {
|
|
|
+ vm.fileList = false;
|
|
|
+ },
|
|
|
+ showMerchInfo:function(opt){
|
|
|
+ var merchSn = opt.value;
|
|
|
+ // vm.getCategories(merchSn);
|
|
|
+ // vm.getFreights(merchSn);
|
|
|
+ // vm.getBrand(merchSn);
|
|
|
+ vm.getThirdMerchantBizList(merchSn);
|
|
|
+ },
|
|
|
+ // getCategories: function (merchSn) {
|
|
|
+ // $.get("../category/getCategorySelect?isShow=1&merchSn=" + merchSn, function (r) {
|
|
|
+ // vm.categories = r.list;
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // this.uploadList = this.$refs.upload.fileList;
|
|
|
+ /*$.get("../category/getCategorySelect", function (r) {
|
|
|
+ vm.queryCategories = r.list;
|
|
|
+ });*/
|
|
|
+ $.get("../merch/queryAll", function (r) {
|
|
|
+ vm.queryMerch = r.list;
|
|
|
+ });
|
|
|
+ $.get("../store/queryAll", function (r) {
|
|
|
+ vm.stores = r.list;
|
|
|
+ });
|
|
|
+ $.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
|
|
|
+ vm.macros = r.list;
|
|
|
+ });
|
|
|
+
|
|
|
+ $.get("../thirdmerchantbiz/queryAll", function (r) {
|
|
|
+ vm.thirdMerchantBizViewList = r.list;
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+});
|