diff --git a/project/dao/backCommodityManagementDao.js b/project/dao/backCommodityManagementDao.js index 62fa31c929812e271d871d738ddae16c55930677..ee63bf4fc56930b182f33c4d247391ed05a9a37e 100644 --- a/project/dao/backCommodityManagementDao.js +++ b/project/dao/backCommodityManagementDao.js @@ -3,6 +3,24 @@ const backCommodityManagementDao = { getbackSKUManageDao(params){ return new Promise((resolve) =>{ let sql = `SELECT * FROM \`sku_info\``; + let spu = `SELECT * FROM \`spu_view\``; + let style = `SELECT + spec_option_table.spec_option_id, + spec_option_table.spec_id, + spec_option_table.spec_option_value + FROM + spec_option_table + WHERE + spec_option_table.spec_id = 1`; + let color = `SELECT + spec_option_table.spec_option_id, + spec_option_table.spec_id, + spec_option_table.spec_option_value + FROM + spec_option_table + WHERE + spec_option_table.spec_id = 2 + `; let SKU={ list:null, SUPelect:null, @@ -15,10 +33,10 @@ const backCommodityManagementDao = { SKU.list=data; /*对象去重*/ let obj = {}; - SKU.SUPelect = data.reduce(function(item, next) { - obj[next.SPU_code] ? '' : obj[next.SPU_code] = true && item.push(next); - return item; - }, []); + // SKU.SUPelect = data.reduce(function(item, next) { + // obj[next.SPU_code] ? '' : obj[next.SPU_code] = true && item.push(next); + // return item; + // }, []); obj={}; SKU.style= data.reduce(function(item, next) { obj[next.spec_option_id_style] ? '' : obj[next.spec_option_id_style] = true && item.push(next); @@ -30,8 +48,18 @@ const backCommodityManagementDao = { return item; }, []); /*/对象去重*/ - // console.log(SKU.style); - resolve(SKU); + dbpool.connect(spu,params,(err,data)=>{ + SKU.SUPelect=data; + dbpool.connect(style,params,(err,data)=>{ + SKU.style=data; + dbpool.connect(color,params,(err,data)=>{ + SKU.color=data ; + resolve(SKU); + }); + + }); + // console.log(SKU.style); + }); }) } ) }, @@ -45,12 +73,7 @@ const backCommodityManagementDao = { series:null }; let sql = ` - SELECT - * - FROM - sku_spu_view - GROUP BY - sku_spu_view.SPU_code + SELECT * FROM spu_view `; let designer_table=`SELECT designer_table.designer_id, diff --git a/project/public/images/view_pic/spu/headImg/Weekends_head.jpg b/project/public/images/view_pic/spu/headImg/Weekends_head.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3574bcd2565e719588966242d989953f130965de Binary files /dev/null and b/project/public/images/view_pic/spu/headImg/Weekends_head.jpg differ diff --git a/project/public/js/commodityDetails/commodityDetails.js b/project/public/js/commodityDetails/commodityDetails.js index 1e66f7e876eab1f91a5b5d8f8125dcf49766de2d..09b5cd3c8ce73a01e234d8c6e2e856d6fa6c3761 100644 --- a/project/public/js/commodityDetails/commodityDetails.js +++ b/project/public/js/commodityDetails/commodityDetails.js @@ -134,6 +134,19 @@ $(".shoppingCart").on("click",function () { } }) }); +function purchaseNow() { + $.ajax({ + type:"get", + url:"/go_to_checkout", + data:{ + "SKU_code":$('.detailImg img').eq(0).attr("alt"), + }, + success:function (data) { + console.log(data); + }, + async: false + }) +} /*/购物车添加*/ diff --git a/project/views/XY/commodityDetails.ejs b/project/views/XY/commodityDetails.ejs index 4b9d8b6bfd2c7669e1e550e3c7b448489864eb20..2cc32de5783761dcc6d1f26f6ae793e88fe3c197 100644 --- a/project/views/XY/commodityDetails.ejs +++ b/project/views/XY/commodityDetails.ejs @@ -69,7 +69,8 @@