Commit 1f59a09b authored by 小费同学阿's avatar 小费同学阿 💬

Merge remote-tracking branch 'origin/dev_xf_' into dev_xf_

parents 3f07162f 102f3bc2
...@@ -246,6 +246,10 @@ interface ApiService { ...@@ -246,6 +246,10 @@ interface ApiService {
@POST("app/commodity/consumer-app/merchant-commodity") @POST("app/commodity/consumer-app/merchant-commodity")
fun getShopGoodsList(@Body requestBody: RequestBody): Observable<BasePageResponse<ShopGoodsBean>> fun getShopGoodsList(@Body requestBody: RequestBody): Observable<BasePageResponse<ShopGoodsBean>>
@Headers("Content-type:application/json")
@GET("app/commodity/consumer-app/six-commodity")
fun getSixCommodity(@Query("merchantId") merchantId:String?): Observable<BaseResponse<List<ShopGoodsBean>>>
@Headers("Content-type:application/json") @Headers("Content-type:application/json")
@GET("app/merchant/{businessId}") @GET("app/merchant/{businessId}")
fun getShopDetail(@Path("businessId") businessId:String?): Observable<BaseResponse<ShopDetailBean>> fun getShopDetail(@Path("businessId") businessId:String?): Observable<BaseResponse<ShopDetailBean>>
......
...@@ -5,6 +5,9 @@ import com.xx.hbhconsumer.data.http.respons.CreditGoodsDetailBean; ...@@ -5,6 +5,9 @@ import com.xx.hbhconsumer.data.http.respons.CreditGoodsDetailBean;
import com.xx.hbhconsumer.data.http.respons.GoodsBean; import com.xx.hbhconsumer.data.http.respons.GoodsBean;
import com.xx.hbhconsumer.data.http.respons.GoodsDetailBean; import com.xx.hbhconsumer.data.http.respons.GoodsDetailBean;
import com.xx.hbhconsumer.data.http.respons.ShopAndGoodsBean; import com.xx.hbhconsumer.data.http.respons.ShopAndGoodsBean;
import com.xx.hbhconsumer.data.http.respons.ShopGoodsBean;
import java.util.List;
import io.reactivex.rxjava3.core.Observable; import io.reactivex.rxjava3.core.Observable;
import me.goldze.mvvmhabit.http.ApiParams; import me.goldze.mvvmhabit.http.ApiParams;
...@@ -38,6 +41,32 @@ public class GoodsRequest extends BaseRespons { ...@@ -38,6 +41,32 @@ public class GoodsRequest extends BaseRespons {
return getApiService().queryGoodsDetail(businessId); return getApiService().queryGoodsDetail(businessId);
} }
public Observable<BaseResponse<List<ShopGoodsBean>>> getSixCommodity(String merchantId) {
return getApiService().getSixCommodity(merchantId);
}
public Observable<BasePageResponse<ShopGoodsBean>> getShopGoodsList(List<String> categoryIdList, String merchantId, String searchWord, String sortRules) {
ApiParams<ShopGoodsListRequestBody> apiParams = new ApiParams<>();
ShopGoodsListRequestBody requestBody = new ShopGoodsListRequestBody(categoryIdList, merchantId, searchWord, sortRules);
RequestBody body = apiParams.setParams(requestBody);
return getApiService().getShopGoodsList(body);
}
public class ShopGoodsListRequestBody {
public List<String> categoryIdList;
public String merchantId;
public String searchWord;
public String sortRules;
public ShopGoodsListRequestBody(List<String> categoryIdList, String merchantId, String searchWord, String sortRules) {
this.categoryIdList = categoryIdList;
this.merchantId = merchantId;
this.searchWord = searchWord;
this.sortRules = sortRules;
}
}
class ListShopGoodsByCategoryRequestBody { class ListShopGoodsByCategoryRequestBody {
String categoryId; String categoryId;
String searchWord; String searchWord;
......
...@@ -48,6 +48,9 @@ public class ShopRequest extends BaseRespons { ...@@ -48,6 +48,9 @@ public class ShopRequest extends BaseRespons {
return getApiService().getShopDetail(affiliatedCompany); return getApiService().getShopDetail(affiliatedCompany);
} }
public Observable<BaseResponse<List<ShopGoodsBean>>> getSixCommodity(String merchantId) {
return getApiService().getSixCommodity(merchantId);
}
public Observable<BasePageResponse<ShopGoodsBean>> getShopGoodsList(List<String> categoryIdList, String merchantId, String searchWord, String sortRules) { public Observable<BasePageResponse<ShopGoodsBean>> getShopGoodsList(List<String> categoryIdList, String merchantId, String searchWord, String sortRules) {
ApiParams<ShopGoodsListRequestBody> apiParams = new ApiParams<>(); ApiParams<ShopGoodsListRequestBody> apiParams = new ApiParams<>();
......
...@@ -98,6 +98,7 @@ public class CategoryViewModel extends BaseViewModel<CategoryRequest> { ...@@ -98,6 +98,7 @@ public class CategoryViewModel extends BaseViewModel<CategoryRequest> {
public void goGoodsList(String categoryId) { public void goGoodsList(String categoryId) {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString("categoryId", categoryId); bundle.putString("categoryId", categoryId);
startActivity(GoodsListActivity.class, bundle); bundle.putString("merchantId", merchantId);
startActivity(ShopSearchActivity.class, bundle);
} }
} }
...@@ -50,7 +50,6 @@ import java.util.HashMap; ...@@ -50,7 +50,6 @@ import java.util.HashMap;
import me.goldze.mvvmhabit.base.BaseActivity; import me.goldze.mvvmhabit.base.BaseActivity;
import me.goldze.mvvmhabit.utils.StringUtils; import me.goldze.mvvmhabit.utils.StringUtils;
import me.goldze.mvvmhabit.utils.ToastUtils;
import me.tatarka.bindingcollectionadapter2.BR; import me.tatarka.bindingcollectionadapter2.BR;
public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel> implements OnFMMapInitListener,SearchBar.OnSearchResultCallback, public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel> implements OnFMMapInitListener,SearchBar.OnSearchResultCallback,
...@@ -159,7 +158,7 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel> ...@@ -159,7 +158,7 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
fmMapView.setLayoutParams(params); fmMapView.setLayoutParams(params);
binding.llMapView.removeAllViews(); binding.llMapView.removeAllViews();
binding.llMapView.addView(fmMapView); binding.llMapView.addView(fmMapView);
mFMMap = new FMMap(fmMapView); //获取地图操作对象 mFMMap = fmMapView.getFMMap(); //获取地图操作对象
mFMMap.setOnFMMapInitListener(this); mFMMap.setOnFMMapInitListener(this);
mFMMap.setOnFMMapClickListener(this); mFMMap.setOnFMMapClickListener(this);
mFMMap.openMapById(mapId, true); //打开地图 mFMMap.openMapById(mapId, true); //打开地图
...@@ -204,7 +203,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel> ...@@ -204,7 +203,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
*/ */
@Override @Override
public void onMapInitSuccess(String path) { public void onMapInitSuccess(String path) {
ToastUtils.showShort("地图加载成功");
firstLoadSuccess = true; firstLoadSuccess = true;
//线图层 //线图层
mLineLayer = mFMMap.getFMLayerProxy().getFMLineLayer(); mLineLayer = mFMMap.getFMLayerProxy().getFMLineLayer();
...@@ -245,7 +243,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel> ...@@ -245,7 +243,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
@Override @Override
public void onMapInitFailure(String s, int errorCode) { public void onMapInitFailure(String s, int errorCode) {
ToastUtils.showShort("地图加载失败:" + errorCode);
FMLog.le("onMapInitFailure", FMErrorMsg.getErrorMsg(errorCode)); FMLog.le("onMapInitFailure", FMErrorMsg.getErrorMsg(errorCode));
} }
...@@ -325,7 +322,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel> ...@@ -325,7 +322,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
// 起点 // 起点
if (mSartCoord == null) { if (mSartCoord == null) {
ToastUtils.showShort("添加起点");
clear(); clear();
mSartCoord = mapCoordResult.getMapCoord(); mSartCoord = mapCoordResult.getMapCoord();
...@@ -336,7 +332,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel> ...@@ -336,7 +332,6 @@ public class MapActivity extends BaseActivity<ActivityMapBinding, MapViewModel>
// 终点 // 终点
if (mEndCoord == null) { if (mEndCoord == null) {
ToastUtils.showShort("添加终点");
mEndCoord = mapCoordResult.getMapCoord(); mEndCoord = mapCoordResult.getMapCoord();
mEndGroupId = mapCoordResult.getGroupId(); mEndGroupId = mapCoordResult.getGroupId();
createEndImageMarker(); createEndImageMarker();
......
...@@ -7,6 +7,7 @@ import androidx.lifecycle.MutableLiveData; ...@@ -7,6 +7,7 @@ import androidx.lifecycle.MutableLiveData;
import com.xx.hbhconsumer.data.http.requst.MapRequest; import com.xx.hbhconsumer.data.http.requst.MapRequest;
import com.xx.hbhconsumer.data.http.respons.DictValueBean; import com.xx.hbhconsumer.data.http.respons.DictValueBean;
import com.xx.hbhconsumer.data.http.respons.YearBean;
import com.xx.hbhconsumer.data.local.LocalData; import com.xx.hbhconsumer.data.local.LocalData;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -69,7 +70,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> { ...@@ -69,7 +70,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
for (DictValueBean dictValueBean : recruitBeans) { for (DictValueBean dictValueBean : recruitBeans) {
if (LocalData.getAffiliatedCompany().equals("2") && dictValueBean.getDictLabel().equals("滨海宏达公司")) { if (LocalData.getAffiliatedCompany().equals("2") && dictValueBean.getDictLabel().equals("滨海宏达公司")) {
newList.add(dictValueBean); newList.add(dictValueBean);
} else { } else if (!dictValueBean.getDictLabel().equals("滨海宏达公司")) {
if (!StringUtils.isEmpty(dictValueBean.getRemark())) { if (!StringUtils.isEmpty(dictValueBean.getRemark())) {
newList.add(dictValueBean); newList.add(dictValueBean);
} }
...@@ -78,6 +79,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> { ...@@ -78,6 +79,7 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
if (newList.isEmpty()) { if (newList.isEmpty()) {
ToastUtils.showShort("暂无地图数据"); ToastUtils.showShort("暂无地图数据");
} else { } else {
newList.get(0).setChecked(true);
checkMap(newList.get(0)); checkMap(newList.get(0));
} }
mapList.postValue(newList); mapList.postValue(newList);
...@@ -98,6 +100,18 @@ public class MapViewModel extends BaseViewModel<MapRequest> { ...@@ -98,6 +100,18 @@ public class MapViewModel extends BaseViewModel<MapRequest> {
}); });
public void checkMap(DictValueBean data) { public void checkMap(DictValueBean data) {
List<DictValueBean> list = new ArrayList<>();
for (DictValueBean yearBean : mapList.getValue()) {
if (data.getDictLabel().equals(yearBean.getDictLabel())) {
yearBean.setChecked(true);
} else {
yearBean.setChecked(false);
}
list.add(yearBean);
}
mapList.postValue(list);
region.postValue(data.getDictLabel()); region.postValue(data.getDictLabel());
mapId.postValue(data.getRemark()); mapId.postValue(data.getRemark());
checkMapFlag.postValue(false); checkMapFlag.postValue(false);
......
...@@ -22,6 +22,7 @@ import java.util.ArrayList; ...@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import me.goldze.mvvmhabit.base.BaseActivity; import me.goldze.mvvmhabit.base.BaseActivity;
import me.goldze.mvvmhabit.utils.StringUtils;
import me.tatarka.bindingcollectionadapter2.BR; import me.tatarka.bindingcollectionadapter2.BR;
public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding, ShopSearchViewModel> { public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding, ShopSearchViewModel> {
...@@ -38,7 +39,12 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding, ...@@ -38,7 +39,12 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
@Override @Override
public void initData() { public void initData() {
super.initData(); super.initData();
String merchantId = getIntent().getStringExtra("merchantId");
if (StringUtils.isEmpty(merchantId)) {
binding.tvSort.setVisibility(View.VISIBLE);
} else {
binding.tvSort.setVisibility(View.GONE);
}
viewModel.showSortFlag.observe(this, showSortFlag -> { viewModel.showSortFlag.observe(this, showSortFlag -> {
if (showSortFlag) { if (showSortFlag) {
binding.rlSearchArea.setVisibility(View.VISIBLE); binding.rlSearchArea.setVisibility(View.VISIBLE);
...@@ -107,12 +113,9 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding, ...@@ -107,12 +113,9 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
SearchHistoryAdapter searchHistoryAdapter = new SearchHistoryAdapter(this); SearchHistoryAdapter searchHistoryAdapter = new SearchHistoryAdapter(this);
//把adapterset进去 //把adapterset进去
binding.rvSearchHistory.setAdapter(searchHistoryAdapter); binding.rvSearchHistory.setAdapter(searchHistoryAdapter);
searchHistoryAdapter.setOnItemClick(new xxBaseRecyclerViewAdapter.OnItemClick<String>() { searchHistoryAdapter.setOnItemClick((position, data) -> {
@Override viewModel.searchWordClick(data);
public void itemClickCalBack(int position, String data) { binding.etSearch.clearFocus();
viewModel.searchWordClick(data);
binding.etSearch.clearFocus();
}
}); });
viewModel.searchWordList.observe(this, searchWordList -> { viewModel.searchWordList.observe(this, searchWordList -> {
...@@ -139,6 +142,7 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding, ...@@ -139,6 +142,7 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
shopDetailGoodsAdapter.notifyDataSetChanged(); shopDetailGoodsAdapter.notifyDataSetChanged();
if (shopBeanList.isEmpty()) { if (shopBeanList.isEmpty()) {
binding.rlNoData.setVisibility(View.VISIBLE); binding.rlNoData.setVisibility(View.VISIBLE);
viewModel.loadShopRecommendGoods();
} else { } else {
binding.rlNoData.setVisibility(View.GONE); binding.rlNoData.setVisibility(View.GONE);
} }
...@@ -147,6 +151,19 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding, ...@@ -147,6 +151,19 @@ public class ShopSearchActivity extends BaseActivity<ActivityShopSearchBinding,
binding.rlSearchHistoryBar.setVisibility(View.GONE); binding.rlSearchHistoryBar.setVisibility(View.GONE);
}); });
ShopDetailGoodsAdapter shopDetailGoodsAdapter1 = new ShopDetailGoodsAdapter(ShopSearchActivity.this);
GridLayoutManager gridLayoutManager1 = new GridLayoutManager(ShopSearchActivity.this,2);
binding.rvRecommend.setLayoutManager(gridLayoutManager1);
binding.rvRecommend.setAdapter(shopDetailGoodsAdapter1);
shopDetailGoodsAdapter1.setOnItemClick((position, data) -> viewModel.goShopGoodsDetail(data.getBusinessId()));
viewModel.shopRecommendGoodsBeanList.observe(this, shopBeanList -> {
binding.rlCategoryBar.setVisibility(View.VISIBLE);
shopDetailGoodsAdapter1.mList = shopBeanList;
shopDetailGoodsAdapter1.notifyDataSetChanged();
});
} }
@Override @Override
......
...@@ -24,6 +24,7 @@ import io.reactivex.rxjava3.functions.Consumer; ...@@ -24,6 +24,7 @@ import io.reactivex.rxjava3.functions.Consumer;
import me.goldze.mvvmhabit.base.BaseViewModel; import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction; import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand; import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.http.ApiDisposableObserver;
import me.goldze.mvvmhabit.http.ApiDisposablePageObserver; import me.goldze.mvvmhabit.http.ApiDisposablePageObserver;
import me.goldze.mvvmhabit.utils.RxUtils; import me.goldze.mvvmhabit.utils.RxUtils;
import me.goldze.mvvmhabit.utils.StringUtils; import me.goldze.mvvmhabit.utils.StringUtils;
...@@ -41,6 +42,7 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> { ...@@ -41,6 +42,7 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> {
private List<String> categoryIdList; private List<String> categoryIdList;
public MutableLiveData<List<String>> searchWordList = new MutableLiveData<>(new ArrayList<>()); public MutableLiveData<List<String>> searchWordList = new MutableLiveData<>(new ArrayList<>());
public MutableLiveData<List<ShopGoodsBean>> shopGoodsBeanList = new MutableLiveData<>(new ArrayList<>()); public MutableLiveData<List<ShopGoodsBean>> shopGoodsBeanList = new MutableLiveData<>(new ArrayList<>());
public MutableLiveData<List<ShopGoodsBean>> shopRecommendGoodsBeanList = new MutableLiveData<>(new ArrayList<>());
public MutableLiveData<Integer> searchState = new MutableLiveData<>(0); public MutableLiveData<Integer> searchState = new MutableLiveData<>(0);
...@@ -112,6 +114,27 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> { ...@@ -112,6 +114,27 @@ public class ShopSearchViewModel extends BaseViewModel<ShopRequest> {
}); });
} }
public void loadShopRecommendGoods() {
model.getSixCommodity(merchantId)
.compose(RxUtils.schedulersTransformer()) //线程调度
.doOnSubscribe(ShopSearchViewModel.this)
.doOnSubscribe(new Consumer<Disposable>() {
@Override
public void accept(Disposable disposable) throws Exception {
}
}).subscribe(new ApiDisposableObserver<List<ShopGoodsBean>>() {
@Override
public void onSuccess(List<ShopGoodsBean> resultBean) {
shopRecommendGoodsBeanList.postValue(resultBean);
}
@Override
public void onError(String Error) {
dismissDialog();
}
});
}
public BindingCommand goCategory = new BindingCommand(new BindingAction() { public BindingCommand goCategory = new BindingCommand(new BindingAction() {
@Override @Override
public void call() { public void call() {
......
...@@ -131,6 +131,7 @@ ...@@ -131,6 +131,7 @@
android:layout_marginTop="13dp"> android:layout_marginTop="13dp">
<TextView <TextView
android:id="@+id/tv_sort"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
...@@ -177,14 +178,41 @@ ...@@ -177,14 +178,41 @@
android:id="@+id/rl_no_data" android:id="@+id/rl_no_data"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="92dp" android:visibility="gone"
android:layout_below="@id/top_bar"> android:layout_below="@id/rl_category_bar">
<ImageView <LinearLayout
android:layout_width="wrap_content" android:id="@+id/tv_no_data"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true" android:layout_marginLeft="17dp"
android:src="@mipmap/zhanwei_img_wushuju"/> android:layout_marginRight="17dp"
android:layout_marginTop="21dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/dianpu_icon_tishi"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textColor="#C8382A"
android:textSize="14sp"
android:text="没有找到商品,以下是为您推荐的本店其他商品"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_recommend"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="17dp"
android:layout_marginRight="17dp"
android:layout_marginTop="21dp"
android:layout_below="@id/tv_no_data"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment