chooseCity.js 590 B

1234567891011121314151617181920212223242526
  1. import { aliApiPromise } from '@whale.io/mini/es/utils/fn';
  2. import { getCityList } from '../service/store';
  3. async function chooseCity(storeId, cityList) {
  4. if (!cityList) {
  5. cityList = await getCityList(storeId);
  6. }
  7. const cityInfo = await aliApiPromise('chooseCity', {
  8. showLocatedCity: true,
  9. showHotCities: false,
  10. cities: cityList.map(({
  11. cityName,
  12. cityCode,
  13. cityFirstChar
  14. }) => ({
  15. city: cityName,
  16. adCode: cityCode,
  17. spell: cityFirstChar
  18. }))
  19. }, false);
  20. return cityInfo;
  21. }
  22. export default chooseCity;
  23. export { getCityList };