在store里面的cart.js中
import $H from '../../utils/request.js'
//$H相当于定义的一个接口
mutations: {
//删除
delgoods(state) {
state.list = state.list.filter(v => {
// console.log(state.selectedAll.indexOf(v.id));
return state.selectedAll.indexOf(v.id) == -1
})
state.selectedAll = []
},
actions: {
//删除商品
delGoodsCart({state,commit}){
uni.showModal({
title: '提示',
content: '你确定要删除吗',
success: function(res) {
if (res.confirm) {
$H({
url: '/cart/delete', //删除购物车的地址
method: 'POST',
data: {
shop_ids: state.selectedAll.join(',') //id
},
header: {
token: true
}
}).then(res => {
console.log('res11111', res);
c