Commit 9cda6142 by Wyh

9.11 修改外賣模塊名,冷鏈報錯問題

Signed-off-by: Wyh <1239658231>
parent 182fcbd9
......@@ -127,7 +127,7 @@ public class ColdChainMainPresenter extends BasePresenter<ColdChainMainContract.
@Override
public void onNext(@NonNull BalanceBean info) {
if (info != null && info.isSuccess()) {
if (info != null && info.isSuccess() && info.getData() != null) {
mRootView.loadBalance(info.getData().getBalance(), info.getData().getBond(), info.getData().getBalance() <= info.getData().getThreshold());
}
}
......
package com.gingersoft.gsa.delivery_pick_mode;
import com.billy.cc.core.component.CC;
import com.jess.arms.base.BaseApplication;
/**
* Created by Wyh on 2020/1/7.
*/
public class MyApp extends BaseApplication {
@Override
public void onCreate() {
super.onCreate();
CC.enableVerboseLog(true);
CC.enableDebug(true);
CC.enableRemoteCC(true);
}
}
......@@ -137,6 +137,9 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/
fun getOrderList(restaurantId: String, position: Int, page: String, isLoadMore: Boolean) {
launch({
if(position > 1){
}
repository.requestOrderList(restaurantId, fragmentStatus[position], fragmentType[position], page, orderNo, phone, appointmentType.value
?: 0).apply {
// throw NullPointerException("測試獲取訂單列表異常")
......
......@@ -102,14 +102,14 @@ class DeliveryOrderMainActivity : BaseActivity() {
layout_booking_order.background = ContextCompat.getDrawable(this, R.drawable.shape_right_white_radius_btn)
tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.white))
tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color))
pageViewModel.appointmentType.postValue(0)
}
layout_booking_order.setOnClickListener {
it.background = ContextCompat.getDrawable(this, R.drawable.shape_right_themecolor_radius_btn)
layout_immediate_order.background = ContextCompat.getDrawable(this, R.drawable.shape_left_white_radius_btn)
tv_booking_order.setTextColor(ContextCompat.getColor(this, R.color.white))
tv_immediate_order.setTextColor(ContextCompat.getColor(this, R.color.theme_333_color))
pageViewModel.appointmentType.postValue(1)
}
pageViewModel.apply {
......
......@@ -23,15 +23,16 @@ import kotlinx.android.synthetic.main.fragment_other_order.*
*/
class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
private lateinit var pageViewModel: PageViewModel
private val pageViewModel by lazy { ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] }
private var page = 1
private val restaurantId by lazy { GsaCloudApplication.getRestaurantId(activity) }
private val memberId by lazy { GsaCloudApplication.getMemberId(activity) }
private lateinit var adapter: OtherOrdersAdapter
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
pageViewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java].apply {
pageViewModel.apply {
// 綁定狀態,如果這個值發生變化
refreshState.observe(viewLifecycleOwner, Observer {
if (arguments?.getInt(INDEX) == it) {
......@@ -39,39 +40,14 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
getOrderList(false)
}
})
}
// 初始化recyclerview
rv_other_order.layoutManager = LinearLayoutManager(activity)
val adapter = OtherOrdersAdapter(activity!!, pageViewModel.timeOut * 60 * 1000)
adapter.setOnItemClickListenter { data ->
// 點擊查詢食品詳情
val intent = Intent(activity, OrderDetailsActivity::class.java)
intent.putExtra("orderId", data.Id.toString())
intent.putExtra("orderType", data.order_type)
intent.putExtra("orderStatus", data.STATUS)
intent.putExtra("orderPayType", data.orderPayType)
intent.putExtra("isRead", data.isRead)
//已指派物流 並且 狀態為未接單 才判斷是否超時
if (data.isDelete == 0 && data.curStat < 2) {
if (pageViewModel.timeOut == 0) {
//為0時沒配置,不顯示追加服務費按鈕
intent.putExtra("isTimeOut", false)
} else {
intent.putExtra("isTimeOut", data.timeSecond < pageViewModel.timeOut * 60 * 1000)
}
}
startActivityForResult(intent, 1001)
}
rv_other_order.adapter = adapter
//有多少個Fragment就添加多少個監聽
while (pageViewModel.mOrderList.size <= arguments?.getInt(INDEX)!!) {
pageViewModel.mOrderList.add(MutableLiveData())
while (mOrderList.size <= arguments?.getInt(INDEX)!!) {
mOrderList.add(MutableLiveData())
}
// 綁定監聽當前fragment的數據項
pageViewModel.mOrderList[arguments?.getInt(INDEX)!!].observe(viewLifecycleOwner, Observer {
mOrderList[arguments?.getInt(INDEX)!!].observe(viewLifecycleOwner, Observer {
refresh_layout.finishRefresh()
refresh_layout.finishLoadMore()
it?.let {
......@@ -80,7 +56,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
}
})
pageViewModel.orderList.observe(viewLifecycleOwner, Observer {
orderList.observe(viewLifecycleOwner, Observer {
refresh_layout.finishRefresh()
refresh_layout.finishLoadMore()
it?.let {
......@@ -95,6 +71,21 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
}
})
appointmentType.observe(viewLifecycleOwner, Observer {
refresh()
})
}
// 初始化recyclerview
initRecyclerView()
initRefresh()
}
override fun onResume() {
super.onResume()
refresh()
}
private fun initRefresh() {
// 设置 Header 顏色
refresh_layout.setPrimaryColorsId(R.color.color_f0, R.color.color_66)
// 下拉刷新,加載更多
......@@ -109,10 +100,31 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
}
}
override fun onResume() {
super.onResume()
refresh()
private fun initRecyclerView() {
rv_other_order.layoutManager = LinearLayoutManager(activity)
adapter = OtherOrdersAdapter(activity!!, pageViewModel.timeOut * 60 * 1000)
adapter.setOnItemClickListenter { data ->
// 點擊查詢食品詳情
val intent = Intent(activity, OrderDetailsActivity::class.java)
intent.putExtra("orderId", data.Id.toString())
intent.putExtra("orderType", data.order_type)
intent.putExtra("orderStatus", data.STATUS)
intent.putExtra("orderPayType", data.orderPayType)
intent.putExtra("isRead", data.isRead)
//已指派物流 並且 狀態為未接單 才判斷是否超時
if (data.isDelete == 0 && data.curStat < 2) {
if (pageViewModel.timeOut == 0) {
//為0時沒配置,不顯示追加服務費按鈕
intent.putExtra("isTimeOut", false)
} else {
intent.putExtra("isTimeOut", data.timeSecond < pageViewModel.timeOut * 60 * 1000)
}
}
startActivityForResult(intent, 1001)
}
rv_other_order.adapter = adapter
}
private fun refresh() {
page = 1
......@@ -121,7 +133,7 @@ class PlaceholderFragment : BaseFragment(R.layout.fragment_other_order) {
getOrderList(false)
}
fun getOrderList(isLoadMore: Boolean) {
private fun getOrderList(isLoadMore: Boolean) {
pageViewModel.getOrderList(GsaCloudApplication.getRestaurantId(activity).toString(), arguments?.getInt(INDEX)
?: 0, page.toString(), isLoadMore)
}
......
package com.gingersoft.gsa.delivery_pick_mode.util
import android.net.Uri
import com.gingersoft.gsa.cloud.base.utils.encryption.Base64
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils
import org.json.JSONObject
fun main() {
var url = "https://hktest.ricepon.com:64377/ricepon-web/app/index.html?arg="
var json = JSONObject()
json.put("menutype", 273)
json.put("type", 1)
json.put("shopid", 233)//23233
var jsonString = GsonUtils.GsonString(json)
var lastUrl = Uri.encode(Base64.encode(jsonString.toByteArray())) + "_ricepon_"
println(lastUrl)
}
......@@ -80,7 +80,7 @@ dependencies {
addComponent 'download-module'
addComponent 'table-module'
addComponent 'print-module'
addComponent 'com.gingersoft.gsa.delivery_pick_mode'
addComponent 'delivery_pick_mode'
addComponent 'manager-module'
addComponent 'coldchain-module'
......
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":18,"versionName":"1.2.3","enabled":true,"outputFile":"2020-07-11_GSA-Cloud_1.2.3_ʽ_.apk","fullName":"release","baseName":"release"},"path":"2020-07-11_GSA-Cloud_1.2.3_ʽ_.apk","properties":{}}]
\ No newline at end of file
......@@ -19,7 +19,7 @@ include 'cc-register',
'print-module',
'manager-module',
'manager-module',
'com.gingersoft.gsa.delivery_pick_mode',
'delivery_pick_module',
'tracker',
'coldchain-module',
'order-advance-module'
......
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