1 line
6.4 KiB
JSON
1 line
6.4 KiB
JSON
|
{"ast":null,"code":"import \"core-js/modules/es.number.to-fixed.js\";\nimport \"core-js/modules/es.json.stringify.js\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { toLoad } from \"../utils/initialize\";\nexport default {\n name: \"CartItem\",\n props: {\n cart: Object,\n countChangeFlag: false\n },\n created: function created() {},\n mounted: function mounted() {},\n data: function data() {\n return {\n baseApi: this.$store.state.baseApi\n };\n },\n computed: {\n totalPrice: function totalPrice() {\n return (this.realPrice * this.cart.count).toFixed(2);\n },\n realPrice: function realPrice() {\n return this.cart.price * this.cart.discount;\n }\n },\n methods: {\n //从购物车移除\n del: function del(id) {\n var _this = this;\n\n this.request.delete(\"/api/cart/\" + this.cart.id).then(function (res) {\n if (res.code === '200') {\n _this.$message.success(\"删除成功\");\n\n _this.$emit('delete', _this.cart.id);\n }\n });\n },\n //跳转到支付页面\n pay: function pay() {\n var good = {\n id: this.cart.goodId,\n name: this.cart.goodName,\n imgs: this.cart.img,\n discount: this.cart.discount\n };\n this.$router.push({\n name: 'preOrder',\n query: {\n good: JSON.stringify(good),\n realPrice: this.realPrice,\n num: this.cart.count,\n standard: this.cart.standard,\n cartId: this.cart.id\n }\n });\n }\n }\n};","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA;AACA;AACAA,kBADA;AAEAC;AACAC,gBADA;AAEAC;AAFA,GAFA;AAMAC,SANA,qBAMA,CAEA,CARA;AASAC,SATA,qBASA,CAEA,CAXA;AAYAC,MAZA,kBAYA;AACA;AAEAC;AAFA;AAIA,GAjBA;AAkBAC;AACAC;AACA;AACA,KAHA;AAIAC;AACA;AACA;AANA,GAlBA;AA0BAC;AACA;AACAC,OAFA,eAEAC,EAFA,EAEA;AAAA;;AACA;AACA;AACA;;AACA;AACA;AACA,OALA;AAMA,KATA;AAUA;AACAC,OAXA,iBAWA;AACA;AAAAD;AAAAb;AAAAe;AAAAC;AAAA;AACA;AAAAhB;AAAAiB;AAAAC;AAAAR;AAAAS;AAAAC;AAAAC;AAAA;AAAA;AACA;AAdA;AA1BA","names":["name","props","cart","countChangeFlag","created","mounted","data","baseApi","computed","totalPrice","realPrice","methods","del","id","pay","imgs","discount","query","good","num","standard","cartId"],"sourceRoot":"src/components","sources":["CartItem.vue"],"sourcesContent":["<template>\r\n <div>\r\n <div class=\"header\" style=\"padding-left: 25px;\">\r\n <span style=\"line-height: 40px\"><b>订单时间:{{ cart.createTime }}</b></span>\r\n </div>\r\n <div class=\"body\">\r\n<!-- 图片-->\r\n <div style=\"display: inline-block;margin-right: 20px\">\r\n <router-link :to=\"'goodview/'+cart.goodId\">\r\n <img :src=\"baseApi + cart.img\" style=\"width: 100px;height:100px\">\r\n </router-link>\r\n </div>\r\n<!-- 商品信息-->\r\n <div style=\"display: inline-block;line-height: 40px\" >\r\n <table>\r\n <tr>\r\n <th>商品</th>\r\n <th>规格</th>\r\n <th>价格</th>\r\n <th>数量</th>\r\n <th>总价</th>\r\n <th>操作</th>\r\n </tr>\r\n <tr>\r\n <a :href=\"'goodview/'+cart.goodId\">\r\n <td>{{ cart.goodName }}</td>\r\n </a>\r\n <td>{{cart.standard}}</td>\r\n <td>{{realPrice.toFixed(2)}}</td>\r\n <td>\r\n <el-button style=\"font-size: 15px;\" @click=\"countChangeFlag=true\" v-if=\"!countChangeFlag\">\r\n {{cart.count}}\r\n </el-button>\r\n <el-input-number v-model=\"cart.count\" :min=\"1\" :max=\"cart.store\" v-if=\"countChangeFlag\" style=\"width: 120px\" ></el-input-number>\r\n </td>\r\n <td>{{totalPrice}}</td>\r\n <td>\r\n <e
|