Commit 374b5460 by 朱继来

后台下单调整获取商品接口

parent 9d582539
......@@ -289,11 +289,18 @@ Class AddOrderController extends Controller
if ($request->isMethod('post')) {
$url = Config('website.search-skuid');
$data['sku_id'] = $request->input('sku_id');
$goods_type = $request->input('goods_type');
$response = json_decode(curlApi($url, $data, 'POST'), true);
if (!empty($response['data']['data'])) {
return ['errcode' => 0, 'errmsg' => '', 'data' => $response['data']['data'][$data['sku_id']]];
if ($goods_type == 1) {
$goods_info = $response['data']['sku'];
} else {
$goods_info = $response['data'];
}
if (!empty($goods_info)) {
return ['errcode' => 0, 'errmsg' => '', 'data' => $goods_info];
} else {
return ['errcode' => -1, 'errmsg' => '未找SKU信息'];
}
......
......@@ -51,8 +51,8 @@ return [
'check-user-url' => 'http://member.liexin.net/list',
// 查询SKUID接口
// 'search-skuid' => 'http://footstone.liexin.net/webapi/sku_list',
'search-skuid' => 'http://www.liexin.com/v3/sku/list',
'search-skuid' => 'http://footstone.liexin.net/webapi/goods_details',
// 'search-skuid' => 'http://www.liexin.com/v3/sku/list',
// 新增SKU入口
'add-sku-url' => 'http://footstone.liexin.net/manage/addsku',
......
......@@ -220,7 +220,7 @@
$.ajax({
url: '/ajax/getSku',
type: 'post',
data: {sku_id : sku_id.trim()},
data: {sku_id : sku_id.trim(), goods_type: goods_type},
dataType: 'json',
success: function (resp) {
if (resp.errcode != 0) {
......@@ -259,25 +259,47 @@
//阶梯价格
if (data.ladder_price != null) {
var len = data.ladder_price.length;
if (data.ladder_price.constructor == String) { //如果阶梯价为字符串,则转换为数字
var price_arr = eval(data.ladder_price);
} else {
var price_arr = data.ladder_price;
}
var len = price_arr.length;
if (len > 0) {
var html = '';
var str = '';
for (var i = 0; i < len; i++) {
html += '<tr>';
if (i == 0) {
if (goods_type == 1) {
str = '<td>$<span class="goods-min-price-us">'+data.ladder_price[i]['price_us']+'</span></td>';
if (data.ac_type) {
html += '<td><span class="goods-min-num">'+price_arr[i]['purchases']+'</span></td><td>¥<span class="goods-min-price">'+price_arr[i]['price_cn']+'</span><td>¥<span>'+price_arr[i]['price_ac']+'</span></td>';
} else {
html += '<td><span class="goods-min-num">'+price_arr[i]['purchases']+'</span></td><td>¥<span class="goods-min-price">'+price_arr[i]['price_cn']+'</span></td>';
}
html += '<tr><td><span class="goods-min-num">'+data.ladder_price[i]['purchases']+'</span></td><td>¥<span class="goods-min-price">'+data.ladder_price[i]['price_cn']+'</span></td>'+str+'</tr>';
} else {
if (goods_type == 1) {
str = '<td>$<span>'+data.ladder_price[i]['price_us']+'</span></td>';
html += '<td>$<span class="goods-min-price-us">'+price_arr[i]['price_us']+'</span></td>';
}
} else {
if (data.ac_type) {
html += '<td><span>'+price_arr[i]['purchases']+'</span></td><td>¥<span>'+price_arr[i]['price_cn']+'</span></td><td>¥<span>'+price_arr[i]['price_ac']+'</span></td>';
} else {
html += '<td><span>'+price_arr[i]['purchases']+'</span></td><td>¥<span>'+price_arr[i]['price_cn']+'</span></td>';
}
if (goods_type == 1) {
html += '<td>$<span>'+price_arr[i]['price_us']+'</span></td>';
}
}
html += '</tr>';
}
html += '<tr><td><span>'+data.ladder_price[i]['purchases']+'</span></td><td>¥<span>'+data.ladder_price[i]['price_cn']+'</span></td>'+str+'</tr>';
}
if (data.ac_type == 1) {
$('.ladder_price_table tr:eq(0)').append('<th>活动价</th>')
}
$('.ladder_price_table tr:gt(0)').remove();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment