1 line
24 KiB
Plaintext
1 line
24 KiB
Plaintext
{"version":3,"sources":["uni-app:///main.js","webpack:///D:/老农商城/mall-laonong/pages/cart/cart.vue?82d9","webpack:///D:/老农商城/mall-laonong/pages/cart/cart.vue?9b62","webpack:///D:/老农商城/mall-laonong/pages/cart/cart.vue?f707","webpack:///D:/老农商城/mall-laonong/pages/cart/cart.vue?17ea","uni-app:///pages/cart/cart.vue","webpack:///D:/老农商城/mall-laonong/pages/cart/cart.vue?2a2c","webpack:///D:/老农商城/mall-laonong/pages/cart/cart.vue?edb4"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page"],"mappings":";;;;;;;;;;kDAAA;;;AAGA;AACA,yF,8FAHA;AACAA,EAAE,CAACC,iCAAH,GAAuCC,mBAAvC,CAGAC,UAAU,CAACC,aAAD,CAAV,C;;;;;;;;;;;;;ACLA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA6H;AAC7H;AACwD;AACL;AACqC;;;AAGxF;AACoL;AACpL,gBAAgB,2LAAU;AAC1B,EAAE,0EAAM;AACR,EAAE,2FAAM;AACR,EAAE,oGAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,+FAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACvBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA,aAAa,oMAEN;AACP;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACjCA;AAAA;AAAA;AAAA;AAAsrB,CAAgB,orBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACuD1sB;AACA,uE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADA;eAEA,EACA,IADA,kBACA,CACA,SACA,qDADA,EAEA,cAFA,EAEA;AACA,mBAHA,EAGA;AACA,eAJA,EAIA;AACA,eALA,EAMA,YANA,EAOA,OAPA,EAQA,QARA,EASA,QATA,EAUA,UAVA,EAUA;AACA,mBAXA,EAWA;AACA,qBAZA,EAaA,UAbA,GAeA,CAjBA,EAkBA,MAlBA,oBAkBA,CACA,iCACA,mBAFA,CAGA;AACA,mBACA,CAvBA,EAwBA,aAxBA,2BAwBA,CACA,mBACA,YADA,CAEA;AACA,qBACA,CACA,CA9BA,EA+BA,YACA;AACA,eAFA,yBAEA,CACA,2CACA,CAJA,EAMA;AACA,YAPA,sBAOA,CACA,iBACA,uCACA,mBACA,8CACA,CACA,CAJA,EAKA,gDAPA,CAQA;AACA,KAhBA,EAkBA;AACA,UAnBA,oBAmBA,CACA,eACA,uCACA,mBACA,YACA,CACA,CAJA,EAKA,cACA,CA3BA,EA6BA;AACA,aA9BA,uBA8BA,CACA,kBACA,2BACA,oFACA,mDACA;AACA;AACA;AACA;AACA,SAFA;AAGA;AACA;AACA;AACA;AACA,KA5CA,EA/BA;;AA6EA;AACA;AACA,WAFA,qBAEA;AACA;AACA;AACA;AACA,uBADA;AAEA,uBAFA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBADA;AAEA,gCAFA;AAGA,gCAHA;AAIA,qCAJA;AAKA,uCALA;AAMA,sCANA;AAOA,oCAPA;AAQA,gDARA;AASA,wCATA;AAUA,wBAVA;AAWA,uCAXA;AAYA,2BAZA;AAaA,2BAbA;AAcA,0BAdA;AAeA,0BAfA;;AAiBA;AACA,WAnBA;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAhCA;AAiCA,KA1CA;;AA4CA;AACA,aA7CA,uBA6CA;AACA;AACA;AACA;AACA,OAFA,MAEA;AACA;AACA;AACA,KApDA;;AAsDA;AACA,YAvDA,sBAuDA;AACA;AACA;AACA;AACA,mCADA;;AAGA,OALA,MAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCADA;AAEA,6BAFA;;AAIA;AACA;AACA,WARA;AASA;AACA;AACA,yCADA;;AAGA;AACA;AACA,WAFA,EAEA,IAFA;AAGA;AACA;AACA,KApFA;;AAsFA;AACA,YAvFA,oBAuFA,KAvFA,EAuFA;AACA;AACA,KAzFA;;AA2FA;AACA,YA5FA,oBA4FA,KA5FA,EA4FA,GA5FA,EA4FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SALA,MAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAJA;AAKA;AACA,KA/GA;;AAiHA;AACA,aAlHA,uBAkHA;AACA;AACA;AACA,qBADA;AAEA,8BAFA;AAGA;AACA;AACA;AACA;AACA,aAHA,MAGA;AACA;AACA;AACA,WAVA;;AAYA;AACA,KAjIA;;AAmIA;AACA,cApIA,wBAoIA;AACA;AACA;AACA;AACA;AACA,SAHA,MAGA;AACA;AACA;AACA,OAPA;AAQA,KA7IA;;AA+IA;AACA,cAhJA,wBAgJA;AACA;AACA;AACA;AACA,OAFA;AAGA;AACA;AACA,KAvJA;;AAyJA;AACA,YA1JA,oBA0JA,EA1JA,EA0JA;AACA;AACA,6DADA;;AAGA,KA9JA;;AAgKA;AACA,WAjKA,mBAiKA,GAjKA,EAiKA;AACA;AACA;AACA,KApKA;;AAsKA;AACA,UAvKA,kBAuKA,KAvKA,EAuKA,CAvKA,EAuKA;AACA;AACA;AACA;AACA;AACA,KA5KA,EA7EA,E;;;;;;;;;;;;;ACzDA;AAAA;AAAA;AAAA;AAAmgC,CAAgB,69BAAG,EAAC,C;;;;;;;;;;;ACAvhC;AACA,OAAO,KAAU,EAAE,kBAKd","file":"pages/cart/cart.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/cart/cart.vue'\ncreatePage(Page)","import { render, staticRenderFns, recyclableRender, components } from \"./cart.vue?vue&type=template&id=0f00adf4&scoped=true&\"\nvar renderjs\nimport script from \"./cart.vue?vue&type=script&lang=js&\"\nexport * from \"./cart.vue?vue&type=script&lang=js&\"\nimport style0 from \"./cart.vue?vue&type=style&index=0&id=0f00adf4&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"0f00adf4\",\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"pages/cart/cart.vue\"\nexport default component.exports","export * from \"-!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--16-0!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./cart.vue?vue&type=template&id=0f00adf4&scoped=true&\"","var components\ntry {\n components = {\n statusNav: function() {\n return import(\n /* webpackChunkName: \"components/status-nav/status-nav\" */ \"@/components/status-nav/status-nav.vue\"\n )\n }\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function() {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./cart.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--12-1!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./cart.vue?vue&type=script&lang=js&\"","<template>\r\n\t<view class=\"pad-x170\" v-if=\"isLoading\">\r\n\t\t<status-nav :ifReturn=\"true\" navBarTitle=\"购物车\" :marginBottom=\"0\"></status-nav>\r\n\t\t<view class=\"cart-content\">\r\n\t\t\t<!-- 全选 -->\r\n\t\t\t<view class=\"change-all border-box background-white font26 flex\" :style=\"{top:statusHeight+50+'px'}\">\r\n\t\t\t\t<label class=\"label flex\" @tap=\"chooseAll\"><radio :checked=\"allChoose\" color=\"#febf00\" style=\"transform: scale(.8);\"/><text>全选</text></label>\r\n\t\t\t\t<view class=\"del-cart\" @tap=\"delShopEv\">删除</view>\r\n\t\t\t</view>\r\n\t\t\t<view class=\"slide-list\">\r\n\t\t\t\t<view class=\"slide-item\" v-for=\"(item, index) in listData\" :key=\"index\">\r\n\t\t\t\t\t<view class=\"slide-item-li border-box background-white flex\">\r\n\t\t\t\t\t\t<label class=\"radio\" @tap.stop=\"chooseEv(index)\"><radio :checked=\"item.ifcheck\" color=\"#febf00\"/></label>\r\n\t\t\t\t\t\t<view class=\"shop-img radius30\" @tap.stop=\"goDetail(item.spuId)\">\r\n\t\t\t\t\t\t\t<image :src=\"item.image\" mode=\"widthFix\"></image> \r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t<view class=\"shop-txt\">\r\n\t\t\t\t\t\t\t<view class=\"shop-txt-top\" @tap.stop=\"goDetail(item.spuId)\">\r\n\t\t\t\t\t\t\t\t<view class=\"title font30 clips1\">{{item.title}}</view>\r\n\t\t\t\t\t\t\t\t<view class=\"specs font24 color-66 mar-sx10 clips2\">规格:{{item.skuName}}</view>\r\n\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t\t<view class=\"shop-txt-bottom flex\">\r\n\t\t\t\t\t\t\t\t<!-- 商品价格 -->\r\n\t\t\t\t\t\t\t\t<view class=\"price font30 color-red\">¥{{item.price}}</view>\r\n\t\t\t\t\t\t\t\t<!-- 商品数量 -->\r\n\t\t\t\t\t\t\t\t<view class=\"num font24 flex\">\r\n\t\t\t\t\t\t\t\t\t<!-- 减数量 -->\r\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-cut count-btn fon24 color-ff radius10 flex\" @tap.stop=\"addCutEv(index,0)\" :style=\"{backgroundColor: item.num==minNum || item.slide_x!=0 ? '#d3d3d3' : '#febf00'}\"></i>\r\n\t\t\t\t\t\t\t\t\t<!-- 实际数量 -->\r\n\t\t\t\t\t\t\t\t\t<input class=\"input border-box radius10\" type=\"digit\" @blur=\"blurEv(index,$event)\" @focus=\"focusEv(item.num)\" :disabled=\"item.slide_x!=0\" v-model=\"item.num\">\r\n\t\t\t\t\t\t\t\t\t<!-- 加数量 -->\r\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-add count-btn fon24 color-ff radius10 flex\" @tap.stop=\"addCutEv(index,1)\" :style=\"{backgroundColor: item.num==maxNum || item.slide_x!=0 ? '#d3d3d3' : '#febf00'}\"></i>\r\n\t\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t</view>\r\n\t\t\t\t</view>\r\n\t\t\t</view>\r\n\t\t\t<!-- 提交订单 -->\r\n\t\t\t<view class=\"pull-footer-bg background-white pad-all20 radius30 border-box\">\r\n\t\t\t\t<view class=\"pull-footer background-grey radius30 pad-all20 border-box flex\">\r\n\t\t\t\t\t<view class=\"price color-ff\">\r\n\t\t\t\t\t\t<view class=\"font36\">合计:{{allPrice>0?'¥'+allPrice:'0'}}</view>\r\n\t\t\t\t\t</view>\r\n\t\t\t\t\t<view class=\"btn font36 color-48 radius30 flex\" :style=\"{background: !buyNum ? '#cccccc' : '#febf00'}\" @tap=\"submitEv\">{{allPrice==0 ? '去购物' : '立即购买'}}</view>\r\n\t\t\t\t</view>\r\n\t\t\t</view>\r\n\t\t\t<!-- 到底啦 -->\r\n\t\t\t<view class=\"no-more font24 pad-sx25\" style=\"margin: 0;\" v-if=\"listData.length!==0 && noMore\"><text>—— 到底啦 ——</text></view>\r\n\t\t\t<nothing-page v-if=\"listData.length==0\" content=\"您的购物车,空空如也(*^▽^*)\"></nothing-page>\r\n\t\t</view> \r\n\t</view>\r\n</template>\r\n\r\n<script>\r\n\timport { mapState,mapGetters,mapMutations } from 'vuex'//引入mapState\r\n\timport {getCartInfo} from '@/jsFile/public-api.js';\r\n\texport default {\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\tstatusHeight:uni.getSystemInfoSync().statusBarHeight,\r\n\t\t\t\toriginalNum:0,//当前输入框原值\r\n\t\t\t\tmaxNum:99999,//最大可输入数量\r\n\t\t\t\tminNum:1,//最小可输入数量\r\n\t\t\t\tskuId:'',\r\n\t\t\t\tlistData: [],\r\n\t\t\t\tpage:1,\r\n\t\t\t\tsize:10,\r\n\t\t\t\ttotal:0,\r\n\t\t\t\tdelIds:'', //删除ids\r\n\t\t\t\tnoMore:false, //没有更多\r\n\t\t\t\tisLoading:true,\r\n\t\t\t\tflag:true,\r\n\t\t\t}\r\n\t\t},\r\n\t\tonShow() {\r\n\t\t\tuni.removeStorageSync('buyList');\r\n\t\t\tthis.listData = [];\r\n\t\t\t// 查询购物车列表\r\n\t\t\tthis.getList();\r\n\t\t},\r\n\t\tonReachBottom() {\r\n\t\t\tif(!this.noMore){\r\n\t\t\t\tthis.page++;\r\n\t\t\t\t// 获取商品列表\r\n\t\t\t\tthis.getList();\r\n\t\t\t}\r\n\t\t},\r\n\t\tcomputed: {\r\n\t\t\t// 获取宽度\r\n\t\t\twindowWidth() {\r\n\t\t\t\treturn uni.getSystemInfoSync().windowWidth;\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 总价及合计\r\n\t\t\tallPrice() {\r\n\t\t\t\tlet allPrice = 0;\r\n\t\t\t\tthis.listData.forEach(item=>{\r\n\t\t\t\t\tif(item.ifcheck) {\r\n\t\t\t\t\t\tallPrice += parseFloat(item.price*item.num);\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\treturn this.$toolAll.tools.addXiaoShu(allPrice);\r\n\t\t\t\t// return allPrice.toString();\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 要删除的数量\r\n\t\t\tbuyNum() {\r\n\t\t\t\tlet buyNum = 0;\r\n\t\t\t\tthis.listData.forEach(item=>{\r\n\t\t\t\t\tif(item.ifcheck) {\r\n\t\t\t\t\t\tbuyNum += 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\treturn buyNum;\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 全选\r\n\t\t\tallChoose() {\r\n\t\t\t\tlet ifAll = false;\r\n\t\t\t\tif(this.listData.length) {\r\n\t\t\t\t\tlet temparr = this.listData.filter(item=>{return item.ifcheck==false})\r\n\t\t\t\t\t\ttemparr.length==0 ? ifAll = true : ifAll = false;\r\n\t\t\t\t\tlet delTemparr = this.listData.filter(item=>{return item.ifcheck==true})\r\n\t\t\t\t\tlet delArr = [];\r\n\t\t\t\t\tdelTemparr.forEach(item=>{\r\n\t\t\t\t\t\tdelArr.push(item.id)\r\n\t\t\t\t\t})\r\n\t\t\t\t\t// 删除购物车\r\n\t\t\t\t\tthis.delIds = delArr.join(',');\r\n\t\t\t\t}\r\n\t\t\t\treturn ifAll\r\n\t\t\t},\r\n\t\t},\r\n\t\tmethods: {\r\n\t\t\t// 获取商品列表\r\n\t\t\tgetList(){\r\n\t\t\t\tuni.showLoading();\r\n\t\t\t\tthis.total = 0;\r\n\t\t\t\tlet params = {\r\n\t\t\t\t\tpage:this.page,\r\n\t\t\t\t\tsize:this.size\r\n\t\t\t\t}\r\n\t\t\t\tthis.$requst.post('/api/order/shopping-cart',params).then(res=>{\r\n\t\t\t\t\tif(res.code==0){\r\n\t\t\t\t\t\tconsole.log(res,'购物车列表');\r\n\t\t\t\t\t\tthis.total = res.data.total;\r\n\t\t\t\t\t\tlet cartArr = [];\r\n\t\t\t\t\t\tres.data.list.forEach(item=>{\r\n\t\t\t\t\t\t\tlet obj = {\r\n\t\t\t\t\t\t\t\tid: item.id,\r\n\t\t\t\t\t\t\t\tspuId:item.spu.id,\r\n\t\t\t\t\t\t\t\tskuId:item.sku_id,\r\n\t\t\t\t\t\t\t\tcoding:item.sku.coding,\r\n\t\t\t\t\t\t\t\timage: item.spu.spu_cover,\r\n\t\t\t\t\t\t\t\ttitle: item.spu.spu_name,\r\n\t\t\t\t\t\t\t\tcontent: item.spu.unit,\r\n\t\t\t\t\t\t\t\tcustomTitle: item.sku.custom_title,\r\n\t\t\t\t\t\t\t\tskuName: item.sku.sku_name,\r\n\t\t\t\t\t\t\t\tslide_x: 0,\r\n\t\t\t\t\t\t\t\tprice:item.sku.sku_price,\r\n\t\t\t\t\t\t\t\tnum:item.num,\r\n\t\t\t\t\t\t\t\tifcheck:true,\r\n\t\t\t\t\t\t\t\tifExit:true,\r\n\t\t\t\t\t\t\t\tifShow:true,\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tcartArr.push(obj);\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tthis.listData = this.listData.concat(cartArr);\r\n\t\t\t\t\t\tif(this.listData.length == this.total){\r\n\t\t\t\t\t\t\tthis.noMore = true;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tuni.hideLoading();\r\n\t\t\t\t\tthis.isLoading = true;\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 全选事件\r\n\t\t\tchooseAll(){\r\n\t\t\t\tlet exit = this.listData.filter(item=>item.ifcheck==false);\r\n\t\t\t\tif(exit.length){\r\n\t\t\t\t\tthis.listData.forEach(item=>item.ifcheck = true);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.listData.forEach(item=>{item.ifcheck = false});\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 去购物、去结算、删除\r\n\t\t\tsubmitEv(){\r\n\t\t\t\tif(this.allPrice==0) {\r\n\t\t\t\t\t// 去购物\r\n\t\t\t\t\tuni.reLaunch({\r\n\t\t\t\t\t\turl:`/pages/index/index`\r\n\t\t\t\t\t})\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif(this.flag){\r\n\t\t\t\t\t\tthis.flag=false;\r\n\t\t\t\t\t\t// 去结算\r\n\t\t\t\t\t\tlet buyList = [];\r\n\t\t\t\t\t\tthis.listData.forEach(item=>{\r\n\t\t\t\t\t\t\tif(item.ifcheck) {\r\n\t\t\t\t\t\t\t\tlet obj = {\r\n\t\t\t\t\t\t\t\t\tsku_coding: item.coding,\r\n\t\t\t\t\t\t\t\t\tnum: item.num\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbuyList.push(obj);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tuni.setStorageSync('buyList',buyList);\r\n\t\t\t\t\t\tuni.navigateTo({\r\n\t\t\t\t\t\t\turl:'/pages/cart/settlement'\r\n\t\t\t\t\t\t})\r\n\t\t\t\t\t\tsetTimeout(()=>{\r\n\t\t\t\t\t\t\tthis.flag=true;\r\n\t\t\t\t\t\t},1500)\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 选中事件\r\n\t\t\tchooseEv(index) {\r\n\t\t\t\tthis.listData[index].ifcheck = !this.listData[index].ifcheck;\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 数量加减事件\r\n\t\t\taddCutEv(index,num) {\r\n\t\t\t\tif(this.listData[index].slide_x==0){\r\n\t\t\t\t\tif(num) {\r\n\t\t\t\t\t\t// 加 ,如果当前商品数量不等于最大值\r\n\t\t\t\t\t\tif(this.listData[index].num != this.maxNum) {\r\n\t\t\t\t\t\t\tthis.listData[index].num++;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// 减 ,如果当前商品数量大于最小值\r\n\t\t\t\t\t\tif(this.listData[index].num > this.minNum) {\r\n\t\t\t\t\t\t\tthis.listData[index].num--;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.$requst.post('/api/order/shopping-cart-change-num',{id:this.listData[index].id,num:this.listData[index].num}).then(res=>{\r\n\t\t\t\t\t\tif(res.code!=0){\r\n\t\t\t\t\t\t\tthis.$toolAll.tools.showToast(res.msg);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 删除商品\r\n\t\t\tdelShopEv(){\r\n\t\t\t\tif(this.delIds!==''){\r\n\t\t\t\t\tuni.showModal({\r\n\t\t\t\t\t\ttitle: '提示',\r\n\t\t\t\t\t\tcontent: '是否删除选中商品?',\r\n\t\t\t\t\t\tsuccess: (res)=> {\r\n\t\t\t\t\t\t\tif (res.confirm) {\r\n\t\t\t\t\t\t\t\t// 确认删除\r\n\t\t\t\t\t\t\t\tthis.confirmDel();\r\n\t\t\t\t\t\t\t} else if (res.cancel) {\r\n\t\t\t\t\t\t\t\tconsole.log('用户点击取消');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 确认删除\r\n\t\t\tconfirmDel(){\r\n\t\t\t\tthis.$requst.post('/api/order/shopping-cart-del',{ids:this.delIds.toString()}).then(res=>{\r\n\t\t\t\t\tif(res.code==0){\r\n\t\t\t\t\t\tthis.listData = this.listData.filter(item=>item.ifcheck==false)\r\n\t\t\t\t\t\tthis.$toolAll.tools.showToast('删除成功');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tthis.$toolAll.tools.showToast(res.msg)\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 计算总价\r\n\t\t\ttotalPrice() {\r\n\t\t\t\tlet totalPrice = 0;\r\n\t\t\t\tthis.listData.forEach(item=>{\r\n\t\t\t\t\ttotalPrice += parseFloat(item.price*item.num);\r\n\t\t\t\t})\r\n\t\t\t\ttotalPrice = this.$toolAll.tools.addXiaoShu(totalPrice);\r\n\t\t\t\tthis.$store.commit('setPrice', totalPrice);\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 查看商品详情\r\n\t\t\tgoDetail(id) {\r\n\t\t\t\tuni.navigateTo({\r\n\t\t\t\t\turl:`/pagesB/shop-detail/shop-detail?id=${id}`\r\n\t\t\t\t})\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 输入框获取焦点事件\r\n\t\t\tfocusEv(num) {\r\n\t\t\t\t// 储存当前商品的原始数值\r\n\t\t\t\tthis.originalNum = num;\r\n\t\t\t},\r\n\t\t\t\r\n\t\t\t// 输入框失去焦点事件\r\n\t\t\tblurEv(index,e) {\r\n\t\t\t\t// 失去焦点时,获取当前输入框里的数值\r\n\t\t\t\tlet currentNum = e.detail.value*1;\r\n\t\t\t\t// 如果当前输入框的值不等于0或空,并且当前输入框的值大于最大值,当前商品的数量 = 最大值, 否则为当前输入框输入的值\r\n\t\t\t\tthis.listData[index].num = currentNum ? currentNum > this.maxNum ? this.maxNum : currentNum : this.originalNum;\r\n\t\t\t},\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style scoped>\r\n\t.slide-list{\r\n\t\tmargin-top: 20rpx;\r\n\t}\r\n\t.slide-item-li{\r\n\t\talign-items: center;\r\n\t\twidth: calc(100% - 40rpx);\r\n\t\tpadding: 30rpx 0;\r\n\t\tmargin: 0 auto;\r\n\t\tborder-bottom: 2rpx solid #eaeaea;\r\n\t}\r\n\t.slide-item-li .radio>radio{\r\n\t\ttransform: scale(.8);\r\n\t\tmargin-left: -5rpx;\r\n\t}\r\n\t.slide-item-li .shop-img{\r\n\t\twidth: 194rpx;\r\n\t\theight: 194rpx;\r\n\t\tmargin: 0 24rpx 0 6rpx;\r\n\t\toverflow: hidden;\r\n\t}\r\n\t.slide-item-li .shop-img image{\r\n\t\twidth: 100%;\r\n\t\tmin-height: 194rpx;\r\n\t}\r\n\t.slide-item-li .shop-txt{\r\n\t\twidth: calc(100% - 264rpx);\r\n\t}\r\n\t.slide-item-li .shop-txt-top{\r\n\t\tmin-height: 134rpx;\r\n\t}\r\n\t.slide-item-li .shop-txt-top .title{\r\n\t\tline-height: 1.5;\r\n\t}\r\n\t.slide-item-li .shop-txt-top .specs{\r\n\t\tline-height: 1.5;\r\n\t}\r\n\t.slide-item-li .shop-txt-bottom{\r\n\t\tjustify-content: space-between;\r\n\t\talign-items: center;\r\n\t\twidth: 100%;\r\n\t\theight: 50rpx;\r\n\t}\r\n\t.slide-item-li .shop-txt-bottom .price{\r\n\t\tline-height: 1.5;\r\n\t}\r\n\t.slide-item-li .shop-txt-bottom .num{\r\n\t\tjustify-content: space-between;\r\n\t\talign-items: center;\r\n\t\twidth: 170rpx;\r\n\t}\r\n\t.slide-item-li .shop-txt-bottom .num>.count-btn{\r\n\t\tjustify-content: center;\r\n\t\talign-items: center;\r\n\t\twidth: 40rpx;\r\n\t\theight: 40rpx;\r\n\t}\r\n\t.slide-item-li .shop-txt-bottom .num>.input{\r\n\t\twidth: 78rpx;\r\n\t\theight: 40rpx;\r\n\t\tborder: 2rpx solid #d3d3d3;\r\n\t\ttext-align: center;\r\n\t}\r\n\t.change-all{\r\n\t\tjustify-content: space-between;\r\n\t\talign-items: center;\r\n\t\twidth: calc(100% - 40rpx);\r\n\t\theight: 80rpx;\r\n\t\tmargin: 0 auto;\r\n\t\tborder-bottom: 2rpx solid #eaeaea;\r\n\t\tposition: sticky;\r\n\t\tleft: 0;\r\n\t\tz-index: 9;\r\n\t}\r\n\t.change-all .label{\r\n\t\talign-items: center;\r\n\t\tmargin-left: -5rpx;\r\n\t}\r\n</style>\r\n","import mod from \"-!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--6-oneOf-1-2!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-3!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./cart.vue?vue&type=style&index=0&id=0f00adf4&scoped=true&lang=css&\"; export default mod; export * from \"-!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--6-oneOf-1-2!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-3!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./cart.vue?vue&type=style&index=0&id=0f00adf4&scoped=true&lang=css&\"","// extracted by mini-css-extract-plugin\n if(module.hot) {\n // 1659578079781\n var cssReload = require(\"D:/HBuilderX-app开发版/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.id, {\"hmr\":true,\"publicPath\":\"../../\",\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n "],"sourceRoot":""} |