...
|
...
|
@@ -20,49 +20,50 @@ Page({ |
|
|
delshow: false,
|
|
|
video_attr: [],
|
|
|
goucartid: [],
|
|
|
footersel:3,
|
|
|
type:1,
|
|
|
shouwrap:false,
|
|
|
|
|
|
footersel: 3,
|
|
|
type: 1,
|
|
|
shouwrap: false,
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
|
|
|
onLoad: function (options) {
|
|
|
|
|
|
},
|
|
|
|
|
|
yuyue(){
|
|
|
yuyue() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/qujingdi/qujingdi',
|
|
|
})
|
|
|
},
|
|
|
//合并使用
|
|
|
hejisuan(){
|
|
|
if(this.data.video_id.length==0){
|
|
|
wx.showToast({
|
|
|
title: '请选择视频',
|
|
|
icon:'none'
|
|
|
})
|
|
|
}else{
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/sucaishenqing/sucaishenqing?videoid='+ JSON.stringify(this.data.video_id)
|
|
|
//合并使用
|
|
|
hejisuan() {
|
|
|
if (this.data.video_id.length == 0) {
|
|
|
wx.showToast({
|
|
|
title: '请选择视频',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/yonghuxieyi/yonghuxieyi?videoid=' + JSON.stringify(this.data.video_id)
|
|
|
// url: '/pages/sucaishenqing/sucaishenqing?videoid='+ JSON.stringify(this.data.video_id)
|
|
|
})
|
|
|
// this.setData({
|
|
|
// shouwrap:true
|
|
|
// })
|
|
|
}
|
|
|
|
|
|
},
|
|
|
// 取消合并使用
|
|
|
cancel() {
|
|
|
this.setData({
|
|
|
shouwrap: false
|
|
|
})
|
|
|
// this.setData({
|
|
|
// shouwrap:true
|
|
|
// })
|
|
|
}
|
|
|
|
|
|
},
|
|
|
// 取消合并使用
|
|
|
cancel(){
|
|
|
this.setData({
|
|
|
shouwrap:false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
// 视频详情
|
|
|
|
|
|
videodetail(e) {
|
...
|
...
|
@@ -79,7 +80,7 @@ cancel(){ |
|
|
})
|
|
|
},
|
|
|
|
|
|
bindPickerChange: function(e) {
|
|
|
bindPickerChange: function (e) {
|
|
|
let newdiannum = this.data.diannum;
|
|
|
newdiannum++;
|
|
|
this.setData({
|
...
|
...
|
@@ -117,7 +118,7 @@ cancel(){ |
|
|
|
|
|
let tt = 0;
|
|
|
let newtotalmoney = this.data.totalmoney;
|
|
|
|
|
|
|
|
|
|
|
|
let pp = this.data.pp;
|
|
|
pp.push(Number(newcartlist[index].videoprice));
|
...
|
...
|
@@ -147,7 +148,7 @@ cancel(){ |
|
|
})
|
|
|
}
|
|
|
|
|
|
let newhebing=this.data.hebing;
|
|
|
let newhebing = this.data.hebing;
|
|
|
|
|
|
for (var i = 0; i < newcartlist.length; i++) {
|
|
|
for (var j = 0; j < newhebing.length; j++) {
|
...
|
...
|
@@ -156,19 +157,14 @@ cancel(){ |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// newcartlist[index].cartindex = e.detail.value;
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
cartlist: newcartlist,
|
|
|
hebing:newhebing
|
|
|
hebing: newhebing
|
|
|
|
|
|
})
|
|
|
|
|
|
console.log(this.data.cartlist);
|
|
|
console.log(this.data.hebing)
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
//获取购物车列表
|
...
|
...
|
@@ -178,16 +174,15 @@ cancel(){ |
|
|
|
|
|
app.post(url, '', 'post').then((res) => {
|
|
|
console.log(res)
|
|
|
let info=res.info
|
|
|
info.forEach(function(value,index,array){
|
|
|
value.sel=false
|
|
|
let info = res.info
|
|
|
info.forEach(function (value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
|
|
|
that.setData({
|
|
|
cartlist:info
|
|
|
cartlist: info
|
|
|
})
|
|
|
}).catch((err) => {
|
|
|
})
|
|
|
}).catch((err) => {})
|
|
|
},
|
|
|
|
|
|
// 选择购物车
|
...
|
...
|
@@ -200,7 +195,7 @@ cancel(){ |
|
|
icon: 'none'
|
|
|
})
|
|
|
|
|
|
setTimeout(function() {
|
|
|
setTimeout(function () {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/index/index',
|
|
|
})
|
...
|
...
|
@@ -208,20 +203,20 @@ cancel(){ |
|
|
} else {
|
|
|
console.log(e)
|
|
|
let cartid = e.currentTarget.dataset.cartid;
|
|
|
let newcartlist=this.data.cartlist;
|
|
|
let newcartlist = this.data.cartlist;
|
|
|
let newvideo_id = this.data.video_id;
|
|
|
for (var obj of newcartlist) {
|
|
|
if (obj.video_id == cartid) {
|
|
|
obj.sel = !obj.sel;
|
|
|
if (obj.sel == true) {
|
|
|
newvideo_id.push(obj.video_id);
|
|
|
} else if (obj.sel == false ) {
|
|
|
for(var i=0;i<newvideo_id.length;i++){
|
|
|
if (newvideo_id[i]==cartid){
|
|
|
newvideo_id.splice(i,1);
|
|
|
} else if (obj.sel == false) {
|
|
|
for (var i = 0; i < newvideo_id.length; i++) {
|
|
|
if (newvideo_id[i] == cartid) {
|
|
|
newvideo_id.splice(i, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -239,7 +234,7 @@ cancel(){ |
|
|
cartlist: newcartlist,
|
|
|
video_id: newvideo_id,
|
|
|
})
|
|
|
console.log(that.data.video_id,'999999')
|
|
|
console.log(that.data.video_id, '999999')
|
|
|
}
|
|
|
|
|
|
},
|
...
|
...
|
@@ -253,17 +248,17 @@ cancel(){ |
|
|
icon: 'none'
|
|
|
})
|
|
|
|
|
|
setTimeout(function() {
|
|
|
setTimeout(function () {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/index/index',
|
|
|
})
|
|
|
}, 1500)
|
|
|
}else{
|
|
|
} else {
|
|
|
this.setData({
|
|
|
totalsel: !this.data.totalsel,
|
|
|
video_id:[]
|
|
|
video_id: []
|
|
|
})
|
|
|
|
|
|
|
|
|
let newcartlist = this.data.cartlist;
|
|
|
let newvideo_id = this.data.video_id;
|
|
|
if (this.data.totalsel == true) {
|
...
|
...
|
@@ -275,90 +270,55 @@ cancel(){ |
|
|
for (var obj of newcartlist) {
|
|
|
obj.sel = false;
|
|
|
}
|
|
|
newvideo_id=[]
|
|
|
newvideo_id = []
|
|
|
}
|
|
|
this.setData({
|
|
|
cartlist: newcartlist,
|
|
|
video_id: newvideo_id,
|
|
|
})
|
|
|
|
|
|
|
|
|
console.log('76543', this.data.video_id)
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
delcart() {
|
|
|
let that = this;
|
|
|
if (that.data.totalcartarr.length == 0) {
|
|
|
if (that.data.video_id.length == 0) {
|
|
|
wx.showToast({
|
|
|
title: '请选择要删除的图片或视频',
|
|
|
title: '请选择要删除的视频',
|
|
|
icon: "none"
|
|
|
})
|
|
|
} else {
|
|
|
let url = 'user/delcar';
|
|
|
|
|
|
|
|
|
let param = {
|
|
|
ids: that.data.totalcartarr.join(",")
|
|
|
}
|
|
|
app.post(url, param, 'post').then((res) => {
|
|
|
console.log(res);
|
|
|
|
|
|
let newcartlist = that.data.cartlist;
|
|
|
let newtotalmoney = that.data.totalmoney;
|
|
|
let newtotalcartarr = that.data.totalcartarr;
|
|
|
let money = 0;
|
|
|
for (var i = 0; i < newcartlist.length; i++) {
|
|
|
for (var j = 0; j < newtotalcartarr.length; j++) {
|
|
|
if (newtotalcartarr[j] == newcartlist[i].id) {
|
|
|
console.log(newtotalcartarr[j]);
|
|
|
console.log(newcartlist[i])
|
|
|
if (newcartlist[i].pic_id == null) {
|
|
|
console.log(777)
|
|
|
money = newcartlist[i].videoprice
|
|
|
newtotalmoney = newtotalmoney - money
|
|
|
|
|
|
} else if (newcartlist[i].video_id == null) {
|
|
|
if (newcartlist[i].pic_id.vipprice == undefined) {
|
|
|
money = newcartlist[i].pic_id.price
|
|
|
} else {
|
|
|
money = newcartlist[i].pic_id.vipprice
|
|
|
}
|
|
|
|
|
|
newtotalmoney = newtotalmoney - money
|
|
|
}
|
|
|
wx.showModal({
|
|
|
title: '提示',
|
|
|
content: '是否删除收藏视频',
|
|
|
success(res) {
|
|
|
if (res.confirm) {
|
|
|
let url = 'index/delcar';
|
|
|
let param = {
|
|
|
ids: that.data.video_id.join(",")
|
|
|
}
|
|
|
app.post(url, param, 'post').then((res) => {
|
|
|
console.log(res);
|
|
|
wx.showToast({
|
|
|
title: '删除成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
that.getcartlsit();
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
} else if (res.cancel) {
|
|
|
console.log('用户点击取消')
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
totalmoney: newtotalmoney
|
|
|
})
|
|
|
|
|
|
|
|
|
wx.showToast({
|
|
|
title: '删除购物车成功',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
|
|
|
setTimeout(function() {
|
|
|
that.getcartlsit();
|
|
|
that.setData({
|
|
|
totalcartarr:[],
|
|
|
totalsel: false
|
|
|
})
|
|
|
|
|
|
}, 1000)
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
// 底部导航跳转
|
...
|
...
|
@@ -386,15 +346,15 @@ cancel(){ |
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function() {
|
|
|
onReady: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
let that=this;
|
|
|
onShow: function () {
|
|
|
let that = this;
|
|
|
this.getcartlsit();
|
|
|
this.setData({
|
|
|
totalmoney: 0,
|
...
|
...
|
@@ -409,34 +369,34 @@ cancel(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function() {
|
|
|
onHide: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
onUnload: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function() {
|
|
|
onPullDownRefresh: function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function() {
|
|
|
onReachBottom: function () {
|
|
|
|
|
|
},
|
|
|
|
...
|
...
|
@@ -444,7 +404,7 @@ cancel(){ |
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
}
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|