商品收藏,我的足迹 增加加入购物车操作
parent
aa7d03c7ce
commit
8466aa76bf
|
|
@ -14,6 +14,7 @@
|
|||
"save": "Preserve",
|
||||
"add": "Add",
|
||||
"del": "Delete",
|
||||
"del_record": "Delete record",
|
||||
"edit": "Edit",
|
||||
"link": "Link",
|
||||
"gift": "Gift",
|
||||
|
|
@ -1453,11 +1454,6 @@
|
|||
"wkfi45": "Please enter data"
|
||||
}
|
||||
},
|
||||
"user-goods-browse": {
|
||||
"user-goods-browse": {
|
||||
"rx8t1v": "Cannot be restored after deletion?, Are you sure to continue?"
|
||||
}
|
||||
},
|
||||
"user-order": {
|
||||
"user-order": {
|
||||
"twc3r7": "comment",
|
||||
|
|
@ -1583,6 +1579,7 @@
|
|||
"3v6ulk": "After choosing for so long, do you really want to delete it?",
|
||||
"8q2yej": "Please slide the data you want to operate on first",
|
||||
"9g81jk": "Data does not exist",
|
||||
"87rfg3": "Cancel collection",
|
||||
"346c25": "Collection successful",
|
||||
"21051p": "Collection failed",
|
||||
"3sy0mp": "Please select the product first"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
"save": "保存",
|
||||
"add": "新增",
|
||||
"del": "删除",
|
||||
"del_record": "删除记录",
|
||||
"edit": "编辑",
|
||||
"link": "链接",
|
||||
"gift": "礼物",
|
||||
|
|
@ -1445,11 +1446,6 @@
|
|||
"wkfi45": "请输入数据"
|
||||
}
|
||||
},
|
||||
"user-goods-browse": {
|
||||
"user-goods-browse": {
|
||||
"rx8t1v": "删除后不可恢复?,确定继续吗?"
|
||||
}
|
||||
},
|
||||
"user-order": {
|
||||
"user-order": {
|
||||
"twc3r7": "评论",
|
||||
|
|
@ -1575,7 +1571,8 @@
|
|||
"3v6ulk": "挑了这么久,真的要删除吗?",
|
||||
"8q2yej": "请先滑动要操作的数据",
|
||||
"9g81jk": "数据不存在",
|
||||
"346c25": "收藏成功",
|
||||
"87rfg3": "取消收藏",
|
||||
"346c25": "收藏成功",
|
||||
"21051p": "收藏失败",
|
||||
"3sy0mp": "请先选择商品"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@
|
|||
uni.setStorageSync(cache_key, upd_data);
|
||||
|
||||
// 是否需要重新加载数据
|
||||
if (parseInt(this.data.is_result_data_cache || 0) == 1) {
|
||||
if (parseInt(data.is_result_data_cache || 0) == 1) {
|
||||
this.get_data({ is_cache: 0 });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,4 @@
|
|||
.goods-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
.operate-submit {
|
||||
right: 20rpx;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<view :data-value="item.goods_url" @tap="url_event" class="cp">
|
||||
<image class="goods-image fl radius" :src="item.images" mode="aspectFill"></image>
|
||||
<view class="goods-base">
|
||||
<view class="goods-title multi-text">{{item.title}}</view>
|
||||
<view class="goods-title multi-text padding-right-xxxxl">{{item.title}}</view>
|
||||
<view class="oh margin-top-sm">
|
||||
<block v-if="(item.show_field_price_status || 0) == 1">
|
||||
<text class="sales-price">{{item.show_price_symbol}}{{item.price}}</text>
|
||||
|
|
@ -15,8 +15,16 @@
|
|||
<text v-if="(item.show_field_original_price_status || 0) == 1 && item.original_price > 0" class="original-price margin-left">{{item.show_price_symbol}}{{item.original_price}}{{item.show_original_price_unit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="dis-inline-block pa top-xxxxl right-xxxxl" @tap="cancel_event" :data-value="item.goods_id" :data-index="index">
|
||||
<iconfont name="icon-ellipsis" size="40rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
<view v-if="(item.is_error || 0) == 0" class="dis-inline-block pa right-xxxxl bottom-xxxxl" :data-index="index" @tap.stop="goods_cart_event">
|
||||
<iconfont name="icon-cart-inc" size="40rpx" :color="theme_color"></iconfont>
|
||||
<view class="pa top-0-xxxl right-xs">
|
||||
<component-badge :propNumber="item.user_cart_count || 0"></component-badge>
|
||||
</view>
|
||||
</view>
|
||||
<button class="br-yellow cr-yellow bg-white fr round pa operate-submit" type="default" size="mini" @tap="cancel_event" :data-value="item.goods_id" :data-index="index" hover-class="none">{{$t('common.cancel')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
|
|
@ -25,7 +33,10 @@
|
|||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<!-- 商品购买 -->
|
||||
<component-goods-buy ref="goods_buy" v-on:CartSuccessEvent="goods_cart_back_event"></component-goods-buy>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 公共 -->
|
||||
|
|
@ -36,11 +47,14 @@
|
|||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from "@/components/no-data/no-data";
|
||||
import componentBottomLine from "@/components/bottom-line/bottom-line";
|
||||
import componentBottomLine from "@/components/bottom-line/bottom-line";
|
||||
import componentBadge from '@/components/badge/badge';
|
||||
import componentGoodsBuy from '@/components/goods-buy/goods-buy';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_color: app.globalData.get_theme_color(),
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
|
|
@ -56,7 +70,9 @@
|
|||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine
|
||||
componentBottomLine,
|
||||
componentBadge,
|
||||
componentGoodsBuy
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
|
|
@ -216,60 +232,93 @@
|
|||
},
|
||||
|
||||
// 取消
|
||||
cancel_event(e) {
|
||||
uni.showModal({
|
||||
title: this.$t('common.warm_tips'),
|
||||
content: this.$t('order.order.pn78ns'),
|
||||
confirmText: this.$t('common.confirm'),
|
||||
cancelText: this.$t('recommend-list.recommend-list.w9460o'),
|
||||
success: result => {
|
||||
if (result.confirm) {
|
||||
// 参数
|
||||
var id = e.currentTarget.dataset.value;
|
||||
var index = e.currentTarget.dataset.index;
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.processing_in_text')
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("cancel", "usergoodsfavor"),
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = this.data_list;
|
||||
temp_data_list.splice(index, 1);
|
||||
this.setData({
|
||||
data_list: temp_data_list
|
||||
});
|
||||
if (temp_data_list.length == 0) {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
cancel_event(e) {
|
||||
var self = this;
|
||||
wx.showActionSheet({
|
||||
itemList: [self.$t('cart.cart.87rfg3')],
|
||||
success (res) {
|
||||
// 参数
|
||||
var id = e.currentTarget.dataset.value;
|
||||
var index = e.currentTarget.dataset.index;
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: self.$t('common.processing_in_text')
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("cancel", "usergoodsfavor"),
|
||||
method: 'POST',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = self.data_list;
|
||||
temp_data_list.splice(index, 1);
|
||||
self.setData({
|
||||
data_list: temp_data_list
|
||||
});
|
||||
if (temp_data_list.length == 0) {
|
||||
self.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast(self.$t('common.sub_error_retry_tips'));
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(self.$t('common.internet_error_tips'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 加入购物车
|
||||
goods_cart_event(e) {
|
||||
if ((this.$refs.goods_buy || null) != null) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var goods = this.data_list[index];
|
||||
goods['id'] = goods.goods_id;
|
||||
this.$refs.goods_buy.init(
|
||||
goods,
|
||||
{
|
||||
buy_event_type: 'cart',
|
||||
is_direct_cart: 1,
|
||||
},
|
||||
{
|
||||
index: index,
|
||||
pos: e,
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// 加入购物车成功回调
|
||||
goods_cart_back_event(e) {
|
||||
// 增加数量
|
||||
var back = e.back_data;
|
||||
var temp_data_list = this.data_list;
|
||||
var goods = temp_data_list[back.index];
|
||||
goods['user_cart_count'] = parseInt(goods['user_cart_count'] || 0) + parseInt(e.stock);
|
||||
if (goods['user_cart_count'] > 99) {
|
||||
goods['user_cart_count'] = '99+';
|
||||
}
|
||||
temp_data_list[back.index] = goods;
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
});
|
||||
// 购物车导航角标
|
||||
app.globalData.set_tab_bar_badge('cart', e.cart_number || 0);
|
||||
},
|
||||
|
||||
// url事件
|
||||
|
|
|
|||
|
|
@ -5,8 +5,4 @@
|
|||
.goods-image {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
}
|
||||
.operate-submit {
|
||||
right: 20rpx;
|
||||
bottom: 20rpx;
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
<view :data-value="item.goods_url" @tap="url_event" class="cp">
|
||||
<image class="goods-image fl radius" :src="item.images" mode="aspectFill"></image>
|
||||
<view class="goods-base">
|
||||
<view class="goods-title multi-text">{{item.title}}</view>
|
||||
<view class="goods-title multi-text padding-right-xxxxl">{{item.title}}</view>
|
||||
<view class="oh margin-top-sm">
|
||||
<block v-if="(item.show_field_price_status || 0) == 1">
|
||||
<text class="sales-price">{{item.show_price_symbol}}{{item.price}}</text>
|
||||
|
|
@ -15,8 +15,16 @@
|
|||
<text v-if="(item.show_field_original_price_status || 0) == 1 && item.original_price > 0" class="original-price margin-left">{{item.show_price_symbol}}{{item.original_price}}{{item.show_original_price_unit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="dis-inline-block pa top-xxxxl right-xxxxl" @tap="delete_event" :data-value="item.id" :data-index="index">
|
||||
<iconfont name="icon-ellipsis" size="40rpx" color="#999"></iconfont>
|
||||
</view>
|
||||
<view v-if="(item.is_error || 0) == 0" class="dis-inline-block pa right-xxxxl bottom-xxxxl" :data-index="index" @tap.stop="goods_cart_event">
|
||||
<iconfont name="icon-cart-inc" size="40rpx" :color="theme_color"></iconfont>
|
||||
<view class="pa top-0-xxxl right-xs">
|
||||
<component-badge :propNumber="item.user_cart_count || 0"></component-badge>
|
||||
</view>
|
||||
</view>
|
||||
<button class="br-red cr-red bg-white round text-size-xs pa operate-submit" type="default" size="mini" @tap="delete_event" :data-value="item.id" :data-index="index" hover-class="none">{{$t('common.del')}}</button>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
|
|
@ -25,7 +33,10 @@
|
|||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<!-- 商品购买 -->
|
||||
<component-goods-buy ref="goods_buy" v-on:CartSuccessEvent="goods_cart_back_event"></component-goods-buy>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 公共 -->
|
||||
|
|
@ -36,11 +47,14 @@
|
|||
const app = getApp();
|
||||
import componentCommon from '@/components/common/common';
|
||||
import componentNoData from "@/components/no-data/no-data";
|
||||
import componentBottomLine from "@/components/bottom-line/bottom-line";
|
||||
import componentBottomLine from "@/components/bottom-line/bottom-line";
|
||||
import componentBadge from '@/components/badge/badge';
|
||||
import componentGoodsBuy from '@/components/goods-buy/goods-buy';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_view: app.globalData.get_theme_value_view(),
|
||||
theme_color: app.globalData.get_theme_color(),
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
|
|
@ -56,7 +70,9 @@
|
|||
components: {
|
||||
componentCommon,
|
||||
componentNoData,
|
||||
componentBottomLine
|
||||
componentBottomLine,
|
||||
componentBadge,
|
||||
componentGoodsBuy
|
||||
},
|
||||
|
||||
onLoad(params) {
|
||||
|
|
@ -216,60 +232,93 @@
|
|||
},
|
||||
|
||||
// 删除
|
||||
delete_event(e) {
|
||||
uni.showModal({
|
||||
title: this.$t('common.warm_tips'),
|
||||
content: this.$t('user-goods-browse.user-goods-browse.rx8t1v'),
|
||||
confirmText: this.$t('common.confirm'),
|
||||
cancelText: this.$t('recommend-list.recommend-list.w9460o'),
|
||||
success: result => {
|
||||
if (result.confirm) {
|
||||
// 参数
|
||||
var id = e.currentTarget.dataset.value;
|
||||
var index = e.currentTarget.dataset.index;
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: this.$t('common.processing_in_text')
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("delete", "usergoodsbrowse"),
|
||||
method: 'POST',
|
||||
data: {
|
||||
ids: id
|
||||
},
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = this.data_list;
|
||||
temp_data_list.splice(index, 1);
|
||||
this.setData({
|
||||
data_list: temp_data_list
|
||||
delete_event(e) {
|
||||
var self = this;
|
||||
wx.showActionSheet({
|
||||
itemList: [self.$t('common.del_record')],
|
||||
success (res) {
|
||||
// 参数
|
||||
var id = e.currentTarget.dataset.value;
|
||||
var index = e.currentTarget.dataset.index;
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: self.$t('common.processing_in_text')
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("delete", "usergoodsbrowse"),
|
||||
method: 'POST',
|
||||
data: {
|
||||
ids: id
|
||||
},
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
if (res.data.code == 0) {
|
||||
var temp_data_list = self.data_list;
|
||||
temp_data_list.splice(index, 1);
|
||||
self.setData({
|
||||
data_list: temp_data_list
|
||||
});
|
||||
if (temp_data_list.length == 0) {
|
||||
self.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
if (temp_data_list.length == 0) {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast(this.$t('common.sub_error_retry_tips'));
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(this.$t('common.internet_error_tips'));
|
||||
app.globalData.showToast(res.data.msg, 'success');
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data)) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
} else {
|
||||
app.globalData.showToast(self.$t('common.sub_error_retry_tips'));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
app.globalData.showToast(self.$t('common.internet_error_tips'));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 加入购物车
|
||||
goods_cart_event(e) {
|
||||
if ((this.$refs.goods_buy || null) != null) {
|
||||
var index = e.currentTarget.dataset.index || 0;
|
||||
var goods = this.data_list[index];
|
||||
goods['id'] = goods.goods_id;
|
||||
this.$refs.goods_buy.init(
|
||||
goods,
|
||||
{
|
||||
buy_event_type: 'cart',
|
||||
is_direct_cart: 1,
|
||||
},
|
||||
{
|
||||
index: index,
|
||||
pos: e,
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// 加入购物车成功回调
|
||||
goods_cart_back_event(e) {
|
||||
// 增加数量
|
||||
var back = e.back_data;
|
||||
var temp_data_list = this.data_list;
|
||||
var goods = temp_data_list[back.index];
|
||||
goods['user_cart_count'] = parseInt(goods['user_cart_count'] || 0) + parseInt(e.stock);
|
||||
if (goods['user_cart_count'] > 99) {
|
||||
goods['user_cart_count'] = '99+';
|
||||
}
|
||||
temp_data_list[back.index] = goods;
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
});
|
||||
// 购物车导航角标
|
||||
app.globalData.set_tab_bar_badge('cart', e.cart_number || 0);
|
||||
},
|
||||
|
||||
// url事件
|
||||
|
|
|
|||
Loading…
Reference in New Issue