123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- // 统计数据
- // 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
- import Vue from 'vue'
- const cartMixins = {
- data() {
- return {
- delSkuIds:''
- }
- },
- methods: {
- hanldlerToConfirm() {
- //跳转确认订单页面
- let skuIds = ''
- this.isNoConfim = false
- this.goodsList.forEach(supper => {
- supper.cartList.forEach(pros => {
- if (pros.isChecked) {
- // 获取勾选的商品ID拼接字符串逗号隔开,最后一个逗号去掉
- skuIds += pros.skuId + ','
- // 有商品的购买量没达到最小起订量
- if (pros.number < pros.min) {
- this.isNoConfim = true
- }
- }
- })
- })
- if (skuIds === '') {
- this.$util.msg('请先选择结算商品~', 2000)
- return
- }
- if (this.isNoConfim) {
- this.$util.modal(
- '',
- '有商品的购买量没达到最小起订量,请修改数量后再次提交结算',
- '去修改',
- '',
- false,
- () => {}
- )
- return
- }
- // 友盟埋点购物车去结算点击事件
- let cartSkuIds = { skuIds: skuIds.substring(0, skuIds.lastIndexOf(',')) }
- this.$api.navigateTo(
- `/pages/user/order/create-order?type=2&data=${JSON.stringify({ data: cartSkuIds })}`
- )
- },
- handleBtnConfirm(data) {
- console.log('data', data)
- // 确认重选规格调用 apisMixins -> apiQueryShoppingCartList
- this.apiUserClubCheckSku(data)
- },
- updateShoppogNum(pros) {
- const params = {
- userId: this.userId,
- skuId: pros.skuId,
- productCount: pros.number,
- source: 2
- }
- // 更新购物车调用 apisMixins -> apiQueryShoppingCartList
- this.apiShoppingCartUpdate(params)
- },
- handleDeleteCart() { //删除购物车商品
- this.goodsList.forEach(delitem => {
- delitem.cartList.forEach(pros => {
- if (pros.isChecked) {
- this.delSkuIds += pros.skuId + ','
- }
- })
- })
- this.failureList.forEach(failure => {
- if (failure.isChecked) {
- this.delSkuIds += failure.skuId + ','
- }
- })
- if (this.delSkuIds.length === 0) {
- this.$util.msg('请选择要删除的商品~', 2000)
- return
- }
- this.modal = true
- this.contentModalText = '确定删除选中的商品吗?'
- },
- handleDeletefailures() { // 一键清楚所有失效商品
- this.failureList.forEach(failure => {
- this.delSkuIds += failure.skuId + ','
- })
- this.modal = true
- this.contentModalText = '确定清空全部失效商品吗?'
- }
- }
- }
- export default cartMixins
|