提交 a3f09fff 编写于 作者: G gongfuxiang

商品详情接口调整

上级 0db84533
...@@ -499,6 +499,7 @@ Page({ ...@@ -499,6 +499,7 @@ Page({
headers: { 'content-type': 'application/x-www-form-urlencoded' }, headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => { success: (res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_type = res.data.data.spec_type;
var spec_count = spec.length; var spec_count = spec.length;
var index = (spec_count > 0) ? spec_count : 0; var index = (spec_count > 0) ? spec_count : 0;
if(index < sku_count) if(index < sku_count)
...@@ -512,9 +513,9 @@ Page({ ...@@ -512,9 +513,9 @@ Page({
temp_data[i]['value'][k]['is_dont'] = ''; temp_data[i]['value'][k]['is_dont'] = '';
var temp_value = temp_data[i]['value'][k]['name']; var temp_value = temp_data[i]['value'][k]['name'];
var temp_status = false; var temp_status = false;
for(var t in res.data.data) for(var t in spec_type)
{ {
if(res.data.data[t] == temp_value) if(spec_type[t] == temp_value)
{ {
temp_status = true; temp_status = true;
break; break;
...@@ -581,10 +582,11 @@ Page({ ...@@ -581,10 +582,11 @@ Page({
headers: { 'content-type': 'application/x-www-form-urlencoded' }, headers: { 'content-type': 'application/x-www-form-urlencoded' },
success: (res) => { success: (res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_base = res.data.data.spec_base;
this.setData({ this.setData({
goods_spec_base_price: res.data.data.price, goods_spec_base_price: spec_base.price,
goods_spec_base_original_price: res.data.data.original_price, goods_spec_base_original_price: spec_base.original_price,
goods_spec_base_inventory: res.data.data.inventory, goods_spec_base_inventory: spec_base.inventory,
}); });
} else { } else {
app.showToast(res.data.msg); app.showToast(res.data.msg);
......
...@@ -454,6 +454,7 @@ Page({ ...@@ -454,6 +454,7 @@ Page({
dataType: 'json', dataType: 'json',
success: res => { success: res => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_type = res.data.data.spec_type;
var spec_count = spec.length; var spec_count = spec.length;
var index = spec_count > 0 ? spec_count : 0; var index = spec_count > 0 ? spec_count : 0;
if (index < sku_count) { if (index < sku_count) {
...@@ -463,8 +464,8 @@ Page({ ...@@ -463,8 +464,8 @@ Page({
temp_data[i]['value'][k]['is_dont'] = ''; temp_data[i]['value'][k]['is_dont'] = '';
var temp_value = temp_data[i]['value'][k]['name']; var temp_value = temp_data[i]['value'][k]['name'];
var temp_status = false; var temp_status = false;
for (var t in res.data.data) { for (var t in spec_type) {
if (res.data.data[t] == temp_value) { if (spec_type[t] == temp_value) {
temp_status = true; temp_status = true;
break; break;
} }
...@@ -524,10 +525,11 @@ Page({ ...@@ -524,10 +525,11 @@ Page({
dataType: 'json', dataType: 'json',
success: res => { success: res => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_base = res.data.data.spec_base;
this.setData({ this.setData({
goods_spec_base_price: res.data.data.price, goods_spec_base_price: spec_base.price,
goods_spec_base_original_price: res.data.data.original_price, goods_spec_base_original_price: spec_base.original_price,
goods_spec_base_inventory: res.data.data.inventory goods_spec_base_inventory: spec_base.inventory
}); });
} else { } else {
app.showToast(res.data.msg); app.showToast(res.data.msg);
......
...@@ -479,6 +479,7 @@ Page({ ...@@ -479,6 +479,7 @@ Page({
dataType: 'json', dataType: 'json',
success: (res) => { success: (res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_type = res.data.data.spec_type;
var spec_count = spec.length; var spec_count = spec.length;
var index = (spec_count > 0) ? spec_count : 0; var index = (spec_count > 0) ? spec_count : 0;
if(index < sku_count) if(index < sku_count)
...@@ -492,9 +493,9 @@ Page({ ...@@ -492,9 +493,9 @@ Page({
temp_data[i]['value'][k]['is_dont'] = ''; temp_data[i]['value'][k]['is_dont'] = '';
var temp_value = temp_data[i]['value'][k]['name']; var temp_value = temp_data[i]['value'][k]['name'];
var temp_status = false; var temp_status = false;
for(var t in res.data.data) for(var t in spec_type)
{ {
if(res.data.data[t] == temp_value) if(spec_type[t] == temp_value)
{ {
temp_status = true; temp_status = true;
break; break;
...@@ -560,10 +561,11 @@ Page({ ...@@ -560,10 +561,11 @@ Page({
dataType: 'json', dataType: 'json',
success: (res) => { success: (res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_base = res.data.data.spec_base;
this.setData({ this.setData({
goods_spec_base_price: res.data.data.price, goods_spec_base_price: spec_base.price,
goods_spec_base_original_price: res.data.data.original_price, goods_spec_base_original_price: spec_base.original_price,
goods_spec_base_inventory: res.data.data.inventory, goods_spec_base_inventory: spec_base.inventory,
}); });
} else { } else {
app.showToast(res.data.msg); app.showToast(res.data.msg);
......
...@@ -479,6 +479,7 @@ Page({ ...@@ -479,6 +479,7 @@ Page({
dataType: 'json', dataType: 'json',
success: (res) => { success: (res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_type = res.data.data.spec_type;
var spec_count = spec.length; var spec_count = spec.length;
var index = (spec_count > 0) ? spec_count : 0; var index = (spec_count > 0) ? spec_count : 0;
if(index < sku_count) if(index < sku_count)
...@@ -492,9 +493,9 @@ Page({ ...@@ -492,9 +493,9 @@ Page({
temp_data[i]['value'][k]['is_dont'] = ''; temp_data[i]['value'][k]['is_dont'] = '';
var temp_value = temp_data[i]['value'][k]['name']; var temp_value = temp_data[i]['value'][k]['name'];
var temp_status = false; var temp_status = false;
for(var t in res.data.data) for(var t in spec_type)
{ {
if(res.data.data[t] == temp_value) if(spec_type[t] == temp_value)
{ {
temp_status = true; temp_status = true;
break; break;
...@@ -560,10 +561,11 @@ Page({ ...@@ -560,10 +561,11 @@ Page({
dataType: 'json', dataType: 'json',
success: (res) => { success: (res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_base = res.data.data.spec_base;
this.setData({ this.setData({
goods_spec_base_price: res.data.data.price, goods_spec_base_price: spec_base.price,
goods_spec_base_original_price: res.data.data.original_price, goods_spec_base_original_price: spec_base.original_price,
goods_spec_base_inventory: res.data.data.inventory, goods_spec_base_inventory: spec_base.inventory,
}); });
} else { } else {
app.showToast(res.data.msg); app.showToast(res.data.msg);
......
...@@ -496,6 +496,7 @@ Page({ ...@@ -496,6 +496,7 @@ Page({
data: { "id": this.data.goods.id, "spec": JSON.stringify(spec) }, data: { "id": this.data.goods.id, "spec": JSON.stringify(spec) },
dataType: 'json', dataType: 'json',
success: (res) => { success: (res) => {
var spec_type = res.data.data.spec_type;
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_count = spec.length; var spec_count = spec.length;
var index = (spec_count > 0) ? spec_count : 0; var index = (spec_count > 0) ? spec_count : 0;
...@@ -510,9 +511,9 @@ Page({ ...@@ -510,9 +511,9 @@ Page({
temp_data[i]['value'][k]['is_dont'] = ''; temp_data[i]['value'][k]['is_dont'] = '';
var temp_value = temp_data[i]['value'][k]['name']; var temp_value = temp_data[i]['value'][k]['name'];
var temp_status = false; var temp_status = false;
for(var t in res.data.data) for(var t in spec_type)
{ {
if(res.data.data[t] == temp_value) if(spec_type[t] == temp_value)
{ {
temp_status = true; temp_status = true;
break; break;
...@@ -578,10 +579,11 @@ Page({ ...@@ -578,10 +579,11 @@ Page({
dataType: 'json', dataType: 'json',
success: (res) => { success: (res) => {
if (res.data.code == 0) { if (res.data.code == 0) {
var spec_base = res.data.data.spec_base;
this.setData({ this.setData({
goods_spec_base_price: res.data.data.price, goods_spec_base_price: spec_base.price,
goods_spec_base_original_price: res.data.data.original_price, goods_spec_base_original_price: spec_base.original_price,
goods_spec_base_inventory: res.data.data.inventory, goods_spec_base_inventory: spec_base.inventory,
}); });
} else { } else {
app.showToast(res.data.msg); app.showToast(res.data.msg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册