Authored by 李奇

商品列表接口修改

... ... @@ -3,6 +3,7 @@ import udid from './common/udid';
import event from './common/event';
import {verify} from './common/api';
import config from './common/config';
import commonModel from './models/common';
import Promise from './vendors/es6-promise';
import { MD5 } from './vendors/crypto';
import { wechatAuthLogin, verifySessionKey } from './common/login';
... ... @@ -72,6 +73,9 @@ App({
this.globalData.systemInfo = res;
});
// 获取关联店铺
this.getUnionShop();
// 设置渠道来源
if (options && options.query && options.query.union_type) {
this.globalData.union_type = options.query.union_type;
... ... @@ -112,6 +116,18 @@ App({
this.wechatAuthLogin();
}, 1000);
},
getUnionShop() {
commonModel.getBindShop({ app_id: config.appid})
.then(res => {
if (res.code === 200) {
if (res.data && res.data.shopId) {
this._setSync('app_bind_shop_id', res.data.shopId);
this._setSync('app_bind_union_type', res.data.unionType);
}
}
})
.catch(() => {});
},
_getSync(key) {
try {
return wx.getStorageSync(key);
... ...
... ... @@ -140,7 +140,8 @@ const api = {
business_line: config.apiParams.business_line,
client_type: config.apiParams.client_type,
app_version: config.apiParams.app_version,
union_type: config.unionType, // 渠道号
shop_id: 1016, // TODO 临时写死
// union_type: config.unionType, // 渠道号
udid: udid.get()
}, params);
},
... ...
const config = {
domains: {
// test3
// api: 'http://api-test3.dev.yohocorp.com',
api: 'http://api-test3.dev.yohocorp.com',
// test1
// api: 'http://api-test1.dev.yohocorp.com',
... ... @@ -10,7 +10,7 @@ const config = {
// api: 'http://apigray.yoho.cn',
// production
api: 'https://api.yoho.cn',
// api: 'https://api.yoho.cn',
yasApi: 'https://analysis.yohobuy.com/yas_mobile'
},
... ...
... ... @@ -13,4 +13,18 @@ export default {
}, params)
});
},
/**
* 通过AppId查绑定店铺
* @param params
* @returns {*}
*/
getBindShop(params) {
return api.get({
url: '',
data: Object.assign({
method: 'app.shops.union'
}, params)
});
}
};
... ...
... ... @@ -10,7 +10,7 @@ export default {
return api.get({
url: '',
data: Object.assign({
method: 'app.distribution.productList'
method: 'app.search.shop.productList'
}, params)
});
},
... ...
... ... @@ -10,7 +10,7 @@ export default {
return api.get({
url: '',
data: Object.assign({
method: 'app.distribution.productList'
method: 'app.search.shop.productList'
}, params)
});
}
... ...
... ... @@ -10,7 +10,7 @@ export default {
return api.get({
url: '',
data: Object.assign({
method: 'app.distribution.productList'
method: 'app.search.shop.productList'
}, params)
});
},
... ...
... ... @@ -36,5 +36,19 @@ export default {
method: 'app.popular.shopsdecorator'
}, params)
});
}
},
/**
* 店铺商品列表
* @param params
* @returns {*}
*/
shopProductList(params) {
return api.get({
url: '',
data: Object.assign({
method: 'app.search.shop.productList'
}, params)
});
},
};
... ...
import wx from '../../utils/wx';
import config from '../../common/config';
import Yas from '../../common/yas';
import indexModel from '../../models/index/index';
import shopModel from '../../models/product/shop';
// 获取应用实例
let app = getApp();
... ... @@ -123,7 +123,7 @@ Page({
this.data.isLoading = true;
wx.showLoading({title: '加载中'});
delete params.setScrollPos;
indexModel.productList(params).then(res => {
shopModel.shopProductList(params).then(res => {
if (res.code === 200) {
const keyAdapter = {
skn: 'product_skn',
... ...
... ... @@ -29,7 +29,7 @@
"list": []
},
"miniprogram": {
"current": 13,
"current": -1,
"list": [
{
"id": 1,
... ...