From 49e12e5f3aab9308a58819ae87371ab2bd182386 Mon Sep 17 00:00:00 2001 From: rouchen <3133657697@qq.com> Date: Mon, 25 Mar 2024 21:04:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20=E5=AE=8C=E5=96=841?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/product/info/detail/index.vue | 68 ++++++++++++++++++++----- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/src/views/product/info/detail/index.vue b/src/views/product/info/detail/index.vue index 20fcd85..a2c943e 100644 --- a/src/views/product/info/detail/index.vue +++ b/src/views/product/info/detail/index.vue @@ -71,7 +71,8 @@ {{receivedShop.projectInfo.name}} -

125

+ 商品规格 {{checkSkuInfo.sku}} +

{{ checkSkuInfo.price }}

@@ -82,10 +83,13 @@
- - - {{value}} - + + + + + {{value}} @@ -107,9 +111,6 @@ kooriookami 18100000000 苏州市 - - 学校 - 江苏省苏州市吴中区吴中大道 1188 号 @@ -145,21 +146,30 @@ export default { title: "增长人数", form: { num: 1, - rule0: '', // 第一个规格的默认值 - rule1: '', // 第二个规格的默认值 - rule2: '', // 第三个规格的默认值 + price: 0 }, shopData: {}, receivedShop: {}, editorValue: "阿萨德刚", - deadline2: Date.now() + 10 * 60 * 60 , // 商品轮播图 - Products: [] + Products: [], + checkSkuInfo: { + price : 0.00 + }, + deadline2 : Date.now() + 1 * 10000 // 10小时 * 60分钟/小时 * 60秒/分钟 * 1000毫秒/秒 } }, created() { this.parseShopFromRoute(); + // 设置定时器 + const timerId = setTimeout(() => { + // 时间到了,调用 hilarity 函数 + this.hilarity(); + clearTimeout(timerId); + }, this.deadline2 - Date.now()); + + }, methods:{ hilarity() { @@ -169,6 +179,27 @@ export default { duration: 0, }); }, + initSku(){ + let sku =this.receivedShop.projectSkuInfoList[0]['sku']; + let skuArr =sku.split("-"); + skuArr.forEach((rule,index) => { + this.form['rule'+index] = rule + }) + this.selectRuleSku() + }, + selectRuleSku(){ + let ruleSize =this.receivedShop.ruleAttrAddModelList.length + let sku = ""; + for (let index = 0 ; ;index++){ + sku +=this.form['rule'+index] + if (index+1 === ruleSize){ + break + } + sku += "-"; + } + this.checkSkuInfo= this.receivedShop.projectSkuInfoList.find(skuInfo => skuInfo.sku === sku) + console.log("sdf",this.checkSkuInfo) + }, parseShopFromRoute() { // 尝试解析shop查询参 this.receivedShop = this.$route.query.shop; @@ -178,7 +209,16 @@ export default { let ccc = this.receivedShop.projectInfo.carouselImages.split(',') this.Products.push(...ccc) - } + let ruleAttrLength = this.receivedShop.ruleAttrAddModelList.length; + console.log("hieng",ruleAttrLength) + for (let index = 0 ;index < ruleAttrLength ;index++){ + this.form["rule"+index] = null + } + this.initSku() + + }, + }, + beforeDestroy() { } }