import { http_use, http_post } from '../http.js' import api from '../api' class shop { //更新用户信息 async getIndexShopInfo() { let res = await http_use(api.getIndexShopInfo, { }) return res } //修改商家信息 async edit_shopInfo(address, tell, business_time, Paypal, name, shop_lang, member_lang, texts, avatar,url_code,country_id) { let res = await http_post(api.edit_shopInfo, { address, tell, business_time, Paypal, name, shop_lang, member_lang, texts, avatar, url_code, country_id }) return res } //获取店铺货币列表与语言种类 async getShopLangAndCurrency() { let res = await http_use(api.getShopLangAndCurrency, { }) return res } // 收货地址 async shippingAddress(){ try { let res = uni.getStorageSync('address_key'); if (res) { return res } res = await http_post(api.shippingAddress,{}) uni.setStorageSync('address_key', res); return res } catch (e) { // error } } // 收货列表 async addressList(){ let res = await http_post(api.addressList,{ }) return res } // 默认地址 async defaultAddress(address_id){ let res = await http_post(api.defaultAddress,{ address_id }) return res } // 更新/新增收货地址 async makeChangeAddress(area_id,address,address_id,consignee,tel){ let res = await http_post(api.makeChangeAddress,{ area_id,address,address_id,consignee,tel }) return res } // 删除配送地址 async deleteAddress(address_id){ let res = await http_post(api.deleteAddress,{ address_id }) return res } } export default new shop