123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- // 统计数据
- // 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
- import Vue from 'vue'
- const cartMixins = {
- data() {
- return {
-
- }
- },
- methods: {
- hanldlerToConfirm() {
- //跳转确认订单页面
- let productIdList = [],
- skuIds = ''
- this.goodsList.forEach(supper => {
- supper.cartList.forEach(pros => {
- if (pros.isChecked) {
- productIdList.push(pros.skuId)
- }
- })
- })
- if (productIdList == '') {
- this.$util.msg('请先选择结算商品~', 2000)
- return
- } else {
- //判断勾选的商品是否为充值商品或者为定金商品的一些处理逻辑
- const isHasDepositlds = productIdList.filter(item => this.depositIds.includes(item))
- const isHasRechargeIds = productIdList.filter(item => this.rechargeIds.includes(item))
- const isGoods = productIdList.every(item => {
- ;[...this.depositIds, ...this.rechargeIds].includes(item)
- })
- if (productIdList.length == 1 && isHasDepositlds.length === 1 && isHasRechargeIds.length === 0) {
- console.log('定金商品')
- productIdList.forEach(skuId => {
- skuIds += skuId + ','
- })
- } else if (productIdList.length == 1 && isHasRechargeIds.length === 1 && isHasDepositlds.length === 0) {
- console.log('充值余额商品')
- productIdList.forEach(skuId => {
- skuIds += skuId + ','
- })
- } else if (!isGoods && isHasRechargeIds.length === 0 && isHasDepositlds.length === 0) {
- console.log('正常商品')
- productIdList.forEach(skuId => {
- skuIds += skuId + ','
- })
- } else {
- this.$util.modal('提示', '缴纳订金商品或余额充值商品请单独下单!', '确定', '', false, () => {})
- return
- }
- let cartSkuIds = { skuIds: skuIds.substring(0, skuIds.lastIndexOf(',')) }
- this.$api.navigateTo(`/pages/seller/order/create-order?data=${JSON.stringify({ data: cartSkuIds })}`)
- }
- },
- handleBtnConfirm(data) {
- console.log('data', data)
- // 确认重选规格调用 apisMixins -> apiQueryShoppingCartList
- this.apiUserClubCheckSku(data)
- },
- updateShoppogNum(pros) {
- const params = {
- id: pros.id,
- productCount: pros.number,
- serviceProviderId: this.listQuery.serviceProviderId
- }
- // 更新购物车调用 apisMixins -> apiQueryShoppingCartList
- this.apiSellerAddProductNum(params)
- },
- handleDeleteCart() { //删除购物车商品
- let delCartIds = ''
- this.goodsList.forEach(delitem => {
- delitem.cartList.forEach(pros => {
- if (pros.isChecked) {
- delCartIds += pros.id + ','
- }
- })
- })
- this.failureList.forEach(failure => {
- if (failure.isChecked) {
- delCartIds += failure.id + ','
- }
- })
- if (delCartIds.length == 0) {
- this.$util.msg('请选择要删除的商品~', 2000)
- return
- }
- this.$util.modal('', '确定删除选中的商品吗?', '确定', '取消', true, () => {
- this.apiSellerDeleteCart({ cartIds: delCartIds , serviceProviderId: this.listQuery.serviceProviderId })
- })
- },
- handleDeletefailures() { // 一键删除所有失效商品
- let delCartIds = ''
- this.failureList.forEach(failure => {
- delCartIds += failure.id + ','
- })
- this.$util.modal('', '确定清空全部失效商品吗?', '确定', '取消', true, () => {
- this.apiSellerDeleteCart({ cartIds: delCartIds , serviceProviderId: this.listQuery.serviceProviderId })
- })
- },
- handleFuctionData(){
- this.initGetCartGoodsList()
- }
- }
- }
- export default cartMixins
|