|
|
|
@ -155,6 +155,17 @@ |
|
|
|
<!-- 底部选项卡 --> |
|
|
|
<view class="footer-fixed"> |
|
|
|
<view class="footer-container"> |
|
|
|
|
|
|
|
<view class="foo-item-price"> |
|
|
|
<view v-if="shopyear_show" class=""> |
|
|
|
<view class="btn-item-year">请输入年限:</view> |
|
|
|
<input class="uni-input btn-item-input" v-model="use_years" maxlength="10" placeholder="请输入年限" v-on:input="ipt()"/> |
|
|
|
</view> |
|
|
|
<view v-if="talprice_show" class="btn-item-addprice" @click="addCart()"> |
|
|
|
<text>合计:¥{{addprice}}元</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="foo-item-fast"> |
|
|
|
<!-- 进入店铺 --> |
|
|
|
<view class="btn-item btn-item-main" @click="goteshop()"> |
|
|
|
@ -169,7 +180,7 @@ |
|
|
|
<view v-if="shopcart_show" class="btn-item btn-item-deputy" @click="addCart()"> |
|
|
|
<text>{{shopcart_str}}</text> |
|
|
|
</view> |
|
|
|
<view v-if="purchase_show" class="btn-item btn-item-main" @click="buyNow()"> |
|
|
|
<view class="btn-item btn-item-main" @click="buyNow()"> |
|
|
|
<text>立即购买</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -242,7 +253,8 @@ |
|
|
|
shopyear_num: '', // 立即购买显示 |
|
|
|
shopcart_str: '加入购物车', |
|
|
|
new_total: 0, // 标的数量 |
|
|
|
|
|
|
|
addprice: 0, // 合计金额 |
|
|
|
use_years: '', // 年限 |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
@ -282,6 +294,7 @@ |
|
|
|
app.new_total = res.data.total |
|
|
|
let imgitem = {"imgurl":app.goods.goods_images} |
|
|
|
app.gdimgs.push(imgitem) |
|
|
|
app.transfer(app.goods.goods_entrust, app.goods.price); //转让 |
|
|
|
// 标的的价格 |
|
|
|
if(app.goods.username == "中国数字文化集团有限公司" || |
|
|
|
app.goods.username == "国家图书馆出版社有限公司" || |
|
|
|
@ -300,6 +313,9 @@ |
|
|
|
app.shopyear_show = true |
|
|
|
app.talprice_show = true |
|
|
|
app.purchase_show = true |
|
|
|
let footer = document.querySelector('.footer-container'); |
|
|
|
// 修改高度值 |
|
|
|
footer.style.height = '100px'; // 修改为 200px |
|
|
|
} else { |
|
|
|
app.ears_of = 3 |
|
|
|
app.shopcart_show = true |
|
|
|
@ -312,7 +328,6 @@ |
|
|
|
item.source_data.metadataFileSize = app.FileSize(item.source_data.metadataFileSize) |
|
|
|
item.source_data.releaseTime = item.source_data.releaseTime.split(" ")[0] |
|
|
|
}) |
|
|
|
console.log(app.goods.source) |
|
|
|
resolve(res) |
|
|
|
}).catch(reject); |
|
|
|
}) |
|
|
|
@ -325,80 +340,153 @@ |
|
|
|
var sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], |
|
|
|
i = Math.floor(Math.log(data) / Math.log(k)); |
|
|
|
return (data / Math.pow(k, i)).toPrecision(3) + " " + sizes[i]; |
|
|
|
}, |
|
|
|
|
|
|
|
// 调整 |
|
|
|
goteshop(){ |
|
|
|
const app = this |
|
|
|
let spname = this.goods.username |
|
|
|
this.$navTo("pages/goods/list?k="+spname+'&dt='+new Date().getTime()) |
|
|
|
}, |
|
|
|
|
|
|
|
// 添加到购物车 |
|
|
|
addCart(){ |
|
|
|
const app = this |
|
|
|
let accessToken = uni.getStorageSync("AccessToken") |
|
|
|
if (accessToken) { |
|
|
|
let isliCode = uni.getStorageSync("isliCode") |
|
|
|
if (isliCode) { |
|
|
|
let userType = uni.getStorageSync("userType") |
|
|
|
if (userType === '0') { |
|
|
|
app.$toast('个人认证账号不能加入购物车') |
|
|
|
} else { |
|
|
|
if (app.ears_of === 2) { |
|
|
|
}, |
|
|
|
ipt(){ |
|
|
|
if (this.use_years) { |
|
|
|
let shopRice = Math.round(parseFloat(this.goods.price * 100 * this.use_years)) / 100; |
|
|
|
this.addprice = shopRice |
|
|
|
} else { |
|
|
|
this.addprice = 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
// 调整 |
|
|
|
goteshop(){ |
|
|
|
const app = this |
|
|
|
let spname = this.goods.username |
|
|
|
this.$navTo("pages/goods/goodsDetail?k="+spname+'&dt='+new Date().getTime()) |
|
|
|
}, |
|
|
|
// 转让 |
|
|
|
transfer(pass_Num,pricets) { |
|
|
|
if (pass_Num == "1") { |
|
|
|
this.shopyear_show = false |
|
|
|
this.addprice = pricets |
|
|
|
this.use_years = 99 |
|
|
|
} |
|
|
|
}, |
|
|
|
// 添加到购物车 |
|
|
|
addCart(){ |
|
|
|
const app = this |
|
|
|
let accessToken = uni.getStorageSync("AccessToken") |
|
|
|
if (accessToken) { |
|
|
|
let isliCode = uni.getStorageSync("isliCode") |
|
|
|
if (isliCode) { |
|
|
|
let userType = uni.getStorageSync("userType") |
|
|
|
if (userType == '0') { |
|
|
|
app.$toast('个人认证账号不能加入购物车') |
|
|
|
} else { |
|
|
|
if (app.ears_of === 2) { |
|
|
|
|
|
|
|
let shopyear_num = app.shopyear_num |
|
|
|
if (shopyear_num === 0 || shopyear_num === '') { |
|
|
|
app.$error('购买年限只能输入整数') |
|
|
|
} else { |
|
|
|
let shopyear_num = app.shopyear_num |
|
|
|
if (shopyear_num === 0 || shopyear_num === '') { |
|
|
|
app.$error('购买年限只能输入整数') |
|
|
|
} else { |
|
|
|
app.shop_goods() |
|
|
|
} |
|
|
|
} |
|
|
|
if (app.ears_of === 3 || app.ears_of === 1) { |
|
|
|
app.shop_goods() |
|
|
|
} |
|
|
|
} |
|
|
|
if (app.ears_of === 3 || app.ears_of === 1) { |
|
|
|
app.shop_goods() |
|
|
|
} |
|
|
|
} else { |
|
|
|
app.$toast('账号未认证,请进行认证!') |
|
|
|
setTimeout(app.jumpMycertinfoUrl,3000) |
|
|
|
} |
|
|
|
} else { |
|
|
|
app.$toast('账号未认证,请进行认证!') |
|
|
|
setTimeout(app.jumpMycertinfoUrl,3000) |
|
|
|
app.$toast("请先登录") |
|
|
|
setTimeout(app.jumpUrl('/pages/login/index'),3000) |
|
|
|
} |
|
|
|
} else { |
|
|
|
app.$toast("请先登录") |
|
|
|
setTimeout(app.jumpUrl('/pages/login/index'),3000) |
|
|
|
} |
|
|
|
}, |
|
|
|
jumpMycertinfoUrl (url) { |
|
|
|
uni.navigateTo({ |
|
|
|
url:'/pages/user/mycertinfo/mycertinfo' |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 发送加入购物车请求 |
|
|
|
shop_goods() { |
|
|
|
const app = this |
|
|
|
let param = { |
|
|
|
goods_isli : app.goods.goods_islicode, |
|
|
|
user_isli : uni.getStorageSync("isliCode"), |
|
|
|
use_years : 0, |
|
|
|
} |
|
|
|
if (app.ears_of === 3) { |
|
|
|
param.use_years = 1 |
|
|
|
} |
|
|
|
GoodsApi.addShoppingCa(param).then(res => { |
|
|
|
console.log(res) |
|
|
|
if (res.resultCode === "00000000") { |
|
|
|
app.$success("加入购物车成功"); |
|
|
|
app.shopcart_str = '已加入购物车' |
|
|
|
} else { |
|
|
|
app.$error(res.errMsg); |
|
|
|
}, |
|
|
|
jumpMycertinfoUrl (url) { |
|
|
|
uni.navigateTo({ |
|
|
|
url:'/pages/user/mycertinfo/mycertinfo' |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 发送加入购物车请求 |
|
|
|
shop_goods() { |
|
|
|
const app = this |
|
|
|
let param = { |
|
|
|
goods_isli : app.goods.goods_islicode, |
|
|
|
user_isli : uni.getStorageSync("isliCode"), |
|
|
|
use_years : 0, |
|
|
|
} |
|
|
|
}).catch() |
|
|
|
}, |
|
|
|
if (app.ears_of === 3) { |
|
|
|
param.use_years = 1 |
|
|
|
} |
|
|
|
GoodsApi.addShoppingCa(param).then(res => { |
|
|
|
if (res.resultCode === "00000000") { |
|
|
|
app.$success("加入购物车成功"); |
|
|
|
app.shopcart_str = '已加入购物车' |
|
|
|
} else { |
|
|
|
app.$error(res.errMsg); |
|
|
|
} |
|
|
|
}).catch() |
|
|
|
}, |
|
|
|
|
|
|
|
//立即购买 |
|
|
|
buyNow(){ |
|
|
|
this.$toast("buy now") |
|
|
|
}, |
|
|
|
//立即购买 |
|
|
|
buyNow() { |
|
|
|
const app = this |
|
|
|
let accessToken = uni.getStorageSync("AccessToken") |
|
|
|
if (accessToken) { |
|
|
|
let isliCode = uni.getStorageSync("isliCode") |
|
|
|
if (isliCode) { |
|
|
|
let userType = uni.getStorageSync("userType") |
|
|
|
if (userType == '0') { |
|
|
|
app.$toast('个人认证账号不能加入购物车') |
|
|
|
} else { |
|
|
|
let type_status = app.goods.goods_status |
|
|
|
let title_Name = app.goods.goods_name; |
|
|
|
let ears_of = app.ears_of |
|
|
|
let addprice = app.addprice |
|
|
|
if (type_status == 0 || type_status == 5) { |
|
|
|
|
|
|
|
if (ears_of == '2') { |
|
|
|
if (addprice) { |
|
|
|
app.Buy_now() |
|
|
|
} else { |
|
|
|
app.$toast('请输入购买年限') |
|
|
|
} |
|
|
|
} |
|
|
|
if (ears_of == "1") { |
|
|
|
|
|
|
|
app.Buy_now() |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (type_status == 5) { |
|
|
|
app.$toast(title_Name + '正在委托中,无法购买') |
|
|
|
} else { |
|
|
|
app.$toast(title_Name + '无法购买') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
app.$toast('账号未认证,请进行认证!') |
|
|
|
setTimeout(app.jumpMycertinfoUrl,3000) |
|
|
|
} |
|
|
|
} else { |
|
|
|
app.$toast("请先登录") |
|
|
|
setTimeout(app.jumpUrl('/pages/login/index'),3000) |
|
|
|
} |
|
|
|
}, |
|
|
|
Buy_now() { |
|
|
|
const app = this |
|
|
|
let param = { |
|
|
|
goods_isli : app.goods.goods_islicode, |
|
|
|
user_isli : uni.getStorageSync("isliCode"), |
|
|
|
is_car : 2, //1:购物车商品;2:不是购物车商品 |
|
|
|
use_years : app.use_years ? app.use_years : 0, |
|
|
|
} |
|
|
|
GoodsApi.createOrder(param).then(res => { |
|
|
|
if (res.resultCode === "00000000") { |
|
|
|
|
|
|
|
// 跳转至付款界面 |
|
|
|
|
|
|
|
this.$navTo('pages/goods/payment', { batchcode:res.data.batchcode, img: app.goods.img, time: new Date().getTime() }) |
|
|
|
} else { |
|
|
|
app.$error(res.errMsg); |
|
|
|
} |
|
|
|
}).catch() |
|
|
|
}, |
|
|
|
// 跳转到首页 |
|
|
|
onTargetHome(e) { |
|
|
|
this.$navTo('pages/index/index') |
|
|
|
|