1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846 |
- <template>
- <div class="box" ref="appBox">
-
- <div class="contentbox">
- <p class="cart_f">{{ $t("card.Cart") }}</p>
- <div class="bottomcontentbox_b">
- <div class="bottomcontentbox">
-
-
- {{$t('inquiry.QuickAdd')}}
- {{$t('button.addQuoteForm')}}
- <el-table
- class="table_boxf"
- :empty-text="$t('table.notable')"
- ref="dataTable"
- :row-key="getRowKeys"
- :data="list"
- border
- style="width: 100%"
- @select-all="checkSelectAll"
- @select="checkSelect"
- header-row-class-name="table_header"
- >
- <el-table-column
- type="selection"
- :reserve-selection="true"
- width="40"
- >
- </el-table-column>
- <el-table-column
- width="120"
- prop="productCatalog"
- :label="$t('table.catalog')"
- >
- </el-table-column>
- <el-table-column
- prop="productName"
- :label="$t('table.productName')"
- ></el-table-column>
- <el-table-column
- width="120"
- prop="size"
- :label="$t('table.size')"
- ></el-table-column>
- <el-table-column width="100" :label="$t('table.quantity')">
- <template slot-scope="scope">
- <el-input-number
- v-model="scope.row.number"
- @change="handleChange($event, scope.row)"
- :min="1"
- label="描述文字"
- ></el-input-number>
- </template>
- </el-table-column>
- <el-table-column width="100" :label="$t('bottomBar.Price')">
- <template slot-scope="scope">
- <span class="price">{{ $t("bottomBar.money") }}</span>
- <span class="line_total" v-if="$util.localeStorage()">{{
- scope.row.price
- }}</span>
- <span class="line_total" v-if="!$util.localeStorage()">{{
- scope.row.cnPrice
- }}</span>
- </template>
- </el-table-column>
-
- <el-table-column width="120" :label="$t('card.Discount')">
- <template slot-scope="scope">
- <span class="price">{{ $t("bottomBar.money") }}</span>
- <span class="line_total" v-if="$util.localeStorage()">{{
- scope.row.discountPrice
- }}</span>
- <span class="line_total" v-if="!$util.localeStorage()">{{
- scope.row.cnDiscountPrice
- }}</span>
- </template>
- </el-table-column>
- <el-table-column width="100" :label="$t('card.Total')">
- <template slot-scope="scope">
- <span class="price">{{ $t("bottomBar.money") }}</span>
- <span class="line_total" v-if="$util.localeStorage()">{{
- scope.row.number * scope.row.discountPrice
- }}</span>
- <span class="line_total" v-if="!$util.localeStorage()">{{
- scope.row.number * scope.row.cnDiscountPrice
- }}</span>
- </template>
- </el-table-column>
- <el-table-column width="100" :label="$t('card.Operate')">
- <template slot-scope="scope">
- <i @click="tapDelete(scope.row)" class="el-icon-delete"></i>
- </template>
- </el-table-column>
- </el-table>
-
- <el-table
- class="table_pmd"
- :empty-text="$t('table.notable')"
- ref="dataTablewx"
- :row-key="getRowKeys"
- :data="list"
- border
- style="width: 100%"
- @select-all="checkSelectAll"
- @select="checkSelect"
- header-row-class-name="table_header"
- >
- <el-table-column
- type="selection"
- :reserve-selection="true"
- width="40"
- >
- </el-table-column>
- <el-table-column
- prop="productCatalog"
- :label="$t('table.catalog')"
- style="width:20%;"
- >
- </el-table-column>
- <el-table-column
- prop="productName"
- :label="$t('table.productName')"
- style="width:20%"
- >
- </el-table-column>
- <el-table-column
- prop="size"
- :label="$t('table.size')"
- style="width:20%"
- >
- </el-table-column>
- <el-table-column :label="$t('table.quantity')" style="width:20%">
- <template slot-scope="scope">
- <el-input-number
- v-model="scope.row.number"
- @change="handleChange($event, scope.row)"
- :min="1"
- label="描述文字"
- ></el-input-number>
- </template>
- </el-table-column>
- <el-table-column
- :label="$t('checkout.More')"
- style="width:20%"
- type="expand"
- >
- <template slot-scope="scope">
- <el-form label-position="left" inline class="demo-table-expand">
- <el-form-item :label="$t('bottomBar.Price')">
- <span class="price">{{ $t("bottomBar.money") }}</span>
- <span v-if="$util.localeStorage()">{{
- scope.row.price
- }}</span>
- <span v-if="!$util.localeStorage()">{{
- scope.row.cnPrice
- }}</span>
- </el-form-item>
- <el-form-item :label="$t('card.Discount')">
- {{ scope.row.discountPrice }}
- <span class="price">{{ $t("bottomBar.money") }}</span>
- <span v-if="$util.localeStorage()">{{
- scope.row.discountPrice
- }}</span>
- <span v-if="!$util.localeStorage()">{{
- scope.row.cnDiscountPrice
- }}</span>
- </el-form-item>
- <el-form-item :label="$t('card.Total')">
- <span class="price">{{ $t("bottomBar.money") }}</span>
- {{scope.row.number*scope.row.discountPrice}}
- <span v-if="$util.localeStorage()">{{
- scope.row.number * scope.row.discountPrice
- }}</span>
- <span v-if="!$util.localeStorage()">{{
- scope.row.number * scope.row.cnDiscountPrice
- }}</span>
- </el-form-item>
- <el-form-item :label="$t('card.Operate')">
- <i @click="tapDelete(scope.row)" class="el-icon-delete"></i>
- </el-form-item>
- </el-form>
- </template>
- </el-table-column>
- </el-table>
- <div class="cart_button">
- <button @click="tapDeleteAll">{{ $t("card.items") }}</button>
- </div>
- <div class="cart_button_f">
- <div class="cart_text" v-if="$util.localeStorage()">
- {{ $t("card.Subtotal") }} :<span
- >{{ $t("bottomBar.money")
- }}{{ cartTotal.checkedGoodsDiscount }}</span
- >
- </div>
- <div class="cart_text" v-if="!$util.localeStorage()">
- {{ $t("card.Subtotal") }} :<span
- >{{ $t("bottomBar.money")
- }}{{ cartTotal.checkedGoodsDiscount }}</span
- >
- </div>
- {{$t('card.check')}}
- </div>
- </div>
-
- <div class="customer_box">
- <div class="customer" v-if="!tokenShow">
- <div class="title">
- {{ $t("taps.tips") }}<span class="required">*</span
- >{{ $t("taps.tipsRequired") }}:
- </div>
- <el-form
- :model="form"
- class="demo-form-inline"
- label-position="left"
- :label-width="langShow ? '160px' : '120px'"
- :inline="true"
- >
- <el-form-item :label="$t('input.email') + ':'" :required="true">
- <el-input
- v-model="form.email"
- :placeholder="$t('input.email')"
- ></el-input>
- </el-form-item>
- <el-form-item :label="$t('register.Fullname') + ':'">
- <el-input
- v-model="form.name"
- :placeholder="$t('register.Fullname')"
- ></el-input>
- </el-form-item>
- <el-form-item :label="$t('register.Company') + ':'">
- <el-input
- v-model="form.company"
- :placeholder="$t('register.Company')"
- ></el-input>
- </el-form-item>
- <el-form-item :label="$t('register.Country') + ':'">
- <el-select
- v-if="langShow"
- v-model="form.country"
- :placeholder="$t('register.Country')"
- >
- <el-option
- v-for="item in regionList"
- :key="item.en"
- :label="item.en"
- :value="item.en"
- >
- </el-option>
- </el-select>
- <el-select
- v-else
- v-model="form.country"
- :placeholder="$t('register.Country')"
- >
- <el-option
- v-for="item in regionList"
- :key="item.cn"
- :label="item.cn"
- :value="item.cn"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item :label="$t('register.Account') + ':'">
- <el-select
- v-model="form.accountType"
- :placeholder="$t('register.Account')"
- >
- <el-option
- v-for="item in accountTypeList"
- :key="$util.localeStorage() ? item.name : item.nameCn"
- :label="$util.localeStorage() ? item.name : item.nameCn"
- :value="item.name"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- </div>
-
- <div class="information customer">
- <div class="title title_s">
- {{ $t("checkout.Shipping") }}
- <div class="horizontal"></div>
- </div>
- <disdAddress @onaddress="onaddress" v-if="tokenShow"></disdAddress>
- <el-form
- v-else
- :model="receipt"
- ref="receipt"
- class="demo-form-inline"
- label-position="left"
- :label-width="langShow ? '160px' : '120px'"
- :inline="true"
- >
- <el-form-item
- :label="$t('checkout.Name') + ':'"
- :required="true"
- >
- <el-input
- v-model="receipt.name"
- :placeholder="$t('checkout.Name')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.Phone') + ':'"
- :required="true"
- >
- <el-input
- v-model="receipt.tel"
- :placeholder="$t('checkout.Phone')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.Institute') + ':'"
- :required="true"
- >
- <el-input
- v-model="receipt.company"
- :placeholder="$t('checkout.Institute')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('order.country') + ':'"
- :required="true"
- v-if="langShow"
- >
- <el-select
- v-model="receipt.country"
- :placeholder="$t('register.Country')"
- >
- <el-option
- v-for="item in regionList"
- :key="item.en"
- :label="item.en"
- :value="item.en"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="省:" :required="true" v-if="!langShow">
- <el-select
- v-model="receipt.province"
- placeholder="省"
- @change="changeProvince"
- >
- <el-option
- v-for="item in province"
- :key="item.label"
- :label="item.label"
- :value="item.label"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="市:" :required="true" v-if="!langShow">
- <el-select v-model="receipt.city" placeholder="市">
- <el-option
- v-for="item in city"
- :key="item.label"
- :label="item.label"
- :value="item.label"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.Addre') + ':'"
- :required="true"
- >
- <el-input
- v-model="receipt.address"
- :placeholder="$t('checkout.Addre')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.postal') + ':'"
- :required="true"
- >
- <el-input
- v-model="receipt.postalCode"
- :placeholder="$t('checkout.postal')"
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
-
- <div class="information customer" v-if="!tokenShow">
- <div class="title title_s">
- {{ $t("checkout.Choose") }}
- <div class="horizontal"></div>
- </div>
- <div class="checked_b">
- <el-checkbox v-model="identical" @change="identicalChange">{{
- $t("taps.sameAs")
- }}</el-checkbox>
- </div>
- <el-form
- :model="bill"
- ref="bill"
- class="demo-form-inline"
- label-position="left"
- :label-width="langShow ? '160px' : '120px'"
- :inline="true"
- >
- <el-form-item
- :label="$t('checkout.Name') + ':'"
- :required="true"
- >
- <el-input
- v-model="bill.name"
- :placeholder="$t('checkout.Name')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.Phone') + ':'"
- :required="true"
- >
- <el-input
- v-model="bill.tel"
- :placeholder="$t('checkout.Phone')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.Institute') + ':'"
- :required="true"
- >
- <el-input
- v-model="bill.company"
- :placeholder="$t('checkout.Institute')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('order.country') + ':'"
- :required="true"
- v-if="langShow"
- >
- <el-select
- v-model="bill.country"
- :placeholder="$t('register.Country')"
- >
- <el-option
- v-for="item in regionList"
- :key="item.en"
- :label="item.en"
- :value="item.en"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="省:" :required="true" v-if="!langShow">
- <el-select
- v-model="bill.province"
- placeholder="省"
- @change="billProvince"
- >
- <el-option
- v-for="item in province"
- :key="item.label"
- :label="item.label"
- :value="item.label"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="市:" :required="true" v-if="!langShow">
- <el-select v-model="bill.city" placeholder="市">
- <el-option
- v-for="item in billCity"
- :key="item.label"
- :label="item.label"
- :value="item.label"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.Addre') + ':'"
- :required="true"
- >
- <el-input
- v-model="bill.address"
- :placeholder="$t('checkout.Addre')"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="$t('checkout.postal') + ':'"
- :required="true"
- >
- <el-input
- v-model="bill.postalCode"
- :placeholder="$t('checkout.postal')"
- ></el-input>
- </el-form-item>
- </el-form>
- </div>
- <div class="information customer">
- <div class="title title_s">
- {{ $t("checkout.Payout") }}
- <div class="horizontal"></div>
- </div>
- <dissPayment></dissPayment>
- </div>
- </div>
- <div class="checkButtom">
- <button class="buttom" @click="submit">
- {{ $t("application.Submit") }}
- </button>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import region from "@/js/region";
- import provinces from "@/js/provinces";
- import disdAddress from "@/components/diss-address";
- import dissPayment from "@/components/diss-payment";
- export default {
- components: {
- disdAddress,
- dissPayment
- },
- name: "mycart",
- data() {
- return {
- identical: false,
- rules: [],
- langShow: this.$util.localeStorage(),
- regionList: [],
- province: [],
- city: [],
- billCity: [],
- tokenShow: !!localStorage.getItem("token"),
- list: [],
- cartTotal: {
- checkedGoodsDiscount: 0
- },
- checkList: [],
- selectList: [],
- form: {
- email: "",
- name: "",
- accountType: "",
- country: "",
- company: "",
- position: ""
- },
- receipt: {
-
- address: "",
- city: "",
- company: "",
- country: "",
- id: 0,
- isDefault: false,
- name: "",
- postalCode: "",
- province: "",
- tel: ""
- },
- bill: {
-
- address: "",
- city: "",
- company: "",
- country: "",
- id: 0,
- isDefault: false,
- name: "",
- postalCode: "",
- province: "",
- tel: ""
- },
- accountTypeList: [
- {
- name: "Industry",
- nameCn: "工业客户"
- },
- {
- name: "Academic",
- nameCn: "科研客户"
- },
- {
- name: "Distributor",
- nameCn: "经销商"
- }
- ],
- delFlagId: "",
- billId: ""
- };
- },
- methods: {
- onaddress(e) {
- this.delFlagId = e.delFlag;
- this.billId = e.billId;
- },
- identicalChange(e) {
-
- if (e) {
- this.bill = { ...this.receipt };
-
- } else {
- this.bill.address = "";
- this.bill.city = "";
- this.bill.company = "";
- this.bill.country = "";
- this.bill.id = 0;
- this.bill.isDefault = false;
- this.bill.name = "";
- this.bill.postalCode = "";
- this.bill.province = "";
- this.bill.tel = "";
- }
- },
- submit() {
-
- if (this.tokenShow) {
- this.tapsubmit();
- } else {
-
- this.noToken();
- }
- },
- noToken() {
- if (
- this.userVerification() &&
- this.verification() &&
- this.billVerification()
- ) {
- if (this.checkList.length > 0) {
- this.$api
- .post("order/submitNoLogin", {
- cartId: 0,
- cartList: this.checkList,
- fpAddress: this.receipt,
- message: "",
- shAddress: this.bill,
- user: this.form
- })
- .then(res => {
- if (res.code === 0) {
- this.$message({
- message: this.$t("message.checkoutSuccess"),
- type: "success"
- });
- for (let i = 0; i < this.list.length; i++) {
- for (let j = 0; j < this.checkList.length; j++) {
- if (this.list[i].skuId === this.checkList[j].skuId) {
- this.list.splice(i, 1);
- }
- }
- }
- window.gtag && window.gtag("event", "submit_cart");
- localStorage.setItem("shoppingCart", JSON.stringify(this.list));
- localStorage.setItem(
- "shoppingNum",
- JSON.stringify(this.list.length)
- );
- this.$router.push({ name: "ordersuccess" });
- } else {
- this.$message(res.msg);
- }
- });
- } else {
- this.$message(this.$t("button.Itsover"));
- }
- }
- },
- tapsubmit() {
-
- this.$api
- .post("order/submit", {
- cartId: 0,
- fpAddress: { id: this.billId },
- message: "",
- shAddress: { id: this.delFlagId }
- })
- .then(res => {
- if (res.code == 0) {
- this.$message({
- message: this.$t("message.checkoutSuccess"),
- type: "success"
- });
- gtag("event", "submit_cart");
- this.$router.push({ name: "ordersuccess" });
- } else {
- this.$message(res.msg);
- }
- });
- },
-
- changeProvince(e) {
- let that = this;
- that.receipt.city = "";
- that.province.forEach(item => {
- if (item.label == e) {
- that.city = item.children;
- }
- });
- },
-
- billProvince(e) {
- let that = this;
- that.bill.city = "";
- that.province.forEach(item => {
- if (item.label == e) {
- that.billCity = item.children;
- }
- });
- },
-
-
-
-
-
-
-
-
-
-
-
- getRowKeys(row, index) {
- if (JSON.parse(localStorage.getItem("token"))) {
- return row.id;
- } else {
- return row.skuId;
- }
- },
- checkSelectAll(e) {
-
- let that = this;
- var obj = [];
- that.selectList = [];
- if (JSON.parse(localStorage.getItem("token"))) {
- if (e.length > 0) {
- e.forEach(item => {
- that.selectList.push(item.id);
- });
- that.checked(true, that.selectList);
- } else {
- that.list.forEach(item => {
- obj.push(item.id);
- });
- that.checked(false, obj);
- }
- } else {
- if (e.length > 0) {
- var objList = [];
- e.forEach(item => {
- let data = {
- checked: true,
- id: item.id,
- number: item.number,
- productCatalog: item.productCatalog,
- skuId: item.skuId
- };
- objList.push(data);
- });
- this.checkList = objList;
- } else {
- this.checkList = [];
- }
- console.log(e, "============", this.checkList);
-
- }
- },
- checkSelect(selection, row) {
-
- let that = this;
- let data = [row.id];
- if (selection.length > that.selectList.length) {
- selection.forEach(item => {
- that.selectList.push(item.id);
- });
- this.checked(true, data, row);
- } else {
- that.selectList.forEach((item, index) => {
- if (item == row.id) {
- that.selectList.splice(index, 1);
- }
- });
- this.checked(false, data, row);
- }
- },
- checked(checked, obj, row) {
-
- let that = this;
- if (JSON.parse(localStorage.getItem("token"))) {
- that.$api
- .post("cart/checked", {
- checked: checked,
- ids: obj
- })
- .then(res => {
- if (res.code == 0) {
-
- that.getList();
- } else {
- this.$message(res.msg);
- }
- });
- } else {
- if (checked) {
- let data = {
- checked: true,
- id: row.id,
- number: row.number,
- productCatalog: row.productCatalog,
- skuId: row.skuId
- };
- this.checkList.push(data);
- } else {
- for (let i = 0; i < this.checkList.length; i++) {
- if (this.checkList[i].skuId === row.skuId) {
- this.checkList.splice(i, 1);
- }
- }
- }
- }
- },
- tapDeleteAll() {
-
- let that = this;
- var obj = [];
- if (JSON.parse(localStorage.getItem("token"))) {
- that.list.forEach(item => {
- obj.push(item.id);
- });
- that.$api
- .post("cart/delete", {
- checked: true,
- ids: this.selectList
- })
- .then(res => {
- if (res.code == 0) {
- that.getList();
- } else {
- this.$message(res.msg);
- }
- });
- } else {
- this.list = [];
- this.checkList = [];
- localStorage.removeItem("shoppingCart");
- localStorage.setItem("shoppingNum", JSON.stringify(this.list.length));
- }
- },
- tapDelete(e) {
-
- let that = this;
- if (JSON.parse(localStorage.getItem("token"))) {
- this.$api
- .post("cart/delete", {
- checked: true,
- ids: [e.id]
- })
- .then(res => {
- if (res.code == 0) {
- this.getList();
- } else {
- this.$message(res.msg);
- }
- });
- } else {
- this.list.forEach((item, index) => {
- if (item.skuId == e.skuId) {
- if (this.$util.localeStorage()) {
- that.cartTotal.checkedGoodsDiscount =
- that.cartTotal.checkedGoodsDiscount -
- e.number * e.discountPrice;
- } else {
- that.cartTotal.checkedGoodsDiscount =
- that.cartTotal.checkedGoodsDiscount -
- e.number * e.cnDiscountPrice;
- }
- that.list.splice(index, 1);
- }
- });
- for (let i = 0; i < this.checkList.length; i++) {
- if (this.checkList[i].skuId === e.skuId) {
- this.checkList.splice(i, 1);
- }
- }
- localStorage.setItem("shoppingCart", JSON.stringify(this.list));
- localStorage.setItem("shoppingNum", JSON.stringify(this.list.length));
- }
- },
- getList() {
- let that = this;
- let data = JSON.parse(localStorage.getItem("shoppingCart"));
- let arry = [];
- if (JSON.parse(localStorage.getItem("token"))) {
- if (data && data.length > 0) {
- data.forEach(item => {
- var obj = {
- checked: true,
- id: item.id,
- number: item.number,
- productCatalog: item.productCatalog,
- skuId: item.skuId
- };
- arry.push(obj);
- });
- } else {
- arry = null;
- }
- this.$api
- .post("cart/index", {
- cartList: arry
- })
- .then(res => {
- if (res.code == 0) {
- this.list = res.data.cartList;
- this.cartTotal = res.data.cartTotal;
- localStorage.removeItem("shoppingCart");
- localStorage.setItem(
- "shoppingNum",
- JSON.stringify(res.data.cartList.length)
- );
- } else {
- this.$message(res.msg);
- }
- });
- } else {
- if (data && data.length > 0) {
- data.forEach(item => {
- that.list.push(item);
- let data = {
- checked: true,
- id: item.id,
- number: item.number,
- productCatalog: item.productCatalog,
- skuId: item.skuId
- };
- that.checkList.push(data);
- if (this.$util.localeStorage()) {
- that.cartTotal.checkedGoodsDiscount +=
- item.number * item.discountPrice;
- } else {
- that.cartTotal.checkedGoodsDiscount +=
- item.number * item.cnDiscountPrice;
- }
- });
- }
- }
- },
- handleChange(e, obj) {
-
- let that = this;
- if (JSON.parse(localStorage.getItem("token"))) {
- this.$api
- .post("cart/update", {
- checked: obj.checked,
- id: obj.id,
- number: obj.number,
- productCatalog: obj.productCatalog,
- skuId: obj.skuId
- })
- .then(res => {
- if (res.code == 0) {
- this.getList();
- } else {
- this.getList();
- this.$message(res.msg);
- }
- });
- } else {
- that.cartTotal.checkedGoodsDiscount = 0;
- this.list.forEach(item => {
- if (this.$util.localeStorage()) {
- that.cartTotal.checkedGoodsDiscount +=
- item.number * item.discountPrice;
- } else {
- that.cartTotal.checkedGoodsDiscount +=
- item.number * item.cnDiscountPrice;
- }
- });
- localStorage.setItem("shoppingCart", JSON.stringify(this.list));
- }
- },
- verification() {
-
- if (!this.langShow) {
- if (!this.receipt.name) {
- this.$message.error(
- this.$t("checkout.Name") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.receipt.tel) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.$util.isMobile(this.receipt.tel)) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.IncorrectFormat")
- );
- return false;
- } else if (!this.receipt.company) {
- this.$message.error(
- this.$t("checkout.Institute") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.receipt.province) {
- this.$message.error("请选择省份");
- return false;
- } else if (!this.receipt.city) {
- this.$message.error("请选择市");
- return false;
- } else if (!this.receipt.address) {
- this.$message.error(
- this.$t("checkout.Addre") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.receipt.postalCode) {
- this.$message.error(
- this.$t("checkout.postal") + this.$t("message.notEmpty")
- );
- return false;
- } else {
- return true;
- }
- } else {
- if (!this.receipt.name) {
- this.$message.error(
- this.$t("checkout.Name") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.receipt.tel) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.$util.isMobile(this.receipt.tel)) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.IncorrectFormat")
- );
- return false;
- } else if (!this.receipt.company) {
- this.$message.error(
- this.$t("checkout.Institute") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.receipt.country) {
- this.$message.error(
- this.$t("message.PleaseSelects") + this.$t("order.country")
- );
- return false;
- } else if (!this.receipt.address) {
- this.$message.error(
- this.$t("checkout.Addre") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.receipt.postalCode) {
- this.$message.error(
- this.$t("checkout.postal") + this.$t("message.notEmpty")
- );
- return false;
- } else {
- return true;
- }
- }
- },
- billVerification() {
-
- if (!this.langShow) {
- if (!this.bill.name) {
- this.$message.error(
- this.$t("checkout.Name") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.bill.tel) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.$util.isMobile(this.bill.tel)) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.IncorrectFormat")
- );
- return false;
- } else if (!this.bill.company) {
- this.$message.error(
- this.$t("checkout.Institute") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.bill.province) {
- this.$message.error("请选择省份");
- return false;
- } else if (!this.bill.city) {
- this.$message.error("请选择市");
- return false;
- } else if (!this.bill.address) {
- this.$message.error(
- this.$t("checkout.Addre") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.bill.postalCode) {
- this.$message.error(
- this.$t("checkout.postal") + this.$t("message.notEmpty")
- );
- return false;
- } else {
- return true;
- }
- } else {
- if (!this.bill.name) {
- this.$message.error(
- this.$t("checkout.Name") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.bill.tel) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.$util.isMobile(this.bill.tel)) {
- this.$message.error(
- this.$t("checkout.Phone") + this.$t("message.IncorrectFormat")
- );
- return false;
- } else if (!this.bill.company) {
- this.$message.error(
- this.$t("checkout.Institute") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.bill.country) {
- this.$message.error(
- this.$t("message.PleaseSelects") + this.$t("order.country")
- );
- return false;
- } else if (!this.bill.address) {
- this.$message.error(
- this.$t("checkout.Addre") + this.$t("message.notEmpty")
- );
- return false;
- } else if (!this.bill.postalCode) {
- this.$message.error(
- this.$t("checkout.postal") + this.$t("message.notEmpty")
- );
- return false;
- } else {
- return true;
- }
- }
- },
- initialization() {
-
- if (JSON.parse(localStorage.getItem("token"))) {
- var userInfo = JSON.parse(localStorage.getItem("user"));
- this.form.user = userInfo.name;
- this.form.accountType = userInfo.accountType;
- this.form.country = userInfo.country;
- this.form.company = userInfo.company;
- }
- },
- userVerification() {
-
- if (!this.form.email) {
- this.$message.error(
- this.$t("register.Address") + this.$t("register.Cannot")
- );
- return false;
- } else if (!this.$util.isEmail(this.form.email)) {
- this.$message.error(this.$t("input.email") + this.$t("message.email"));
- return false;
- } else {
- return true;
- }
- }
- },
- watch: {
- list(n, o) {
- let that = this;
- this.$nextTick(() => {
- that.selectList = [];
- that.list.forEach(item => {
- if (item.checked) {
- if (that.$refs.appBox.clientWidth > 750) {
- this.$refs.dataTable.toggleRowSelection(item, true);
- that.selectList.push(item.id);
- } else {
- this.$refs.dataTablewx.toggleRowSelection(item, true);
- that.selectList.push(item.id);
- }
- }
- });
- });
- }
- },
- mounted() {},
- created() {
- this.getList();
- this.regionList = region;
- this.province = provinces;
- this.initialization();
- }
- };
- </script>
- <style lang="scss" scoped>
- @media screen and (min-width: 751px) and (max-width: 9999px) {
- .box {
- width: 100%;
- overflow: hidden;
- }
- .topbox_text {
- font-size: 20px;
- margin-bottom: 2.4rem;
- }
- .contentbox {
- width: 100%;
- overflow: hidden;
- }
- .contentbox > .cart_f {
- font-size: 16px;
- padding: 1rem 1rem;
- font-weight: 700;
- font-family: Arial;
- color: #005bab;
- background: #cfe0ef;
- }
- .bottomcontentbox_b {
- width: 100%;
- overflow: hidden;
- padding: 2rem;
- border: 1px solid #dbdbdb;
- background: #ffffff;
- }
- .bottomcontentbox /deep/ {
- border: 1px solid #dbdbdb;
- background: white;
- padding: 1rem;
- margin-bottom: 1.6rem;
- .cart_p {
- // border-bottom:1px solid #DBDBDB;
- p {
- margin-bottom: 1rem;
- font-size: 14px;
- font-weight: 600;
- }
- }
- .el-table {
- .table_header {
- color: #005bab;
- }
- .el-table__body-wrapper {
- .el-table__row {
- .cell {
- .el-icon-delete {
- font-size: 18px;
- color: #005bab;
- font-weight: 600;
- cursor: pointer;
- }
- .el-input-number {
- width: 100% !important;
- line-height: 30px;
- .el-input-number__decrease {
- width: 20px;
- height: 28px;
- top: 50%;
- transform: translateY(-50%);
- .el-icon-minus {
- line-height: 30px;
- }
- }
- .el-input-number__increase {
- width: 20px;
- height: 28px;
- top: 50%;
- transform: translateY(-50%);
- .el-icon-plus {
- margin-top: -10px;
- }
- }
- .el-input {
- .el-input__inner {
- padding: 0 20px;
- height: 30px;
- }
- }
- }
- }
- }
- }
- }
- }
- .input_box /deep/ {
- display: none;
- align-items: center;
- margin: 1rem 0;
- & > span:nth-of-type(1) {
- font-size: 14px;
- float: left;
- // color: #005BAB;
- margin-top: 0.3rem;
- margin-right: 0.5rem;
- }
- & > span:nth-of-type(2) {
- padding: 0 1rem;
- line-height: 2rem;
- height: 2rem;
- border: 1px solid #d3d3d3;
- display: inline-block;
- background: #005bab;
- color: white;
- border-radius: 0.2rem;
- cursor: pointer;
- }
- .catalogInput {
- width: 170px;
- margin-right: 0.5rem;
- .el-input__inner {
- height: 2rem;
- border: 1px solid #d3d3d3;
- float: left;
- border-radius: 0.2rem;
- text-indent: 0.5rem;
- padding: 0 10px;
- }
- }
- }
- .cart_button {
- border-bottom: 1px solid #dbdbdb;
- overflow: hidden;
- button {
- margin: 1rem 0;
- padding: 0.5rem;
- background: #005bab;
- color: white;
- border: none;
- border-radius: 0.2rem;
- float: right;
- cursor: pointer;
- }
- }
- .cart_button_f {
- overflow: hidden;
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- .cart_text {
- font-size: 14px;
- font-weight: 600;
- // float: right;
- color: #005bab;
- margin-top: 1rem;
- span {
- font-weight: 600;
- font-size: 18px;
- }
- }
- button {
- padding: 0.5rem;
- background: #005bab;
- color: white;
- border: none;
- border-radius: 0.2rem;
- margin-top: 0.5rem;
- cursor: pointer;
- // float: right;
- }
- }
- .footer_card {
- line-height: 1.8;
- }
- .table_pmd {
- display: none;
- }
- .footerbox_text {
- display: none;
- }
- .customer_box {
- border: 1px solid #dbdbdb;
- padding: 1rem 2rem;
- .customer {
- .title {
- font-size: 1.2rem;
- color: #331515;
- margin-bottom: 20px;
- font-weight: 600;
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- .required {
- color: red;
- }
- .horizontal {
- width: 60px;
- height: 1px;
- background-color: #bdbdbd;
- margin-left: 10px;
- }
- }
- .checked_b {
- margin: 1rem 0;
- }
- .demo-form-inline /deep/ {
- .el-form-item {
- width: 48%;
- .el-form-item__content {
- width: 60%;
- .el-select {
- width: 100%;
- }
- }
- }
- }
- }
- }
- .checkButtom {
- margin-top: 10px;
- .buttom {
- margin: 1rem 0 0;
- padding: 0.5rem 2rem;
- background: #005bab;
- color: #fff;
- border: none;
- border-radius: 0.2rem;
- float: right;
- cursor: pointer;
- }
- }
- }
- @media screen and (min-width: 0px) and (max-width: 750px) {
- .box {
- width: 100%;
- overflow: hidden;
- }
- .topbox_text {
- font-size: 0.18rem;
- margin-bottom: 0.2rem;
- }
- .contentbox {
- width: 100%;
- overflow: hidden;
- }
- .contentbox > .cart_f {
- font-size: 0.16rem;
- padding: 0.2rem 0.14rem;
- font-weight: 700;
- font-family: Arial;
- color: #005bab;
- background: #cfe0ef;
- }
- .bottomcontentbox_b {
- margin-top: 0.2rem;
- width: 100%;
- overflow: hidden;
- padding: 0.08rem 0.14rem;
- border: 1px solid #dbdbdb;
- background: #ffffff;
- }
- .bottomcontentbox /deep/ {
- // margin-top: 0.12rem;
- // padding: 0rem 0.14rem;
- overflow: hidden;
- .table_boxf {
- display: none;
- }
- // 将el-table的展开图标替换为其他图标
- .el-table__expand-icon {
- width: 0.2rem;
- height: 0.2rem;
- margin: 0 auto;
- border-radius: 4px;
- -webkit-transform: rotate(90deg);
- transform: rotate(90deg);
- background: #005bab;
- color: #ffffff;
- }
- .el-table__expand-icon .el-icon-arrow-right:before {
- content: "\";
- border: 1px solid #ccc;
- // padding: 2px;
- border: none;
- }
- .el-table__expand-icon--expanded .el-icon-arrow-right:before {
- content: "\";
- }
- .el-table__cell {
- padding: 0;
- .el-form-item {
- margin: 0;
- width: 100%;
- border-bottom: 1px solid #dbdbdb;
- display: flex;
- .el-form-item__label {
- width: 40%;
- padding-left: 0.2rem;
- border-right: 1px solid #dbdbdb;
- }
- .el-form-item__content {
- width: 60%;
- padding-left: 0.2rem;
- background: #f0f5fa;
- .el-icon-delete {
- color: #005bab;
- }
- }
- }
- }
- .el-table {
- border: 1px solid #dfdfdf;
- margin-top: 0.12rem !important ;
- // margin-bottom:0.14rem !important ;
- .el-table__header-wrapper {
- width: 100%;
- .el-table__header {
- width: 100% !important;
- colgroup {
- // col{
- // width: 20% !important;
- // }
- col:nth-of-type(1) {
- width: 10% !important;
- }
- col:nth-of-type(2) {
- width: 15% !important;
- }
- col:nth-of-type(3) {
- width: 20% !important;
- }
- col:nth-of-type(4) {
- width: 15% !important;
- }
- col:nth-of-type(5) {
- width: 25% !important;
- }
- col:nth-of-type(6) {
- width: 15% !important;
- }
- }
- thead {
- tr {
- width: 60px !important;
- th {
- width: 60px !important;
- .cell {
- font-size: 12px;
- padding: 0 4px;
- font-family: Arial;
- font-weight: bold;
- color: #005bab;
- }
- }
- }
- }
- }
- }
- .el-table__body-wrapper {
- .el-table__body {
- width: 100% !important;
- colgroup {
- width: 100% !important;
- col:nth-of-type(1) {
- width: 10% !important;
- }
- col:nth-of-type(2) {
- width: 15% !important;
- }
- col:nth-of-type(3) {
- width: 20% !important;
- }
- col:nth-of-type(4) {
- width: 15% !important;
- }
- col:nth-of-type(5) {
- width: 25% !important;
- }
- col:nth-of-type(6) {
- width: 15% !important;
- }
- }
- tbody {
- .el-table__row {
- .el-table__cell {
- &:nth-of-type(2) {
- .cell {
- font-family: Arial;
- color: #005bab;
- }
- }
- .cell {
- font-size: 12px;
- padding: 0 4px;
- line-height: 0.24rem;
- .size_data {
- .size_q {
- width: 40% !important;
- max-width: 100px;
- .el-input__inner {
- width: 100% !important;
- }
- }
- .el-select {
- max-width: 100px;
- width: 60% !important;
- .el-input__inner {
- padding-right: 16px;
- }
- .el-input__suffix {
- .el-select__caret {
- width: 16px;
- }
- }
- }
- }
- .el-input-number {
- .el-input-number__decrease {
- width: 0.16rem;
- }
- .el-input-number__increase {
- width: 0.16rem;
- }
- }
- }
- }
- }
- }
- }
- }
- .el-table__empty-block {
- width: 100% !important;
- }
- }
- .size_data {
- display: flex;
- align-items: center;
- .size_q {
- width: 0.4rem;
- .el-input__inner {
- height: 0.24rem;
- border: 1px solid #dfdfdf;
- line-height: 0.24rem;
- padding: 0 0.03rem;
- width: 0.4rem;
- // border-radius: 0.2rem;
- }
- }
- .el-select {
- width: 0.6rem;
- .el-input__inner {
- height: 0.24rem;
- line-height: 0.24rem;
- padding-left: 0.05rem;
- }
- .el-input__icon {
- line-height: 0.24rem;
- }
- }
- }
- .el-input-number {
- width: 100%;
- .el-input-number__decrease {
- width: 0.24rem;
- height: 0.22rem;
- line-height: 0.22rem;
- top: 7px;
- }
- .el-input-number__increase {
- width: 0.24rem;
- height: 0.22rem;
- line-height: 0.22rem;
- top: 7px;
- }
- .el-input {
- .el-input__inner {
- height: 0.26rem;
- line-height: 0.26rem;
- padding: 0 0.24rem;
- border: 1px solid #dfdfdf;
- &:focus {
- border: 1px solid #dfdfdf;
- }
- }
- }
- }
- }
- .input_box /deep/ {
- display: flex;
- align-items: center;
- & > span:nth-of-type(1) {
- font-size: 0.12rem;
- float: left;
- color: #005bab;
- margin-right: 0.1rem;
- }
- & > span:nth-of-type(2) {
- // padding: 0 1rem;
- line-height: 0.28rem;
- height: 0.28rem;
- border: 1px solid #d3d3d3;
- // float: left;
- display: inline-block;
- background: #005bab;
- color: white;
- cursor: pointer;
- padding: 0 0.1rem;
- }
- .catalogInput {
- width: 1rem;
- .el-input__inner {
- height: 0.28rem;
- line-height: 0.28rem;
- // border: none;
- float: left;
- padding: 0 0.1rem;
- }
- }
- }
- .cart_button {
- border-bottom: 1px solid #dbdbdb;
- overflow: hidden;
- margin-bottom: 0.2rem;
- button {
- width: 100%;
- margin: 0.2rem 0;
- height: 0.4rem;
- background: #005bab;
- color: white;
- border: none;
- border-radius: 4px;
- font-size: 0.18rem;
- }
- }
- .cart_button_f {
- overflow: hidden;
- display: flex;
- flex-direction: column;
- // align-items: flex-end;
- .cart_text {
- font-size: 0.16rem;
- font-weight: 600;
- margin-bottom: 0.08rem;
- color: #005bab;
- span {
- font-weight: 600;
- font-size: 0.22rem;
- }
- }
- button {
- width: 100%;
- height: 0.4rem;
- background: #005bab;
- color: white;
- border: none;
- border-radius: 4px;
- margin-top: 0.16rem;
- font-size: 0.18rem;
- margin-bottom: 0.22rem;
- }
- }
- .footer_card {
- display: none;
- }
- .footerbox_text {
- margin-top: 0.2rem;
- .footer_text {
- font-size: 0.14rem;
- line-height: 1.8;
- word-wrap: break-word;
- word-break: normal;
- }
- }
- .customer_box {
- border: 1px solid #dbdbdb;
- padding: 0.1rem 0.1rem;
- .customer {
- .title {
- font-size: 0.12rem;
- color: #331515;
- margin-bottom: 20px;
- font-weight: 600;
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- // white-space: nowrap;
- .required {
- color: red;
- }
- .horizontal {
- width: 60px;
- height: 1px;
- background-color: #bdbdbd;
- margin-left: 10px;
- }
- }
- .checked_b {
- margin: 0.1rem 0;
- }
- .demo-form-inline /deep/ {
- .el-form-item {
- width: 100%;
- display: flex;
- .el-form-item__content {
- flex: 1;
- .el-select {
- width: 100%;
- }
- }
- }
- }
- }
- }
- .checkButtom {
- margin-top: 10px;
- .buttom {
- width: 100%;
- padding: 0.12rem;
- background: #005bab;
- color: #fff;
- border: none;
- border-radius: 0.1rem;
- cursor: pointer;
- }
- }
- }
- </style>
|