|
@@ -117,50 +117,31 @@
|
|
|
<section class="productConatiner">
|
|
<section class="productConatiner">
|
|
|
<h3 class="productModelTitle">Product</h3>
|
|
<h3 class="productModelTitle">Product</h3>
|
|
|
<div class="productList">
|
|
<div class="productList">
|
|
|
- <div class="productItem" data-id="购物车商品id1">
|
|
|
|
|
|
|
+ {foreach $list as $cart}
|
|
|
|
|
+ <div class="productItem" data-id="{$cart['id']}" goods-id="{$cart['goods']['goods_id']}"
|
|
|
|
|
+ goods-sku-id="{$cart['goods']['skuInfo']['goods_sku_id']}">
|
|
|
<div class="productImgBox">
|
|
<div class="productImgBox">
|
|
|
<img class="lazy" src="/assets/api/asstes/icon/transparent.png"
|
|
<img class="lazy" src="/assets/api/asstes/icon/transparent.png"
|
|
|
- data-original="https://www.buranshao.com/Content/Img/iqos3duo.jpg" alt="提示信息seo"
|
|
|
|
|
|
|
+ data-original="{$cart['goods']['goods_image']}" alt="提示信息seo"
|
|
|
title="提示信息seo">
|
|
title="提示信息seo">
|
|
|
</div>
|
|
</div>
|
|
|
<div class="productInfo">
|
|
<div class="productInfo">
|
|
|
<div class="lfBox">
|
|
<div class="lfBox">
|
|
|
- <h2 class="productTitle">AAAA VAPES</h2>
|
|
|
|
|
|
|
+ <h2 class="productTitle">{$cart['goods']['goods_name']}</h2>
|
|
|
<p class="specs">specs</p>
|
|
<p class="specs">specs</p>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="nunberBox">
|
|
<div class="nunberBox">
|
|
|
<p class="numberReduce">-</p>
|
|
<p class="numberReduce">-</p>
|
|
|
- <p class="numberInput">1</p>
|
|
|
|
|
|
|
+ <p class="numberInput">{$cart['goods_num']}</p>
|
|
|
<p class="numberAdd">+</p>
|
|
<p class="numberAdd">+</p>
|
|
|
</div>
|
|
</div>
|
|
|
- <p class="productPrice">$99.99</p>
|
|
|
|
|
- <div class="productDelete">
|
|
|
|
|
- <img src="/assets/api/asstes/icon/productDelete.png" alt="">
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="productItem" data-id="购物车商品id2">
|
|
|
|
|
- <div class="productImgBox">
|
|
|
|
|
- <img class="lazy" src="/assets/api/asstes/icon/transparent.png"
|
|
|
|
|
- data-original="https://www.buranshao.com/Content/Img/iqos3duo.jpg" alt="提示信息seo"
|
|
|
|
|
- title="提示信息seo">
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="productInfo">
|
|
|
|
|
- <div class="lfBox">
|
|
|
|
|
- <h2 class="productTitle">AAAA VAPES</h2>
|
|
|
|
|
- <p class="specs">specs</p>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div class="nunberBox">
|
|
|
|
|
- <p class="numberReduce">-</p>
|
|
|
|
|
- <p class="numberInput">1</p>
|
|
|
|
|
- <p class="numberAdd">+</p>
|
|
|
|
|
- </div>
|
|
|
|
|
- <p class="productPrice">$99.99</p>
|
|
|
|
|
|
|
+ <p class="productPrice">${$cart['goods']['goods_price_min']}</p>
|
|
|
<div class="productDelete">
|
|
<div class="productDelete">
|
|
|
<img src="/assets/api/asstes/icon/productDelete.png" alt="">
|
|
<img src="/assets/api/asstes/icon/productDelete.png" alt="">
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ {/foreach}
|
|
|
</div>
|
|
</div>
|
|
|
</section>
|
|
</section>
|
|
|
<!-- 结算模块 -->
|
|
<!-- 结算模块 -->
|
|
@@ -172,13 +153,13 @@
|
|
|
<div class="linkItem">
|
|
<div class="linkItem">
|
|
|
<div class="windInfoBox">
|
|
<div class="windInfoBox">
|
|
|
<p class="key">Subtotal</p>
|
|
<p class="key">Subtotal</p>
|
|
|
- <p class="val">$99.99</p>
|
|
|
|
|
|
|
+ <p class="val">${$cartMoney}</p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="mbItem">
|
|
<div class="mbItem">
|
|
|
<div class="windInfoBox">
|
|
<div class="windInfoBox">
|
|
|
<p class="key">Shipping</p>
|
|
<p class="key">Shipping</p>
|
|
|
- <p class="val">$99.99</p>
|
|
|
|
|
|
|
+ <p class="val">$0.00</p>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="windInfoBox">
|
|
<div class="windInfoBox">
|
|
|
<p class="key">Free shipping</p>
|
|
<p class="key">Free shipping</p>
|
|
@@ -194,7 +175,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="totalBox">
|
|
<div class="totalBox">
|
|
|
<p class="totalT">Total</p>
|
|
<p class="totalT">Total</p>
|
|
|
- <p class="totalVal">$99.99</p>
|
|
|
|
|
|
|
+ <p class="totalVal">${$cartMoney}</p>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="payPalButton">
|
|
<div class="payPalButton">
|
|
|
<span>PayPal</span>
|
|
<span>PayPal</span>
|
|
@@ -293,42 +274,39 @@
|
|
|
<script src="/assets/api/js/jquery.lazyload.js"></script>
|
|
<script src="/assets/api/js/jquery.lazyload.js"></script>
|
|
|
<script>
|
|
<script>
|
|
|
$(document).ready(function () {
|
|
$(document).ready(function () {
|
|
|
- const VAPES_TOKEN = "vapes_token"
|
|
|
|
|
-
|
|
|
|
|
- //未登录处理
|
|
|
|
|
- function isLogin() {
|
|
|
|
|
- //用户token
|
|
|
|
|
- const vapesToken = localStorage.getItem("vapes_token")
|
|
|
|
|
- if (!vapesToken || vapesToken == "") {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- window.location.href = "./login.html?return=1"
|
|
|
|
|
- }, 80)
|
|
|
|
|
- }
|
|
|
|
|
- return vapesToken && vapesToken !== "";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- isLogin()
|
|
|
|
|
|
|
+ // const VAPES_TOKEN = "vapes_token"
|
|
|
|
|
+ //
|
|
|
|
|
+ // //未登录处理
|
|
|
|
|
+ // function isLogin() {
|
|
|
|
|
+ // //用户token
|
|
|
|
|
+ // const vapesToken = localStorage.getItem("vapes_token")
|
|
|
|
|
+ // if (!vapesToken || vapesToken === "") {
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // window.location.href = "./login.html?return=1"
|
|
|
|
|
+ // }, 80)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // return vapesToken && vapesToken !== "";
|
|
|
|
|
+ // }
|
|
|
|
|
+ //
|
|
|
|
|
+ // isLogin();
|
|
|
|
|
|
|
|
//支付方法
|
|
//支付方法
|
|
|
const orderPayment = (params) => {
|
|
const orderPayment = (params) => {
|
|
|
console.log(params)
|
|
console.log(params)
|
|
|
- const vapesToken = localStorage.getItem("vapes_token");
|
|
|
|
|
|
|
+ //const vapesToken = localStorage.getItem("vapes_token");
|
|
|
return new Promise(function (resolve, reject) {
|
|
return new Promise(function (resolve, reject) {
|
|
|
$.ajax({
|
|
$.ajax({
|
|
|
- url: "/api/checkout/submit?payType=30&mode=cart&address_id=2",
|
|
|
|
|
- method: 'POST',
|
|
|
|
|
|
|
+ url: "/index/checkout/submit?payType=30&mode=cart&address_id=2",
|
|
|
|
|
+ method: "POST",
|
|
|
data: JSON.stringify(params),
|
|
data: JSON.stringify(params),
|
|
|
headers: {
|
|
headers: {
|
|
|
- 'Content-Type': 'application/json',
|
|
|
|
|
- 'storeId': '10001',
|
|
|
|
|
- 'platform': 'H5',
|
|
|
|
|
- 'Access-Token': vapesToken,
|
|
|
|
|
- //'Authorization': `Bearer ${vapesToken}`
|
|
|
|
|
|
|
+ "Content-Type": "application/json",
|
|
|
|
|
+ "storeId": "10001",
|
|
|
|
|
+ "platform": "H5",
|
|
|
|
|
+ // "Access-Token": vapesToken
|
|
|
},
|
|
},
|
|
|
- dataType: 'json',
|
|
|
|
|
|
|
+ dataType: "json",
|
|
|
success: function (response) {
|
|
success: function (response) {
|
|
|
- //console.log(response)
|
|
|
|
|
- //var plink = response.data.payment.approval_link;
|
|
|
|
|
resolve(response);
|
|
resolve(response);
|
|
|
},
|
|
},
|
|
|
error: function (xhr, status, error) {
|
|
error: function (xhr, status, error) {
|
|
@@ -347,11 +325,32 @@
|
|
|
*/
|
|
*/
|
|
|
function productOperate(_this, type) {
|
|
function productOperate(_this, type) {
|
|
|
//商品id
|
|
//商品id
|
|
|
- const productId = _this.closest('.productItem').attr('data-id');
|
|
|
|
|
- console.log(productId)
|
|
|
|
|
|
|
+ const productId = _this.closest(".productItem").attr("data-id");
|
|
|
|
|
+ const goodsId = _this.closest(".productItem").attr("goods-id");
|
|
|
|
|
+ const goodsSkuId = _this.closest(".productItem").attr("goods-sku-id");
|
|
|
|
|
+ const goodsNum = 10;
|
|
|
|
|
+ console.log(productId, goodsId, goodsSkuId)
|
|
|
//商品增加
|
|
//商品增加
|
|
|
if (type === "add") {
|
|
if (type === "add") {
|
|
|
console.log("商品增加")
|
|
console.log("商品增加")
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: "/index/cart/update?goodsId=" + goodsId + "&goodsSkuId=" + goodsSkuId + "&goodsNum=" + goodsNum,
|
|
|
|
|
+ method: "POST",
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ "Content-Type": "application/json",
|
|
|
|
|
+ "storeId": "10001",
|
|
|
|
|
+ "platform": "H5",
|
|
|
|
|
+ // "Access-Token": vapesToken
|
|
|
|
|
+ },
|
|
|
|
|
+ dataType: "json",
|
|
|
|
|
+ success: function (response) {
|
|
|
|
|
+ resolve(response);
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function (xhr, status, error) {
|
|
|
|
|
+ reject(error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
//商品减少
|
|
//商品减少
|
|
@@ -361,16 +360,36 @@
|
|
|
}
|
|
}
|
|
|
//商品删除
|
|
//商品删除
|
|
|
if (type === "delete") {
|
|
if (type === "delete") {
|
|
|
|
|
+ var params = {"cartIds": [productId]}
|
|
|
console.log("商品删除")
|
|
console.log("商品删除")
|
|
|
|
|
+ $.ajax({
|
|
|
|
|
+ url: "/index/cart/clear",
|
|
|
|
|
+ method: "POST",
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ "Content-Type": "application/json",
|
|
|
|
|
+ "storeId": "10001",
|
|
|
|
|
+ "platform": "H5",
|
|
|
|
|
+ // "Access-Token": vapesToken
|
|
|
|
|
+ },
|
|
|
|
|
+ data: JSON.stringify(params),
|
|
|
|
|
+ dataType: "json",
|
|
|
|
|
+ success: function (response) {
|
|
|
|
|
+ resolve(response);
|
|
|
|
|
+ window.location.href = "./shoppingCart.html"
|
|
|
|
|
+ },
|
|
|
|
|
+ error: function (xhr, status, error) {
|
|
|
|
|
+ reject(error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//支付
|
|
//支付
|
|
|
$(".payPalButton").on(tap, async function () {
|
|
$(".payPalButton").on(tap, async function () {
|
|
|
- console.log('paypaing')
|
|
|
|
|
|
|
+ console.log("paypaing")
|
|
|
const params = {
|
|
const params = {
|
|
|
- "cartIds": "10002",
|
|
|
|
|
|
|
+ //"cartIds": "10002",
|
|
|
"delivery": 10,
|
|
"delivery": 10,
|
|
|
"address_id": 2
|
|
"address_id": 2
|
|
|
}
|
|
}
|
|
@@ -378,8 +397,8 @@
|
|
|
const res = await orderPayment(params)
|
|
const res = await orderPayment(params)
|
|
|
console.log(res)
|
|
console.log(res)
|
|
|
const {status, data} = res || {}
|
|
const {status, data} = res || {}
|
|
|
- if (status === 200 || status === '200') {
|
|
|
|
|
- window.open(data.payment.approval_link, '_blank');
|
|
|
|
|
|
|
+ if (status === 200 || status === "200") {
|
|
|
|
|
+ window.open(data.payment.approval_link, "_blank");
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -401,10 +420,11 @@
|
|
|
|
|
|
|
|
//前往购物车
|
|
//前往购物车
|
|
|
$(".shoppingCartIcon").on(tap, function () {
|
|
$(".shoppingCartIcon").on(tap, function () {
|
|
|
- const state = isLogin()
|
|
|
|
|
- if (state) {
|
|
|
|
|
- window.location.href = "/api/cart/myCart.html"
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ window.location.href = "./shoppingCart.html"
|
|
|
|
|
+
|
|
|
|
|
+ // const state = isLogin()
|
|
|
|
|
+ // if (state) {
|
|
|
|
|
+ // }
|
|
|
});
|
|
});
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|