feat: 修改网点api地址以及回填内容
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
/>
|
/>
|
||||||
<view
|
<view
|
||||||
class="item font-color"
|
class="item font-color"
|
||||||
:class="[state.deliveryType === '2' ? 'on' : 'on2', props.theme == '2' ? 'c0' : '']"
|
:class="[state.deliveryType === 2 ? 'on' : 'on2', props.theme == '2' ? 'c0' : '']"
|
||||||
@tap="switchDeliveryType(2)"
|
@tap="switchDeliveryType(2)"
|
||||||
v-if="state.isPickUp"
|
v-if="state.isPickUp"
|
||||||
/>
|
/>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
<!-- 情况二:门店的选择 -->
|
<!-- 情况二:门店的选择 -->
|
||||||
<view
|
<view
|
||||||
class="address flex flex-wrap flex-center ss-row-between"
|
class="address flex flex-wrap flex-center ss-row-between"
|
||||||
v-if="state.deliveryType === '2'"
|
v-if="state.deliveryType === 2"
|
||||||
@tap="onSelectAddress"
|
@tap="onSelectAddress"
|
||||||
:class="{ 'bg24 c0': props.theme == '2' }"
|
:class="{ 'bg24 c0': props.theme == '2' }"
|
||||||
>
|
>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
<text class="phone">{{ state.pickUpInfo.phone }}</text>
|
<text class="phone">{{ state.pickUpInfo.phone }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="line1">
|
<view class="line1">
|
||||||
{{ state.pickUpInfo.areaName }}{{ ', ' + state.pickUpInfo.detailAddress }}
|
{{ state.pickUpInfo.district }}{{ ', ' + state.pickUpInfo.description }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="addressCon" v-else>
|
<view class="addressCon" v-else>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<view class="store-cent-left">
|
<view class="store-cent-left">
|
||||||
<view class="store-name">{{ item.name }}</view>
|
<view class="store-name">{{ item.name }}</view>
|
||||||
<view class="store-address line1">
|
<view class="store-address line1">
|
||||||
{{ item.areaName }}{{ ', ' + item.detailAddress }}
|
{{ item.district }}{{ ', ' + item.description }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="row-right ss-flex-col ss-col-center">
|
<view class="row-right ss-flex-col ss-col-center">
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import DeliveryApi from '@/sheep/api/trade/delivery';
|
import StoreApi from '@/sheep/api/trade/store';
|
||||||
import { onMounted, reactive } from 'vue';
|
import { onMounted, reactive } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import sheep from '@/sheep';
|
import sheep from '@/sheep';
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
latitude: Number(e.latitude),
|
latitude: Number(e.latitude),
|
||||||
longitude: Number(e.longitude),
|
longitude: Number(e.longitude),
|
||||||
name: e.name,
|
name: e.name,
|
||||||
address: `${e.areaName}-${e.detailAddress}`,
|
address: `${e.district}-${e.description}`,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// #endif
|
// #endif
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
latitude: Number(e.latitude),
|
latitude: Number(e.latitude),
|
||||||
longitude: Number(e.longitude),
|
longitude: Number(e.longitude),
|
||||||
name: e.name,
|
name: e.name,
|
||||||
address: `${e.areaName}-${e.detailAddress}`,
|
address: `${e.district}-${e.description}`,
|
||||||
success: function () {
|
success: function () {
|
||||||
console.log('success');
|
console.log('success');
|
||||||
},
|
},
|
||||||
@@ -154,16 +154,19 @@
|
|||||||
if (state.loading || state.loaded) {
|
if (state.loading || state.loaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const hasLocation = !!(state.user_latitude && state.user_longitude);
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
const { data, code } = await DeliveryApi.getDeliveryPickUpStoreList({
|
const { data, code } = await StoreApi.getStoreListByLocation({
|
||||||
latitude: state.user_latitude,
|
latitude: state.user_latitude,
|
||||||
longitude: state.user_longitude,
|
longitude: state.user_longitude,
|
||||||
});
|
});
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
|
state.loading = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.storeList = data;
|
state.loaded = hasLocation;
|
||||||
|
state.storeList = Array.isArray(data) ? data : [];
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import request from '@/sheep/request';
|
||||||
|
|
||||||
|
function normalizeList(data) {
|
||||||
|
if (Array.isArray(data)) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
if (Array.isArray(data?.list)) {
|
||||||
|
return data.list;
|
||||||
|
}
|
||||||
|
if (Array.isArray(data?.records)) {
|
||||||
|
return data.records;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const StoreApi = {
|
||||||
|
getStoreListByLocation: async (params) => {
|
||||||
|
const res = await request({
|
||||||
|
url: '/trade/store/list-by-location',
|
||||||
|
method: 'GET',
|
||||||
|
params,
|
||||||
|
custom: {
|
||||||
|
showLoading: false,
|
||||||
|
showError: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res?.code === 0) {
|
||||||
|
res.data = normalizeList(res.data);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StoreApi;
|
||||||
Reference in New Issue
Block a user