Commit 7115df3a by 梁建民

js

parent c109081c
...@@ -26,6 +26,8 @@ const mutations = { ...@@ -26,6 +26,8 @@ const mutations = {
state.ziYingIndex = payload.data; state.ziYingIndex = payload.data;
}, },
aggs(state, payload) { aggs(state, payload) {
var arr = []; var arr = [];
var obj = Object.keys(payload.data.aggs); var obj = Object.keys(payload.data.aggs);
...@@ -37,11 +39,19 @@ const mutations = { ...@@ -37,11 +39,19 @@ const mutations = {
for (let i = 0; i < payload.data.aggs[k].list.length; i++) { for (let i = 0; i < payload.data.aggs[k].list.length; i++) {
payload.data.aggs[k].list[i].check = false; payload.data.aggs[k].list[i].check = false;
for (let j = 0; j < arr.length; j++) { for (let j = 0; j < arr.length; j++) {
if (payload.data.aggs[k].list[i].id == arr[j]) { if (payload.data.aggs[k].list[i].id == arr[j]) {
payload.data.aggs[k].list[i].check = !payload.data.aggs[k].list[i].check; payload.data.aggs[k].list[i].check = !payload.data.aggs[k].list[i].check;
payload.data.aggs[k].list[i].flag = !payload.data.aggs[k].list[i].flag; payload.data.aggs[k].list[i].flag = !payload.data.aggs[k].list[i].flag;
if (payload.reset) {
payload.data.aggs[k].list[i].check = false;
payload.data.aggs[k].list[i].flag = false;
}
} }
} }
...@@ -102,7 +112,6 @@ const actions = { ...@@ -102,7 +112,6 @@ const actions = {
} else if (data.error_code == 3) { } else if (data.error_code == 3) {
} else { } else {
Toast({ Toast({
...@@ -141,6 +150,7 @@ const actions = { ...@@ -141,6 +150,7 @@ const actions = {
commit({ commit({
type: 'aggs', type: 'aggs',
data: data.data, data: data.data,
reset: payload.params.reset,
id: payload.params.id id: payload.params.id
}); });
} else { } else {
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</template> </template>
</ul> </ul>
<div class="button"> <div class="button">
<a class="cancel">重置</a> <a class="cancel" @click="canel()">重置</a>
<a class="confirm" @click="submit()">确定</a> <a class="confirm" @click="submit()">确定</a>
</div> </div>
</div> </div>
...@@ -89,8 +89,8 @@ ...@@ -89,8 +89,8 @@
{{v.sample_max_number}} {{v.sample_max_number}}
</p> </p>
<div class="btn-wrap clr"> <div class="btn-wrap clr">
<div class="btnw fl" v-shareMask>送朋友 </div> <div class="btnw fl" v-shareMask>送朋友</div>
<div class="btnx fr" @click="yaoqing(v)">领取样品 </div> <div class="btnx fr" @click="yaoqing(v)">领取样品</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -138,7 +138,7 @@ ...@@ -138,7 +138,7 @@
import wxShare from "@/views/common/wxShare.vue"; import wxShare from "@/views/common/wxShare.vue";
import {services as Services} from "../../api/index"; import {services as Services} from "../../api/index";
import util from "../../util/index"; import util from "../../util/index";
import {Tab, Tabs, Lazyload, List, Toast,Swipe, SwipeItem,} from "vant"; import {Tab, Tabs, Lazyload, List, Toast, Swipe, SwipeItem,} from "vant";
Vue.use(Tab).use(Tabs).use(Lazyload).use(Toast).use(Swipe).use(SwipeItem); Vue.use(Tab).use(Tabs).use(Lazyload).use(Toast).use(Swipe).use(SwipeItem);
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
name: "sample", name: "sample",
data() { data() {
return { return {
bannerHeight:173, bannerHeight: 173,
title: "猎芯网-自营样片", title: "猎芯网-自营样片",
meaushow: true, meaushow: true,
bgcolor: "#fafafa", bgcolor: "#fafafa",
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
getPop: false, //获得机会弹窗,没机会时展示 getPop: false, //获得机会弹窗,没机会时展示
getPops: false, getPops: false,
quota: '', quota: '',
finished:false, finished: false,
quotaNum: '', quotaNum: '',
loadingYp: false, loadingYp: false,
applyCount: 0, applyCount: 0,
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
this.$store.dispatch({ this.$store.dispatch({
type: "ziYingIndex", type: "ziYingIndex",
params: {'sample_class_id/eq':1} params: {'sample_class_id/eq': 1}
}); });
this.$store.dispatch({ this.$store.dispatch({
...@@ -266,13 +266,13 @@ ...@@ -266,13 +266,13 @@
this.$store.dispatch({ this.$store.dispatch({
type: "ziYingIndex", type: "ziYingIndex",
params: {'sample_class_id/eq':name} params: {'sample_class_id/eq': name}
}); });
}, },
onLoad() { onLoad() {
this.p++; this.p++;
this.finished=true; this.finished = true;
}, },
getuserf() { getuserf() {
this.getPop = false; this.getPop = false;
...@@ -300,6 +300,15 @@ ...@@ -300,6 +300,15 @@
this.layer = false; this.layer = false;
}, },
canel: function () {
let params = Object.assign({}, {reset: true, 'sample_class_id/eq': this.sample_class_id}, this.brand_id, this.packing, this.encap, this.attrs, {id: this.id.join(',')});
this.$store.dispatch({
type: "aggs",
params: params
});
},
screenFn: function (id, key, flag) { screenFn: function (id, key, flag) {
if (key == 'brand_id') { if (key == 'brand_id') {
...@@ -389,7 +398,7 @@ ...@@ -389,7 +398,7 @@
return; return;
} else { } else {
var stock=util.aggxde(item.stock); var stock = util.aggxde(item.stock);
if (this.applyCount != 0) { if (this.applyCount != 0) {
if (stock) { if (stock) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment