Commit 9743ed34 by 肖康

H5购物车修改

parent e435cc84
Showing with 116 additions and 126 deletions
......@@ -9,23 +9,20 @@ const state = {
loading1:false,
ly1:false,//联营大陆得到数据防止切换多次请求
ly2:false,//联营香港得到数据防止切换多次请求
zy1:false,//自营得到数据防止切换多次请求
ly1Data:[],//大陆数据
ly2Data:[],//香港数据
zy1Data:[],//自营数据现货
zy2Data:[],//自营数据期货
ly1Length:0,
ly2Length:0,
zy1Length:0,//自营数据总长度
ly1LoseData:[],
ly2LoseData:[],
zy1LoseData:[],
priceInit:false,
totlaMState:false
}
const mutations = {
cartList(state, payload) {
state.ly1Length=payload.data.cn_count;
state.ly2Length=payload.data.hk_count;
if(payload.types_==1){
//大陆
var arr_=payload.data.list;
......@@ -50,130 +47,56 @@ const mutations = {
state.ly2Data.push(arr_[i])
}
}
}else{
//自营
var arr_=payload.data.list;
for(var i=0;i<arr_.length;i++){
arr_[i].editState=false;
if(arr_[i].status==-1){
state.zy1LoseData.push(arr_[i]);
}else{
if(arr_[i].sale_type==1){
//现货默认勾选
arr_[i].check=true;
state.zy1Data.push(arr_[i]);
}else{
//期货 //默认不勾选
arr_[i].check=false;
state.zy2Data.push(arr_[i])
}
}
}
}
},
cartDelete(state,payload){
var ids=payload.cart_id.split(",");
if(payload.types==1){
//联营
if(payload.act=='normal'){
//删除操作
var datalistp=payload.delivery==1?state.ly1Data:state.ly2Data;
for(var i=0;i<datalistp.length;i++){
for(var j=0;j<ids.length;j++){
if(datalistp[i].cart_id==ids[j]){
datalistp.splice(i,1);
}
//联营
if(payload.act=='normal'){
//删除操作
var datalistp=payload.delivery==1?state.ly1Data:state.ly2Data;
for(var i=0;i<datalistp.length;i++){
for(var j=0;j<ids.length;j++){
if(datalistp[i].cart_id==ids[j]){
datalistp.splice(i,1);
}
}
if(payload.delivery==1){
state.ly1Data=datalistp;
state.ly1Length=Number(state.ly1Length)-ids.length;
}else{
state.ly2Data=datalistp;
state.ly2Length=Number(state.ly2Length)-ids.length;
}
}
if(payload.delivery==1){
state.ly1Data=datalistp;
state.ly1Length=Number(state.ly1Length)-ids.length;
}else{
//清除过期数据
if(payload.delivery==1){
state.ly1LoseData=[];
}else{
state.ly2LoseData=[];
}
state.ly2Data=datalistp;
state.ly2Length=Number(state.ly2Length)-ids.length;
}
}else{
//自营
if(payload.act=='normal'){
//删除
for(var i=0;i<state.zy1Data.length;i++){
for(var j=0;j<ids.length;j++){
if(state.zy1Data[i].cart_id==ids[j]){
state.zy1Data.splice(i,1);
}
}
}
for(var ii=0;ii<state.zy2Data.length;i++){
for(var jj=0;jj<ids.length;jj++){
if(state.zy2Data[ii].cart_id==ids[jj]){
state.zy2Data.splice(ii,1);
}
}
}
state.zy1Length=Number(state.zy1Length)-ids.length;
//清除过期数据
if(payload.delivery==1){
state.ly1LoseData=[];
}else{
//清除过期数据
state.zy1LoseData=[];
state.ly2LoseData=[];
}
}
},
changenum(state,payload){
if(payload.delivery_place==1||payload.delivery_place==2){
//大陆//香港
var list_=payload.delivery_place==1?state.ly1Data:state.ly2Data;
for(var i=0;i<list_.length;i++){
if(list_[i].cart_id==payload.cart_id){
list_[i].goods_number=payload.data.num;
list_[i].goods_amount=payload.data.goods_amount;
list_[i].goods_amount_format=payload.data.goods_amount_format;
list_[i].goods_price=payload.data.goods_price;
list_[i].goods_price_format=payload.data.goods_price_format;
}
}
}else{
//自营
var list_1=state.zy1Data,list_2=state.zy2Data;
for(var i=0;i<list_1.length;i++){
if(list_1[i].cart_id==payload.cart_id){
list_1[i].goods_number=payload.data.num;
list_1[i].goods_amount=payload.data.goods_amount;
list_1[i].goods_amount_format=payload.data.goods_amount_format;
list_1[i].goods_price=payload.data.goods_price;
list_1[i].goods_price_format=payload.data.goods_price_format;
if(payload.data.sale_type==2){
var arrj=list_1[i];
list_1.splice(i,1);
state.zy2Data.push(arrj)
}
}
}
for(var j=0;j<list_2.length;j++){
if(list_2[j].cart_id==payload.cart_id){
list_2[j].goods_number=payload.data.num;
list_2[j].goods_amount=payload.data.goods_amount;
list_2[j].goods_amount_format=payload.data.goods_amount_format;
list_2[j].goods_price=payload.data.goods_price;
if(payload.data.sale_type==1){
var arrj=list_2[j];
list_2.splice(j,1);
state.zy1Data.push(arrj)
}
}
}
}
//大陆//香港
var list_=payload.delivery_place==1?state.ly1Data:state.ly2Data;
for(var i=0;i<list_.length;i++){
if(list_[i].cart_id==payload.cart_id){
console.log(list_[i])
list_[i].goods_number=payload.data.num;
list_[i].goods_amount=payload.data.goods_amount;
list_[i].goods_amount_format=payload.data.goods_amount_format;
list_[i].goods_price=payload.data.goods_price;
list_[i].goods_price_format=payload.data.goods_price_format;
}
}
// console.log(list_)
state.totlaMState=true;
}
}
......@@ -202,9 +125,6 @@ const actions = {
}else if(types_==2){
//香港
state.ly2=true;
}else{
//自营
state.zy1=true;
}
if (data.err_code == 0) {
commit({
......@@ -223,16 +143,7 @@ const actions = {
state.loading1=false;
});
},
allcount({commit},payload){
Services.allcount().then((res) => {
let data = res.data;
if (data.err_code == 0) {
state.ly1Length=Number(data.data['1']['1']||0);
state.ly2Length=Number(data.data['1']['2']||0);
state.zy1Length=Number(data.data['2']['1']||0);
}
})
},
cartDelete({commit},payload){
state.loading=true;
var params = {
......
webpackHotUpdate(0,{
/***/ "./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_babel-loader@8.1.0@babel-loader/lib/index.js!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/index.js?!./src/views/car/car.vue?vue&type=script&lang=js&":
/*!******************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/views/car/car.vue?vue&type=script&lang=js& ***!
\******************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, exports) {
eval("throw new Error(\"Module build failed (from ./node_modules/_babel-loader@8.1.0@babel-loader/lib/index.js):\\nSyntaxError: D:\\\\lxWork\\\\h5\\\\src\\\\views\\\\car\\\\car.vue: Unexpected token (734:27)\\n\\n\\u001b[0m \\u001b[90m 732 | \\u001b[39m duration\\u001b[33m:\\u001b[39m \\u001b[35m1500\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m 733 | \\u001b[39m })\\u001b[33m;\\u001b[39m\\u001b[0m\\n\\u001b[0m\\u001b[31m\\u001b[1m>\\u001b[22m\\u001b[39m\\u001b[90m 734 | \\u001b[39m } \\u001b[36melse\\u001b[39m ) {\\u001b[0m\\n\\u001b[0m \\u001b[90m | \\u001b[39m \\u001b[31m\\u001b[1m^\\u001b[22m\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m 735 | \\u001b[39m \\u001b[36mif\\u001b[39m (goodType \\u001b[33m==\\u001b[39m \\u001b[35m6\\u001b[39m \\u001b[33m&&\\u001b[39m allowPresale \\u001b[33m==\\u001b[39m \\u001b[35m1\\u001b[39m) {\\u001b[0m\\n\\u001b[0m \\u001b[90m 736 | \\u001b[39m self\\u001b[33m.\\u001b[39m$toast(\\u001b[32m\\\"想要购买更多,请联系客服\\\"\\u001b[39m)\\u001b[33m;\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m 737 | \\u001b[39m \\u001b[36mvar\\u001b[39m inputVal \\u001b[33m=\\u001b[39m num \\u001b[33m||\\u001b[39m \\u001b[35m0\\u001b[39m\\u001b[33m;\\u001b[39m\\u001b[0m\\n at Object._raise (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:757:17)\\n at Object.raiseWithData (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:750:17)\\n at Object.raise (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:744:17)\\n at Object.unexpected (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:8834:16)\\n at Object.parseExprAtom (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:10169:20)\\n at Object.parseExprAtom (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:4648:20)\\n at Object.parseExprSubscripts (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:9688:23)\\n at Object.parseMaybeUnary (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:9668:21)\\n at Object.parseExprOps (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:9538:23)\\n at Object.parseMaybeConditional (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:9511:23)\\n at Object.parseMaybeAssign (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:9466:21)\\n at Object.parseExpression (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:9418:23)\\n at Object.parseStatementContent (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:11332:23)\\n at Object.parseStatement (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:11203:17)\\n at Object.parseIfStatement (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:11556:51)\\n at Object.parseStatementContent (D:\\\\lxWork\\\\h5\\\\node_modules\\\\_@babel_parser@7.10.4@@babel\\\\parser\\\\lib\\\\index.js:11248:21)\");//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9ub2RlX21vZHVsZXMvX2NhY2hlLWxvYWRlckAyLjAuMUBjYWNoZS1sb2FkZXIvZGlzdC9janMuanM/IS4vbm9kZV9tb2R1bGVzL19iYWJlbC1sb2FkZXJAOC4xLjBAYmFiZWwtbG9hZGVyL2xpYi9pbmRleC5qcyEuL25vZGVfbW9kdWxlcy9fY2FjaGUtbG9hZGVyQDIuMC4xQGNhY2hlLWxvYWRlci9kaXN0L2Nqcy5qcz8hLi9ub2RlX21vZHVsZXMvX3Z1ZS1sb2FkZXJAMTUuOS4zQHZ1ZS1sb2FkZXIvbGliL2luZGV4LmpzPyEuL3NyYy92aWV3cy9jYXIvY2FyLnZ1ZT92dWUmdHlwZT1zY3JpcHQmbGFuZz1qcyYuanMiLCJzb3VyY2VzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_babel-loader@8.1.0@babel-loader/lib/index.js!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/index.js?!./src/views/car/car.vue?vue&type=script&lang=js&\n");
/***/ }),
/***/ "./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_babel-loader@8.1.0@babel-loader/lib/index.js!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/index.js?!./src/views/common/Menu.vue?vue&type=script&lang=js&":
false,
/***/ "./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{\"cacheDirectory\":\"node_modules/.cache/vue-loader\",\"cacheIdentifier\":\"157ee9a3-vue-loader-template\"}!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/templateLoader.js?!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/index.js?!./src/views/common/Menu.vue?vue&type=template&id=6cb94179&":
false,
/***/ "./node_modules/_css-loader@1.0.1@css-loader/index.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@3.0.0@postcss-loader/src/index.js?!./node_modules/_sass-loader@7.3.1@sass-loader/dist/cjs.js?!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/index.js?!./src/views/common/Menu.vue?vue&type=style&index=0&lang=scss&":
false,
/***/ "./node_modules/_vue-style-loader@4.1.2@vue-style-loader/index.js?!./node_modules/_css-loader@1.0.1@css-loader/index.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/stylePostLoader.js!./node_modules/_postcss-loader@3.0.0@postcss-loader/src/index.js?!./node_modules/_sass-loader@7.3.1@sass-loader/dist/cjs.js?!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?!./node_modules/_vue-loader@15.9.3@vue-loader/lib/index.js?!./src/views/common/Menu.vue?vue&type=style&index=0&lang=scss&":
false,
/***/ "./src/views/common/Menu.vue":
false,
/***/ "./src/views/common/Menu.vue?vue&type=script&lang=js&":
false,
/***/ "./src/views/common/Menu.vue?vue&type=style&index=0&lang=scss&":
false,
/***/ "./src/views/common/Menu.vue?vue&type=template&id=6cb94179&":
false
})
\ No newline at end of file
This diff could not be displayed because it is too large.
{"h":"8e4aea06b6a8accb6462","c":{"app":true}}
\ No newline at end of file
{"h":"df2f1ef2dd6b3fe3effd","c":{"app":true}}
\ No newline at end of file
{"h":"b3c0e1ff1155498ed655","c":{"app":true}}
\ No newline at end of file
{"h":"6d2ec02bb7671f772262","c":{"0":false,"app":true}}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
{"h":"c0bdbd22ffe4200a6585","c":{"28":true}}
\ No newline at end of file
This diff could not be displayed because it is too large.
{"h":"fb306d84efcbf1db41a7","c":{"28":true}}
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
{"h":"052eb7d89fe585a502e3","c":{"app":true}}
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
{"h":"3120e887d03686878725","c":{"28":true}}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
{"h":"76c3615b08924599ad47","c":{"28":true}}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
{"h":"cbb8baaa906568de9fb6","c":{"28":true}}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
{"h":"dcb398b22b7fc35a40cc","c":{"28":true}}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
{"h":"6d0aafd0da464d1477bc","c":{"28":true}}
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
{"h":"19ba1b1046c1b80c7046","c":{"28":true}}
\ No newline at end of file
{"h":"12577575de5c06ac1abc","c":{"28":true}}
\ No newline at end of file
{"h":"ed27122c77fc182c852d","c":{}}
\ No newline at end of file
This diff could not be displayed because it is too large.
{"h":"d41379e94c10e819d64f","c":{"app":true}}
\ No newline at end of file
{"h":"3761ad399a0d3857d595","c":{"28":true}}
\ No newline at end of file
{"h":"50f27ea5252f5a224295","c":{"28":true}}
\ No newline at end of file
{"h":"593d81b45a098a94dadf","c":{"28":true}}
\ No newline at end of file
{"h":"e4e579a08d5028569c29","c":{"28":true}}
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
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