Commit ea7060d3 by Wyh

8.13 1、物流取消提示 2、lalamove選擇運輸工具 3、lalamove取消物流後可再次選擇運輸工具

Signed-off-by: Wyh <1239658231>
parent 275bd337
...@@ -40,12 +40,12 @@ public class AppDialog { ...@@ -40,12 +40,12 @@ public class AppDialog {
}.show(); }.show();
} }
public void showSelectDialog(Context context, String title, RecyclerView.Adapter adapter, DialogOnClickListenter sureOnclickListenter) { public void showSelectDialog(Context context, String title, int spanCount, RecyclerView.Adapter adapter, DialogOnClickListenter sureOnclickListenter) {
new DialogUtils(context, R.layout.dialog_select_layout) { new DialogUtils(context, R.layout.dialog_select_layout) {
@Override @Override
public void initLayout(ViewHepler hepler, Dialog dialog) { public void initLayout(ViewHepler hepler, Dialog dialog) {
hepler.setText(R.id.tv_title, title); hepler.setText(R.id.tv_title, title);
hepler.setAdapter(R.id.rv_delivery, new GridLayoutManager(context, 4), adapter); hepler.setAdapter(R.id.rv_delivery, new GridLayoutManager(context, spanCount), adapter);
hepler.setOnClickListenter(R.id.tv_delivery_confirm, v -> sureOnclickListenter.onclick(v, dialog)); hepler.setOnClickListenter(R.id.tv_delivery_confirm, v -> sureOnclickListenter.onclick(v, dialog));
hepler.setOnClickListenter(R.id.tv_delivery_cancel, v -> sureOnclickListenter.onclick(v, dialog)); hepler.setOnClickListenter(R.id.tv_delivery_cancel, v -> sureOnclickListenter.onclick(v, dialog));
} }
......
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical">
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_20">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/shape_white_eight_corners_bg" android:background="@drawable/shape_white_eight_corners_bg"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_20"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
android:layout_marginLeft="@dimen/dp_16" android:layout_marginLeft="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_16" android:layout_marginRight="@dimen/dp_16"
android:layout_marginBottom="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_10"
android:background="@drawable/shape_fifty_tran_green_btn" android:background="@drawable/shape_green_btn"
android:gravity="center" android:gravity="center"
android:paddingTop="@dimen/dp_12" android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12" android:paddingBottom="@dimen/dp_12"
......
...@@ -7,8 +7,8 @@ ext { ...@@ -7,8 +7,8 @@ ext {
targetSdkVersion : 28, targetSdkVersion : 28,
//正式版: 1.0.3 3 //正式版: 1.0.3 3
//內部測試版:1.2.0 20 //內部測試版:1.2.0 20
versionCode : 5, versionCode : 6,
versionName : "1.0.5" versionName : "1.0.6"
] ]
version = [ version = [
......
package com.gingersoft.gsa.other_order_mode.data package com.gingersoft.gsa.other_order_mode.data
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.cloud.base.utils.JsonUtils
import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils import com.gingersoft.gsa.cloud.base.utils.gson.GsonUtils
import com.gingersoft.gsa.cloud.constans.AppConstans import com.gingersoft.gsa.cloud.base.utils.other.TextUtil
import com.gingersoft.gsa.cloud.print.bean.OrderDetails import com.gingersoft.gsa.cloud.print.bean.OrderDetails
import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.ThirdItem import com.gingersoft.gsa.other_order_mode.data.model.bean.ThirdItem
import com.gingersoft.gsa.other_order_mode.data.model.bean.UpdateOrderStatusBean import com.gingersoft.gsa.other_order_mode.data.model.bean.UpdateOrderStatusBean
import com.gingersoft.gsa.other_order_mode.data.network.CoolWeatherNetwork import com.gingersoft.gsa.other_order_mode.data.network.CoolWeatherNetwork
...@@ -15,7 +13,6 @@ import kotlinx.coroutines.Dispatchers ...@@ -15,7 +13,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import okhttp3.FormBody import okhttp3.FormBody
import okhttp3.MediaType import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody import okhttp3.RequestBody
import kotlin.Pair as Pair1 import kotlin.Pair as Pair1
...@@ -117,12 +114,14 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -117,12 +114,14 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
} }
suspend fun thirdDelivery(orderId: String, thirdItem: ThirdItem) = withContext(Dispatchers.IO) { suspend fun thirdDelivery(orderId: String, trafficType: String = "", thirdItem: ThirdItem) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
.add("orderId", orderId) .add("orderId", orderId)
.add("items", Gson().toJson(thirdItem)) .add("items", Gson().toJson(thirdItem))
.build() if (TextUtil.isNotEmptyOrNullOrUndefined(trafficType)) {
network.thirdDelivery(requestBody) requestBody.add("trafficType", trafficType)//運輸類型 1摩托車 2麵包車 3卡車
}
network.thirdDelivery(requestBody.build())
} }
suspend fun updateSelfOrderStatus(ids: String, status: String, restaurantId: String) = withContext(Dispatchers.IO) { suspend fun updateSelfOrderStatus(ids: String, status: String, restaurantId: String) = withContext(Dispatchers.IO) {
...@@ -135,6 +134,9 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -135,6 +134,9 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
data data
} }
suspend fun getTransportationConfig(restaurantId: String) = withContext(Dispatchers.IO) {
network.getTransportationConfig(restaurantId)
}
suspend fun getDeliveryInfo(restId: String, userId: String) = withContext(Dispatchers.IO) { suspend fun getDeliveryInfo(restId: String, userId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
...@@ -152,8 +154,8 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -152,8 +154,8 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
network.getDeliveryConfigDTO(requestBody) network.getDeliveryConfigDTO(requestBody)
} }
suspend fun cancelLogistics(shopId: String, orderId: String, reasonId: String, reasonDesc: String) = withContext(Dispatchers.IO) { suspend fun cancelLogistics(restaurantId: String, orderId: String, reasonId: String, reasonDesc: String) = withContext(Dispatchers.IO) {
network.cancelLogistics(getBody("restaurantId" to shopId, "orderId" to orderId, "reasonId" to reasonId, "reasonDesc" to reasonDesc)) network.cancelLogistics(getBody("restaurantId" to restaurantId, "orderId" to orderId, "reasonId" to reasonId, "reasonDesc" to reasonDesc))
} }
suspend fun updateOrderStates(memberId: String, orderId: String, status: String, updateBy: String, reasonId: String, reasonDesc: String) = withContext(Dispatchers.IO) { suspend fun updateOrderStates(memberId: String, orderId: String, status: String, updateBy: String, reasonId: String, reasonDesc: String) = withContext(Dispatchers.IO) {
...@@ -161,7 +163,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw ...@@ -161,7 +163,7 @@ class WeatherRepository private constructor(private val network: CoolWeatherNetw
} }
suspend fun getCancelReason(brandId: Int, restaurantId: Int, type: Int) = withContext(Dispatchers.IO) { suspend fun getCancelReason(brandId: Int, restaurantId: Int, type: Int) = withContext(Dispatchers.IO) {
// val requestBody = FormBody.Builder() // val requestBody = FormBody.Builder()
// .add("brandId", brandId) // .add("brandId", brandId)
// .add("restaurantId", restaurantId) // .add("restaurantId", restaurantId)
// .add("type", type)//取消原因類型,1食品取消,2,物流取消,3,訂單取消 // .add("type", type)//取消原因類型,1食品取消,2,物流取消,3,訂單取消
......
...@@ -12,6 +12,7 @@ class BtnBuilder { ...@@ -12,6 +12,7 @@ class BtnBuilder {
val assignDeliveryBtn = 4 val assignDeliveryBtn = 4
val closingBtn = 5 val closingBtn = 5
val ProductionCompletedBtn = 6 val ProductionCompletedBtn = 6
val TransportationBtn = 7//選擇運輸工具
} }
class BtnBean(val type: Int, val btnContent: String, val btnColor: Int, val btnImg: Int) class BtnBean(val type: Int, val btnContent: String, val btnColor: Int, val btnImg: Int)
...@@ -44,5 +45,9 @@ class BtnBuilder { ...@@ -44,5 +45,9 @@ class BtnBuilder {
return BtnBean(closingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing) return BtnBean(closingBtn, "結賬", R.color.other_order_details_cancel_btn_color, R.drawable.ic_closing)
} }
fun getTransportationBtn():BtnBean{
return BtnBean(TransportationBtn, "運輸工具", R.color.other_order_details_cancel_logistics_btn_color, R.drawable.ic_logistics)
}
} }
...@@ -214,13 +214,11 @@ class GetInfoUpdateService : Service() { ...@@ -214,13 +214,11 @@ class GetInfoUpdateService : Service() {
} }
//-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知" //-1斷開連接,\n-2:消息傳輸錯誤,\n0:連接消息,\n1:登錄通知,\n2:登出通知,\n3:外賣送單通知,\n4:自取送單通知,\n5:歷史訂單通知,\n6:修改訂單狀態通知,\n7:支付成功通知"
if (type == 3 || type == 4 || type == 5 if (type == 3 || type == 4 || type == 5
|| type == 6 || type == 7) { || type == 7) {
if (type == 6) { //播放提示音
initSoundPool(R.raw.newordervocal)
} else { } else if (type == 8) {
//播放提示音 initSoundPool(R.raw.raw_logistics_cancel)
initSoundPool(R.raw.newordervocal)
}
} }
//收到服务器端传过来的消息text //收到服务器端传过来的消息text
Log.e(TAG, "onMessage:" + text!!) Log.e(TAG, "onMessage:" + text!!)
...@@ -280,23 +278,23 @@ class GetInfoUpdateService : Service() { ...@@ -280,23 +278,23 @@ class GetInfoUpdateService : Service() {
private var lastSoundTime: Long = 0L private var lastSoundTime: Long = 0L
fun initSoundPool(resId: Int) { fun initSoundPool(resId: Int) {
val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲 val nowTime = System.currentTimeMillis()//當前時間減去上次播放的時間,如果超過五秒,那麼才會再次播放提示聲
if (resId == R.raw.newordervocal) { // if (resId == R.raw.newordervocal) {
if (nowTime - lastSoundTime > 5000) { if (nowTime - lastSoundTime > 5000) {
Log.e("eee", "間隔時間" + (nowTime - lastSoundTime)) Log.e("eee", "間隔時間" + (nowTime - lastSoundTime))
putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime") putTimeLog("現在時間:$nowTime 上次播放時間:$lastSoundTime")
putTimeLog("新訂單播放:$nowTime") putTimeLog("新訂單播放:$nowTime")
lastSoundTime = nowTime
OtherOrderUtils.initSoundPool(this, resId)
}
} else {
lastSoundTime = nowTime lastSoundTime = nowTime
OtherOrderUtils.initSoundPool(this, resId) OtherOrderUtils.initSoundPool(this, resId)
} }
// } else {
// lastSoundTime = nowTime
// OtherOrderUtils.initSoundPool(this, resId)
// }
} }
/*获取一条随机字符串*/ /*获取一条随机字符串*/
fun getRandomString(length: Int): String { //length表示生成字符串的长度 fun getRandomString(length: Int): String { //length表示生成字符串的长度
val base = "abcdefghijklmnopqrstuvwxyz0123456789" + System.currentTimeMillis() val base = "abcdefghijklmnopqrstuvwxyz0123456789"
val random = Random() val random = Random()
val sb = StringBuffer() val sb = StringBuffer()
for (i in 0 until length) { for (i in 0 until length) {
......
...@@ -309,7 +309,6 @@ class OtherOrderActivity : BaseActivity() { ...@@ -309,7 +309,6 @@ class OtherOrderActivity : BaseActivity() {
} }
}) })
bind?.execute { bind?.execute {
Log.e("eee", "執行" + it)
if (it) { if (it) {
ivDisconnectView.visibility = View.VISIBLE ivDisconnectView.visibility = View.VISIBLE
} else { } else {
......
package com.gingersoft.gsa.other_order_mode.ui.adapter package com.gingersoft.gsa.other_order_mode.ui.adapter
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.data.model.bean.DeliveryBean
class DeliveryAdapter(data: MutableList<DeliveryBean.Data>) : BaseQuickAdapter<DeliveryBean.Data, BaseViewHolder>(R.layout.other_order_delivery_item, data) { class DeliveryAdapter(data: MutableList<String>) : BaseQuickAdapter<String, BaseViewHolder>(R.layout.other_order_delivery_item, data) {
override fun convert(holder: BaseViewHolder, item: DeliveryBean.Data) {
holder.setText(R.id.tv_delivery_name, item.userName) init {
setOnItemClickListener { adapter, view, position ->
selectIndex = position
adapter.notifyDataSetChanged()
}
}
override fun convert(holder: BaseViewHolder, item: String) {
holder.setText(R.id.tv_delivery_name, item)
if (holder.adapterPosition == selectIndex) { if (holder.adapterPosition == selectIndex) {
holder.setBackgroundResource(R.id.layout_delivery_item, R.drawable.shape_delivery_item_btn) holder.setBackgroundResource(R.id.layout_delivery_item, R.drawable.shape_delivery_item_btn)
holder.setTextColor(R.id.tv_delivery_name, context.resources.getColor(R.color.order_state0_color)) holder.setTextColor(R.id.tv_delivery_name, ContextCompat.getColor(context, R.color.order_state0_color))
} else { } else {
holder.setBackgroundResource(R.id.layout_delivery_item, R.drawable.shape_delivery_item_btn_normal) holder.setBackgroundResource(R.id.layout_delivery_item, R.drawable.shape_delivery_item_btn_normal)
holder.setTextColor(R.id.tv_delivery_name, context.resources.getColor(R.color.color_c8)) holder.setTextColor(R.id.tv_delivery_name, ContextCompat.getColor(context, R.color.color_c8))
} }
} }
var selectIndex = -1 var selectIndex = -1
} }
...@@ -35,7 +35,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -35,7 +35,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_other_order_item, parent, false)) return ViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.layout_delivery_order_item, parent, false))
} }
...@@ -65,31 +65,23 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -65,31 +65,23 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
val bg = GradientDrawable() val bg = GradientDrawable()
bg.cornerRadius = dp2px(5f).toFloat() bg.cornerRadius = dp2px(5f).toFloat()
holder.flBorder.visibility = View.GONE//隱藏邊框 holder.flBorder.visibility = View.GONE//隱藏邊框
//執行動畫
if (data.isRead == 0) {
holder.flBorder.visibility = View.VISIBLE//顯示邊框
alphaAnimator(holder.flBorder)
} else {
holder.flBorder.visibility = View.GONE
holder.flBorder.clearAnimation()
}
when { when {
data.STATUS == 0 -> { data.STATUS == 0 -> {
state = "待確認" state = "待確認"
bg.setColor(getColor(R.color.order_state0_color)) bg.setColor(getColor(R.color.order_state0_color))
//執行動畫
if (data.isRead == 0) {
holder.flBorder.visibility = View.VISIBLE//顯示邊框
alphaAnimator(holder.flBorder)
} else {
holder.flBorder.visibility = View.GONE
holder.flBorder.clearAnimation()
}
} }
data.STATUS == 1 -> { data.STATUS == 1 -> {
state = "待確認" state = "待確認"
bg.setColor(getColor(R.color.order_state0_color)) bg.setColor(getColor(R.color.order_state0_color))
holder.flBorder.visibility = View.VISIBLE//顯示邊框 holder.flBorder.visibility = View.VISIBLE//顯示邊框
//執行動畫
if (data.isRead == 0) {
holder.flBorder.visibility = View.VISIBLE//顯示邊框
alphaAnimator(holder.flBorder)
} else {
holder.flBorder.visibility = View.GONE
holder.flBorder.clearAnimation()
}
} }
data.STATUS == 2 -> { data.STATUS == 2 -> {
state = "製作中" state = "製作中"
...@@ -183,7 +175,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View ...@@ -183,7 +175,7 @@ class OtherOrdersAdapter(var context: Context) : Adapter<OtherOrdersAdapter.View
} }
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var binding: LayoutOtherOrderItemBinding = DataBindingUtil.bind(itemView)!! var binding: LayoutDeliveryOrderItemBinding = DataBindingUtil.bind(itemView)!!
var flBorder: FrameLayout = itemView.findViewById(R.id.fl_border) var flBorder: FrameLayout = itemView.findViewById(R.id.fl_border)
} }
} }
\ No newline at end of file
...@@ -29,8 +29,8 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel: ...@@ -29,8 +29,8 @@ fun Activity.showWaringDialog(title: String, confirm: (Dialog) -> Unit, cancel:
} }
} }
fun Activity.showSelectDialog(title: String, adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit){ fun Activity.showSelectDialog(title: String, spanCount:Int,adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>, confirm: (Dialog) -> Unit, cancel: (Dialog) -> Unit){
AppDialog().showSelectDialog(this, title, adapter){view, dialog-> AppDialog().showSelectDialog(this, title, spanCount, adapter){view, dialog->
when (view.id) { when (view.id) {
R.id.tv_delivery_confirm -> { R.id.tv_delivery_confirm -> {
confirm.invoke(dialog) confirm.invoke(dialog)
......
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