Commit 181d2f99 by Wyh

6.2

parent 66890d15
...@@ -87,7 +87,6 @@ public class HttpsConstans { ...@@ -87,7 +87,6 @@ public class HttpsConstans {
public static void init(Context context) { public static void init(Context context) {
isFormal = (boolean) SPUtils.get(context, "isFormal", true); isFormal = (boolean) SPUtils.get(context, "isFormal", true);
Log.e("eee", "是否正式" + isFormal);
_SERVER_ADDRESS = (isFormal ? HTTP_ADDRESS_URL_FORMAL : "http://a.ricepon.com:61177") + "/member-web/api/"; _SERVER_ADDRESS = (isFormal ? HTTP_ADDRESS_URL_FORMAL : "http://a.ricepon.com:61177") + "/member-web/api/";
ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = isFormal ? HTTP_ADDRESS_URL_FORMAL : REPORT_TEST_ADDRESS; ROOT_SETTLEMENT_REPORT_SERVER_ADDRESS_FORMAL = isFormal ? HTTP_ADDRESS_URL_FORMAL : REPORT_TEST_ADDRESS;
ROOT_SERVER_ADDRESS_FORMAL = (isFormal ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH; ROOT_SERVER_ADDRESS_FORMAL = (isFormal ? HTTP_ADDRESS_URL_FORMAL : HTTP_ADDRESS_URL_HK) + PATH;
......
...@@ -450,6 +450,7 @@ ...@@ -450,6 +450,7 @@
<color name="color_8f">#8f8f8f</color> <color name="color_8f">#8f8f8f</color>
<color name="color_3c">#3c3c3c</color> <color name="color_3c">#3c3c3c</color>
<color name="color_f6">#f6f6f6</color>
<color name="color_e4">#E4E4E4</color> <color name="color_e4">#E4E4E4</color>
<color name="color_f0">#F0F0F0</color> <color name="color_f0">#F0F0F0</color>
<color name="color_cf">#CFCFCF</color> <color name="color_cf">#CFCFCF</color>
......
...@@ -66,8 +66,8 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas ...@@ -66,8 +66,8 @@ public class BaseLoginPresenter<M extends BaseLoginContract.Model, V extends Bas
.build(); .build();
mModel.login(requestBody) mModel.login(requestBody)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("登錄中..."))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(disposable -> mRootView.showLoading("登錄中..."))
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView)) .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
......
...@@ -55,7 +55,6 @@ public class ReportActivity extends BaseActivity<ReportPresenter> implements Rep ...@@ -55,7 +55,6 @@ public class ReportActivity extends BaseActivity<ReportPresenter> implements Rep
@BindView(R2.id.report_viewpager) @BindView(R2.id.report_viewpager)
ViewPager mViewPager; ViewPager mViewPager;
private TabFragmentAdapter mTabFragmentAdapter; private TabFragmentAdapter mTabFragmentAdapter;
private List<String> titles; private List<String> titles;
......
...@@ -4,6 +4,7 @@ import android.content.Intent; ...@@ -4,6 +4,7 @@ import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -298,6 +299,7 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales ...@@ -298,6 +299,7 @@ public class SalesFragment extends BaseFragment<SalesPresenter> implements Sales
//金額佔比 //金額佔比
float money = MoneyUtil.divide(info.get(i).getAmount(), totalAmount, 2, ROUND_HALF_UP); float money = MoneyUtil.divide(info.get(i).getAmount(), totalAmount, 2, ROUND_HALF_UP);
if (money > 0.03) { if (money > 0.03) {
Log.e("eee", "食品名:" + info.get(i).getProductName());
entries.add(new PieEntry(money, info.get(i).getProductName())); entries.add(new PieEntry(money, info.get(i).getProductName()));
} }
} }
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="食品銷售" android:text="食品銷售金額"
android:textColor="#181818" android:textColor="#181818"
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
android:layout_marginBottom="@dimen/dp_24" android:layout_marginBottom="@dimen/dp_24"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:text="食品銷售前十" android:text="食品銷售數量前十"
android:textColor="#181818" android:textColor="#181818"
android:textSize="@dimen/sp_17" /> android:textSize="@dimen/sp_17" />
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
package="com.gingersoft.gsa.other_order_mode"> package="com.gingersoft.gsa.other_order_mode">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<application> <application>
<activity <activity
android:name=".ui.activity.OtherOrderActivity" android:name=".ui.activity.OtherOrderActivity"
......
...@@ -7,14 +7,26 @@ import okhttp3.FormBody ...@@ -7,14 +7,26 @@ import okhttp3.FormBody
class DeliveryRepository private constructor(private val network: DeliveryNetwork) { class DeliveryRepository private constructor(private val network: DeliveryNetwork) {
suspend fun queryDeliveryList(restaurantId: String) = withContext(Dispatchers.IO){ suspend fun queryDeliveryList(restaurantId: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder() val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId) .add("restaurantId", restaurantId)
.build() .build()
network.queryDeliveryList(requestBody) network.queryDeliveryList(requestBody)
} }
suspend fun addDeliveryConfig(distributionFeeMin: String, distributionFeeMax: String,
distributionFee: String, deliveryCost: String,
distributionType: String, type: String,
desc: String, restaurantId: String,
createBy: String, lackPrice: String) = withContext(Dispatchers.IO) {
val requestBody = FormBody.Builder()
.add("restaurantId", restaurantId)
.build()
network.queryDeliveryList(requestBody)
}
companion object { companion object {
......
package com.gingersoft.gsa.other_order_mode.data.model.bean package com.gingersoft.gsa.other_order_mode.data.model.bean
import java.io.Serializable
data class DeliveryConfig( data class DeliveryConfig(
val `data`: Data, val `data`: Data,
val success: Boolean, val success: Boolean,
val sysTime: Long) { val sysTime: Long) {
data class Data(val list: List<DeliveryInfo>) { data class Data(val list: List<DeliveryInfo>) {
data class DeliveryInfo( data class DeliveryInfo (
val addressDetail: String, val addressDetail: String,
val deliveryCost: Double, val deliveryCost: Double,
val desc: String, val desc: String,
...@@ -20,8 +22,9 @@ data class DeliveryConfig( ...@@ -20,8 +22,9 @@ data class DeliveryConfig(
val restaurantId: Int, val restaurantId: Int,
val restaurantName: String, val restaurantName: String,
val restaurantPhone: String, val restaurantPhone: String,
val lackPrice:Double,
val type: Int//為1時是第三方配送 val type: Int//為1時是第三方配送
) ) : Serializable
} }
} }
\ No newline at end of file
...@@ -21,6 +21,10 @@ class DeliveryNetwork { ...@@ -21,6 +21,10 @@ class DeliveryNetwork {
//獲取物流配置 //獲取物流配置
suspend fun queryDeliveryList(requestBody: RequestBody) = gsposService.queryDeliveryList(requestBody).await() suspend fun queryDeliveryList(requestBody: RequestBody) = gsposService.queryDeliveryList(requestBody).await()
//獲取物流配置
suspend fun addDeliveryList(requestBody: RequestBody) = gsposService.addDeliveryList(requestBody).await()
private suspend fun <T> Call<T>.await(): T { private suspend fun <T> Call<T>.await(): T {
return suspendCoroutine { continuation -> return suspendCoroutine { continuation ->
......
...@@ -11,6 +11,7 @@ interface DeliveryService { ...@@ -11,6 +11,7 @@ interface DeliveryService {
@POST("gsa/getDeliveryConfigDTO") @POST("gsa/getDeliveryConfigDTO")
fun queryDeliveryList(@Body requestBody: RequestBody): Call<DeliveryConfig> fun queryDeliveryList(@Body requestBody: RequestBody): Call<DeliveryConfig>
@POST("gsa/addDeliveryConfig")
fun addDeliveryList(@Body requestBody: RequestBody): Call<String>
} }
\ No newline at end of file
...@@ -16,4 +16,6 @@ class DeliveryViewModel(private val repository: DeliveryRepository) : BaseViewMo ...@@ -16,4 +16,6 @@ class DeliveryViewModel(private val repository: DeliveryRepository) : BaseViewMo
} }
} }
...@@ -571,6 +571,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -571,6 +571,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
*/ */
fun cancelOrder(context: Context, orderId: String, listener: (Boolean) -> Unit) { fun cancelOrder(context: Context, orderId: String, listener: (Boolean) -> Unit) {
launch({ launch({
showLoading(context)
repository.updateOrderStates(GsaCloudApplication.getMemberId(context).toString(), orderId, "6", GsaCloudApplication.getMemberName(context)).apply { repository.updateOrderStates(GsaCloudApplication.getMemberId(context).toString(), orderId, "6", GsaCloudApplication.getMemberName(context)).apply {
listener.invoke(code == "1") listener.invoke(code == "1")
} }
......
...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.other_order_mode.ui.activity ...@@ -2,6 +2,7 @@ package com.gingersoft.gsa.other_order_mode.ui.activity
import android.os.Bundle import android.os.Bundle
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.DeliveryConfig
import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity import com.gingersoft.gsa.other_order_mode.ui.base.BaseActivity
import com.gingersoft.gsa.other_order_mode.ui.fragment.UpdateDeliveryFragment import com.gingersoft.gsa.other_order_mode.ui.fragment.UpdateDeliveryFragment
import kotlinx.android.synthetic.main.activity_delivery.* import kotlinx.android.synthetic.main.activity_delivery.*
...@@ -17,9 +18,13 @@ class DeliverySettingActivity : BaseActivity() { ...@@ -17,9 +18,13 @@ class DeliverySettingActivity : BaseActivity() {
top_bar_delivery.setBackgroundColor(resources.getColor(R.color.theme_color)) top_bar_delivery.setBackgroundColor(resources.getColor(R.color.theme_color))
top_bar_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() } top_bar_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { finish() }
top_bar_delivery.addRightImageButton(R.drawable.ic_add, R.id.topbar_right_change_button).setOnClickListener { v -> top_bar_delivery.addRightImageButton(R.drawable.ic_add, R.id.topbar_right_change_button).setOnClickListener { v ->
supportFragmentManager.beginTransaction().replace(R.id.fl_delivery, UpdateDeliveryFragment.newInstance()).addToBackStack(null).commit() supportFragmentManager.beginTransaction().replace(R.id.fl_delivery, UpdateDeliveryFragment.newInstance(null)).addToBackStack(null).commit()
} }
} }
fun editDelivery(info: DeliveryConfig.Data.DeliveryInfo) {
supportFragmentManager.beginTransaction().replace(R.id.fl_delivery, UpdateDeliveryFragment.newInstance(info)).addToBackStack(null).commit()
}
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import android.content.Context ...@@ -4,6 +4,7 @@ import android.content.Context
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.TextView
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder import com.chad.library.adapter.base.BaseViewHolder
...@@ -13,6 +14,7 @@ import com.gingersoft.gsa.other_order_mode.databinding.ItemDeliveryLayoutBinding ...@@ -13,6 +14,7 @@ import com.gingersoft.gsa.other_order_mode.databinding.ItemDeliveryLayoutBinding
class DeliveryListAdapter(val context: Context, data: List<DeliveryConfig.Data.DeliveryInfo>) : BaseQuickAdapter<DeliveryConfig.Data.DeliveryInfo, DeliveryListAdapter.ViewHolder>(data) { class DeliveryListAdapter(val context: Context, data: List<DeliveryConfig.Data.DeliveryInfo>) : BaseQuickAdapter<DeliveryConfig.Data.DeliveryInfo, DeliveryListAdapter.ViewHolder>(data) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_delivery_layout, null) val view = LayoutInflater.from(parent.context).inflate(R.layout.item_delivery_layout, null)
return ViewHolder(view) return ViewHolder(view)
...@@ -22,28 +24,32 @@ class DeliveryListAdapter(val context: Context, data: List<DeliveryConfig.Data.D ...@@ -22,28 +24,32 @@ class DeliveryListAdapter(val context: Context, data: List<DeliveryConfig.Data.D
override fun convert(helper: ViewHolder?, item: DeliveryConfig.Data.DeliveryInfo?) { override fun convert(helper: ViewHolder?, item: DeliveryConfig.Data.DeliveryInfo?) {
helper?.let { helper -> helper?.let { helper ->
helper.binding.apply { helper.binding.apply {
// deliveryType = when(item!!.distributionType){ deliveryType = when (item!!.distributionType) {
// "SHORT_RANGE"-> "SHORT_RANGE" -> "短途送"
// "STANDARD"-> "STANDARD" -> "中途送"
// "LONG_DISTANCE"-> "LONG_DISTANCE" -> "長途送"
// else ->"" else -> ""
// } }
item?.let { it -> item.let {
deliveryType = it.distributionType // deliveryType = it.distributionType
deliveryExpenses = "${it.distributionFeeMin}-${it.distributionFeeMax}" deliveryExpenses = "${it.distributionFeeMin}-${it.distributionFeeMax}"
deliveryFee = it.distributionFee.toString() deliveryFee = it.deliveryCost.toString()
deliveryMethod = if (it.type == 1) "物流備送" else "本店備送" deliveryMethod = if (it.type == 1) "物流備送" else "本店備送"
deliveryDifference = it.deliveryCost.toString() deliveryDifference = it.lackPrice.toString()
} }
} }
helper.getView<TextView>(R.id.iv_delete).setOnClickListener {
onItemChildClickListener?.onItemChildClick(this, it, helper.adapterPosition)
}
helper.itemView.setOnClickListener {
onItemChildClickListener?.onItemChildClick(this, it, helper.adapterPosition)
}
} }
} }
class ViewHolder(itemView: View) : BaseViewHolder(itemView) { class ViewHolder(itemView: View) : BaseViewHolder(itemView) {
var binding: ItemDeliveryLayoutBinding = DataBindingUtil.bind(itemView)!! var binding: ItemDeliveryLayoutBinding = DataBindingUtil.bind(itemView)!!
} }
} }
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.ui.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.gingersoft.gsa.other_order_mode.R
class TextAdapter(list: List<String>) : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_textview, list) {
override fun convert(helper: BaseViewHolder?, item: String?) {
helper?.setText(R.id.tv_item, item)
helper?.itemView!!.setOnClickListener {
if (onItemClickListener != null) {
onItemClickListener.onItemClick(this, it, helper.adapterPosition)
}
}
}
}
\ No newline at end of file
package com.gingersoft.gsa.other_order_mode.ui.fragment package com.gingersoft.gsa.other_order_mode.ui.fragment
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
...@@ -10,6 +11,7 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -10,6 +11,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
import com.gingersoft.gsa.other_order_mode.R import com.gingersoft.gsa.other_order_mode.R
import com.gingersoft.gsa.other_order_mode.model.viewModel.DeliveryViewModel import com.gingersoft.gsa.other_order_mode.model.viewModel.DeliveryViewModel
import com.gingersoft.gsa.other_order_mode.ui.activity.DeliverySettingActivity
import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryListAdapter import com.gingersoft.gsa.other_order_mode.ui.adapter.DeliveryListAdapter
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import kotlinx.android.synthetic.main.fragment_delivery_list.* import kotlinx.android.synthetic.main.fragment_delivery_list.*
...@@ -20,6 +22,8 @@ class DeliveryFragment : Fragment() { ...@@ -20,6 +22,8 @@ class DeliveryFragment : Fragment() {
fun newInstance() = DeliveryFragment() fun newInstance() = DeliveryFragment()
} }
var deliveryListAdapter: DeliveryListAdapter? = null
private lateinit var viewModel: DeliveryViewModel private lateinit var viewModel: DeliveryViewModel
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
...@@ -33,19 +37,29 @@ class DeliveryFragment : Fragment() { ...@@ -33,19 +37,29 @@ class DeliveryFragment : Fragment() {
viewModel.queryDeliveryList(GsaCloudApplication.getRestaurantId(activity!!).toString()) { viewModel.queryDeliveryList(GsaCloudApplication.getRestaurantId(activity!!).toString()) {
if (it?.data?.list != null && it.data.list.isNotEmpty()) { if (it?.data?.list != null && it.data.list.isNotEmpty()) {
val deliveryListAdapter = DeliveryListAdapter(context!!, it.data.list) if (deliveryListAdapter == null) {
rv_delivery.adapter = deliveryListAdapter deliveryListAdapter = DeliveryListAdapter(context!!, it.data.list)
rv_delivery.layoutManager = LinearLayoutManager(context!!) deliveryListAdapter!!.setOnItemChildClickListener { adapter, view, position ->
when (view.id) {
R.id.iv_delete -> {
}//刪除
else -> {
(activity as DeliverySettingActivity).editDelivery(it.data.list[position])
}//查看詳情---編輯
}
}
rv_delivery.adapter = deliveryListAdapter
rv_delivery.layoutManager = LinearLayoutManager(context!!)
} else {
deliveryListAdapter!!.setNewData(it.data.list)
}
rv_delivery.visibility = View.VISIBLE rv_delivery.visibility = View.VISIBLE
} else { } else {
rv_delivery.visibility = View.GONE rv_delivery.visibility = View.GONE
} }
} }
// rv_delivery // rv_delivery
} }
} }
...@@ -75,7 +75,6 @@ class PlaceholderFragment : BaseFragment() { ...@@ -75,7 +75,6 @@ class PlaceholderFragment : BaseFragment() {
} }
R.id.btn_cancel_order -> { R.id.btn_cancel_order -> {
//取消訂單,先判斷有沒有物流 //取消訂單,先判斷有沒有物流
showLoading()
if (it1.data!![0].isDelete == 0) { if (it1.data!![0].isDelete == 0) {
//第三方物流單 //第三方物流單
//彈出彈窗詢問是否確認取消 //彈出彈窗詢問是否確認取消
...@@ -83,6 +82,7 @@ class PlaceholderFragment : BaseFragment() { ...@@ -83,6 +82,7 @@ class PlaceholderFragment : BaseFragment() {
when (v.id) { when (v.id) {
R.id.tv_dialog_confirm -> { R.id.tv_dialog_confirm -> {
//取消物流 //取消物流
showLoading()
pageViewModel.cancelLogistics(GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) { pageViewModel.cancelLogistics(GsaCloudApplication.getRestaurantId(context).toString(), data.Id.toString()) {
ToastUtils.show(context, it) ToastUtils.show(context, it)
cancelDialogForLoading() cancelDialogForLoading()
...@@ -108,7 +108,6 @@ class PlaceholderFragment : BaseFragment() { ...@@ -108,7 +108,6 @@ class PlaceholderFragment : BaseFragment() {
dialog.dismiss() dialog.dismiss()
} }
} }
} }
} else { } else {
ToastUtils.show(context, "獲取訂單詳情失敗") ToastUtils.show(context, "獲取訂單詳情失敗")
......
...@@ -6,24 +6,49 @@ import android.view.View ...@@ -6,24 +6,49 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
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.DeliveryConfig
import com.gingersoft.gsa.other_order_mode.model.viewModel.DeliveryViewModel import com.gingersoft.gsa.other_order_mode.model.viewModel.DeliveryViewModel
import com.gingersoft.gsa.other_order_mode.ui.adapter.TextAdapter
import com.gingersoft.gsa.other_order_mode.util.InjectorUtil import com.gingersoft.gsa.other_order_mode.util.InjectorUtil
import com.jess.arms.utils.ArmsUtils
import com.qmuiteam.qmui.util.QMUIDisplayHelper
import com.qmuiteam.qmui.widget.popup.QMUIPopup
import com.qmuiteam.qmui.widget.popup.QMUIPopups
import com.zhy.autolayout.utils.ScreenUtils
import kotlinx.android.synthetic.main.update_delivery_fragment.* import kotlinx.android.synthetic.main.update_delivery_fragment.*
import org.w3c.dom.Text
class UpdateDeliveryFragment : Fragment() { class UpdateDeliveryFragment : Fragment() {
companion object { companion object {
fun newInstance() = UpdateDeliveryFragment() private const val info = "info"
@JvmStatic
fun newInstance(deliveryConfig: DeliveryConfig.Data.DeliveryInfo?): UpdateDeliveryFragment {
return UpdateDeliveryFragment().apply {
arguments = Bundle().apply {
putSerializable(info, deliveryConfig)
}
}
}
} }
private lateinit var viewModel: DeliveryViewModel private lateinit var viewModel: DeliveryViewModel
var deliveryConfig: DeliveryConfig.Data.DeliveryInfo? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? { savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.update_delivery_fragment, container, false) return inflater.inflate(R.layout.update_delivery_fragment, container, false)
} }
var pop: QMUIPopup? = null
var deliveryType = arrayListOf("短途送", "中途送", "長途送")
var deliveryMethod = arrayListOf("本店備送", "第三方")
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
viewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getDeliveryFactory())[DeliveryViewModel::class.java] viewModel = ViewModelProvider(activity?.viewModelStore!!, InjectorUtil.getDeliveryFactory())[DeliveryViewModel::class.java]
...@@ -32,6 +57,84 @@ class UpdateDeliveryFragment : Fragment() { ...@@ -32,6 +57,84 @@ class UpdateDeliveryFragment : Fragment() {
top_bar_update_delivery.setBackgroundColor(resources.getColor(R.color.theme_color)) top_bar_update_delivery.setBackgroundColor(resources.getColor(R.color.theme_color))
top_bar_update_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { activity?.let { it.onBackPressed() } } top_bar_update_delivery.addLeftImageButton(R.drawable.icon_return, R.id.iv_left_back).setOnClickListener { activity?.let { it.onBackPressed() } }
deliveryConfig = arguments?.getSerializable(info) as DeliveryConfig.Data.DeliveryInfo?
deliveryConfig?.let {
//如果不為空,初始化數據
et_min_delivery_fee.setText(it.distributionFeeMin.toString())
et_max_delivery_fee.setText(it.distributionFeeMax.toString())
ed_delivery_fee.setText(it.distributionFee.toString())
ed_start_delivery_fee.setText(it.distributionFee.toString())
ed_difference_fee.setText(it.lackPrice.toString())
ed_desc.setText(it.desc)
//備送類型
tv_delivery_type.text = when (it.distributionType) {
"LONG_DISTANCE" -> "長途送"
"SHORT_RANGE" -> "短途送"
"STANDARD" -> "中途送"
else -> ""
}
//備送方式
tv_delivery_method.text = when (it.type) {
0 -> "本店備送"
1 -> "第三方"
else -> ""
}
}
layout_delivery_type.setOnClickListener {
//修改備送類型
showPopup(it, deliveryType)
}
layout_delivery_method.setOnClickListener {
//修改配送方式
showPopup(it, deliveryMethod)
}
btn_save_delivery.setOnClickListener {
//保存
}
}
var adapter: TextAdapter? = null
private fun showPopup(it: View, list: List<String>) {
if (pop == null) {
val view = LayoutInflater.from(context).inflate(R.layout.recyclerview, null)
val listView = view.findViewById<RecyclerView>(R.id.ryview)
listView.layoutManager = LinearLayoutManager(context)
adapter = TextAdapter(list)
listView.layoutParams.width = (ArmsUtils.getScreenWidth(context) * 0.7).toInt()
adapter!!.setOnItemChildClickListener { adapter, view, position ->
when (it.id) {
R.id.layout_delivery_type -> {
//修改備送類型
tv_delivery_type.text = list[position]
}
R.id.layout_delivery_method -> {
//修改備送方式
tv_delivery_method.text = list[position]
}
}
}
listView.adapter = adapter
pop = QMUIPopups.popup(context)
.preferredDirection(QMUIPopup.DIRECTION_CENTER_IN_SCREEN)
.view(view)
.radius(QMUIDisplayHelper.dp2px(context, 5))
.arrow(true)
.shadow(true)
.dimAmount(0.6f)
.offsetYIfTop(0)
.animStyle(QMUIPopup.ANIM_AUTO)
.show(it)
} else {
adapter!!.setNewData(list)
pop!!.show(it)
}
} }
} }
...@@ -30,63 +30,126 @@ ...@@ -30,63 +30,126 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<androidx.constraintlayout.widget.Barrier
android:id="@+id/bar_delivery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:barrierDirection="right"
app:constraint_referenced_ids="tv_difference_text,tv_delivery_method_text,tv_delivery_fee_text,tv_delivery_type_text,tv_delivery_expenses_text" />
<TextView <TextView
android:id="@+id/tv_delivery_type" android:id="@+id/tv_delivery_type_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="@{@string/delivery_type+ delivery_type}" android:text="@string/delivery_type"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_delivery_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:gravity="left"
android:text="@{delivery_type}"
app:layout_constraintLeft_toRightOf="@id/bar_delivery"
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="@id/tv_delivery_type_text" />
<TextView <TextView
android:id="@+id/tv_delivery_expenses" android:id="@+id/tv_delivery_expenses_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_expenses + delivery_expenses}" android:text="@string/delivery_expenses"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type" app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type_text"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_type" /> app:layout_constraintTop_toBottomOf="@id/tv_delivery_type_text" />
<TextView <TextView
android:id="@+id/tv_delivery_fee" android:id="@+id/tv_delivery_expenses"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:gravity="left"
android:text="@{delivery_expenses}"
app:layout_constraintLeft_toRightOf="@id/bar_delivery"
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="@id/tv_delivery_expenses_text" />
<TextView
android:id="@+id/tv_delivery_fee_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_fee + delivery_fee}" android:text="@string/delivery_fee"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type" app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type_text"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_expenses" /> app:layout_constraintTop_toBottomOf="@id/tv_delivery_expenses_text" />
<TextView <TextView
android:id="@+id/tv_delivery_method" android:id="@+id/tv_delivery_fee"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:gravity="left"
android:text="@{delivery_fee}"
app:layout_constraintLeft_toRightOf="@id/bar_delivery"
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="@id/tv_delivery_fee_text" />
<TextView
android:id="@+id/tv_delivery_method_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_method + delivery_method}" android:text="@string/delivery_method"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type" app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type_text"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_fee" /> app:layout_constraintTop_toBottomOf="@id/tv_delivery_fee_text" />
<TextView <TextView
android:id="@+id/tv_difference" android:id="@+id/tv_delivery_method"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:gravity="left"
android:text="@{delivery_method}"
app:layout_constraintLeft_toRightOf="@id/bar_delivery"
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="@id/tv_delivery_method_text" />
<TextView
android:id="@+id/tv_difference_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_5"
android:text="@{@string/delivery_difference + delivery_difference}" android:text="@string/delivery_difference"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type" app:layout_constraintLeft_toLeftOf="@id/tv_delivery_type_text"
app:layout_constraintTop_toBottomOf="@id/tv_delivery_method" /> app:layout_constraintTop_toBottomOf="@id/tv_delivery_method_text" />
<TextView
android:id="@+id/tv_difference"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:gravity="left"
android:text="@{delivery_difference}"
app:layout_constraintLeft_toRightOf="@id/bar_delivery"
app:layout_constraintRight_toLeftOf="@id/iv_edit"
app:layout_constraintTop_toTopOf="@id/tv_difference_text" />
<TextView <TextView
android:id="@+id/iv_edit" android:id="@+id/iv_edit"
...@@ -112,14 +175,13 @@ ...@@ -112,14 +175,13 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<View <View
android:id="@+id/horizontal_dividing_line" android:id="@+id/horizontal_dividing_line"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_0_5" android:layout_height="@dimen/dp_0_5"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:background="@color/color_ccc" android:background="@color/color_ccc"
app:layout_constraintTop_toBottomOf="@id/tv_difference" /> app:layout_constraintTop_toBottomOf="@id/tv_difference_text" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginRight="@dimen/dp_20"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:text="短途送"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_16" />
</LinearLayout>
\ No newline at end of file
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_9" android:layout_marginTop="@dimen/dp_9"
android:text="@{data.waimaiSendTime}" android:text="@{data.sendTime}"
android:textColor="#EC2D2D" android:textColor="#EC2D2D"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
android:visibility="visible" android:visibility="visible"
...@@ -164,7 +164,6 @@ ...@@ -164,7 +164,6 @@
app:layout_constraintLeft_toLeftOf="@id/tv_order_user_name" app:layout_constraintLeft_toLeftOf="@id/tv_order_user_name"
app:layout_constraintTop_toBottomOf="@id/tv_order_user_name" /> app:layout_constraintTop_toBottomOf="@id/tv_order_user_name" />
<TextView <TextView
android:id="@+id/tv_order_num_text" android:id="@+id/tv_order_num_text"
style="@style/otherOrder_item_info_title_textStyle" style="@style/otherOrder_item_info_title_textStyle"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/ryview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/color_f6"
android:orientation="vertical"
tools:context=".ui.fragment.UpdateDeliveryFragment"> tools:context=".ui.fragment.UpdateDeliveryFragment">
<com.qmuiteam.qmui.widget.QMUITopBar <com.qmuiteam.qmui.widget.QMUITopBar
...@@ -16,5 +17,217 @@ ...@@ -16,5 +17,217 @@
app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color" app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
app:qmui_topbar_title_color="@color/theme_white_color" /> app:qmui_topbar_title_color="@color/theme_white_color" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:background="@color/white"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10">
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="運費範圍:" />
<EditText
android:id="@+id/et_min_delivery_fee"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_30"
android:background="@color/trans"
android:inputType="number" />
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="——" />
<EditText
android:id="@+id/et_max_delivery_fee"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_30"
android:background="@color/trans"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_2"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10">
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="配送費:" />
<EditText
android:id="@+id/ed_delivery_fee"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:background="@color/trans"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_2"
android:background="@color/white"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_10">
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="起送費:" />
<EditText
android:id="@+id/ed_start_delivery_fee"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="0dp"
android:layout_height="@dimen/dp_30"
android:layout_weight="0.7"
android:background="@color/trans"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_delivery_type"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/white"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10">
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="備送類型:" />
<TextView
android:id="@+id/tv_delivery_type"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:text="短途送" />
</androidx.constraintlayout.widget.ConstraintLayout> <ImageView
\ No newline at end of file android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:src="@drawable/ic_black_next_arrow" />
</LinearLayout>
<LinearLayout
android:id="@+id/layout_delivery_method"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_2"
android:background="@color/white"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10">
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="備送方式:" />
<TextView
android:id="@+id/tv_delivery_method"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:text="本店備送" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:src="@drawable/ic_black_next_arrow" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_2"
android:background="@color/white"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10">
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="補差價:" />
<EditText
android:id="@+id/ed_difference_fee"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:background="@color/trans"
android:inputType="number" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_50"
android:layout_marginTop="@dimen/dp_10"
android:background="@color/white"
android:gravity="center_vertical"
android:paddingLeft="@dimen/dp_10">
<TextView
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="描述:" />
<EditText
android:id="@+id/ed_desc"
style="@style/otherOrderInfoDialogTextStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:background="@color/trans"
android:inputType="number" />
</LinearLayout>
<com.qmuiteam.qmui.alpha.QMUIAlphaButton
android:id="@+id/btn_save_delivery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_20"
android:background="@drawable/shape_app_btn"
android:gravity="center"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10"
android:text="保存"
android:textColor="@color/white"
android:textSize="@dimen/dp_16" />
</LinearLayout>
\ No newline at end of file
package com.joe.print.mvp.model.bean;
public class PrintBillBean {
public PrintBillBean(String billName, String billAmount) {
this.billName = billName;
this.billAmount = billAmount;
}
private String billName;
private String billAmount;
public String getBillName() {
return billName;
}
public void setBillName(String billName) {
this.billName = billName;
}
public String getBillAmount() {
return billAmount;
}
public void setBillAmount(String billAmount) {
this.billAmount = billAmount;
}
}
...@@ -15,6 +15,8 @@ import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage; ...@@ -15,6 +15,8 @@ import com.gingersoft.gsa.cloud.base.common.bean.mealManage.MyOrderManage;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil; import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.base.utils.other.TextUtil; import com.gingersoft.gsa.cloud.base.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.base.utils.time.TimeUtils;
import com.joe.print.mvp.model.bean.PrintBillBean;
import com.joe.print.mvp.ui.adapter.BillItemAdapter;
import com.joe.print.mvp.ui.adapter.OtherOrderAdapter; import com.joe.print.mvp.ui.adapter.OtherOrderAdapter;
import com.gingersoft.gsa.cloud.print.bean.OrderDetails; import com.gingersoft.gsa.cloud.print.bean.OrderDetails;
import com.joe.print.R; import com.joe.print.R;
...@@ -195,19 +197,43 @@ public class PrintOtherOrder extends PrinterRoot { ...@@ -195,19 +197,43 @@ public class PrintOtherOrder extends PrinterRoot {
//訂單創建時間 //訂單創建時間
setText(view, R.id.tv_order_create, context.getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT)); setText(view, R.id.tv_order_create, context.getString(R.string.create_order_time) + TimeUtils.parseTimeRepeat(data.getCREATE_TIME(), TimeUtils.DEFAULT_DATE_FORMAT));
String amountUnit = context.getString(R.string.amount_unit); String amountUnit = context.getString(R.string.amount_unit);
//總金額
setText(view, R.id.tv_total, amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(Objects.requireNonNull(data.getTOTAL_AMOUNT())), data.getLunchbox()), data.getDELIVERY_CHARGE()));
RecyclerView rvBill = view.findViewById(R.id.rv_bill);
List<PrintBillBean> billData = new ArrayList<>();
billData.add(getBillBean("合計:", amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(Objects.requireNonNull(data.getTOTAL_AMOUNT())), data.getLunchbox()), data.getDELIVERY_CHARGE())));
if (data.getLunchbox() != 0) {
billData.add(getBillBean("餐盒費:", amountUnit + data.getLunchbox()));
}
if (data.getDELIVERY_CHARGE() != 0) {
billData.add(getBillBean("送貨費:", amountUnit + data.getDELIVERY_CHARGE()));
}
if (data.getDiscount_amount() != 0) {
billData.add(getBillBean("折扣:", "-" + amountUnit + data.getDiscount_amount()));
}
if (data.getCouponList() != null && data.getCouponList().size() > 0) {
for (OrderDetails.DataBean.CouponBean coupon : data.getCouponList()) {
billData.add(getBillBean(coupon.getCouponName(), "-$" + coupon.getDiscount_amount()));
}
}
billData.add(getBillBean("總金額:", amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount())));
billData.add(getBillBean("支付金額:", amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount())));
BillItemAdapter adapter = new BillItemAdapter(billData, context);
rvBill.setLayoutManager(new LinearLayoutManager(context));
rvBill.setAdapter(adapter);
//總金額
// setText(view, R.id.tv_total, amountUnit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(Objects.requireNonNull(data.getTOTAL_AMOUNT())), data.getLunchbox()), data.getDELIVERY_CHARGE()));
//餐盒費 //餐盒費
setAmount(data.getLunchbox(), view.findViewById(R.id.tv_lunchbox_cost_text), view.findViewById(R.id.tv_lunchbox_cost), amountUnit); // setAmount(data.getLunchbox(), view.findViewById(R.id.tv_lunchbox_cost_text), view.findViewById(R.id.tv_lunchbox_cost), amountUnit);
//配送費 //配送費
setAmount(data.getDELIVERY_CHARGE(), view.findViewById(R.id.tv_delivery_fee_text), view.findViewById(R.id.tv_delivery_fee), amountUnit); // setAmount(data.getDELIVERY_CHARGE(), view.findViewById(R.id.tv_delivery_fee_text), view.findViewById(R.id.tv_delivery_fee), amountUnit);
//折扣 //折扣
setAmount(data.getDiscount_amount(), view.findViewById(R.id.tv_discount_text), view.findViewById(R.id.tv_discount), "-" + amountUnit); // setAmount(data.getDiscount_amount(), view.findViewById(R.id.tv_discount_text), view.findViewById(R.id.tv_discount), "-" + amountUnit);
//總金額 //總金額
setText(view, R.id.tv_total_amount, amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount())); // setText(view, R.id.tv_total_amount, amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
//支付金額 //支付金額
setText(view, R.id.tv_pay_amount, amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount())); // setText(view, R.id.tv_pay_amount, amountUnit + MoneyUtil.sub(Double.parseDouble(data.getTOTAL_AMOUNT()), data.getDiscount_amount()));
//支付類型:貨到付款,在線支付 //支付類型:貨到付款,在線支付
setText(view, R.id.tv_pay_type, data.getOrderPayType() == 1 ? "貨到付款" : "在線支付"); setText(view, R.id.tv_pay_type, data.getOrderPayType() == 1 ? "貨到付款" : "在線支付");
//收貨時間 //收貨時間
...@@ -220,6 +246,7 @@ public class PrintOtherOrder extends PrinterRoot { ...@@ -220,6 +246,7 @@ public class PrintOtherOrder extends PrinterRoot {
setText(view, R.id.tv_phone, "手機號:" + data.getPHONE()); setText(view, R.id.tv_phone, "手機號:" + data.getPHONE());
//備註 //備註
setText(view, R.id.tv_remark, "備註:" + data.getRemark()); setText(view, R.id.tv_remark, "備註:" + data.getRemark());
if (data.getPRODUCT_NAME() != null) { if (data.getPRODUCT_NAME() != null) {
RecyclerView rvFoodList = view.findViewById(R.id.rv_order_print_food); RecyclerView rvFoodList = view.findViewById(R.id.rv_order_print_food);
rvFoodList.setLayoutManager(new LinearLayoutManager(context)); rvFoodList.setLayoutManager(new LinearLayoutManager(context));
...@@ -228,6 +255,10 @@ public class PrintOtherOrder extends PrinterRoot { ...@@ -228,6 +255,10 @@ public class PrintOtherOrder extends PrinterRoot {
return viewToBitmap(context, view); return viewToBitmap(context, view);
} }
private PrintBillBean getBillBean(String title, String value) {
return new PrintBillBean(title, value);
}
private void setAmount(Double data, TextView tvText, TextView tvAmount, String amountUnit) { private void setAmount(Double data, TextView tvText, TextView tvAmount, String amountUnit) {
if (data <= 0) { if (data <= 0) {
tvText.setVisibility(View.GONE); tvText.setVisibility(View.GONE);
......
package com.joe.print.mvp.ui.adapter;
import android.content.Context;
import androidx.annotation.Nullable;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.gingersoft.gsa.cloud.base.common.bean.BillingBean;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.joe.print.R;
import com.joe.print.mvp.model.bean.PrintBillBean;
import java.util.HashMap;
import java.util.List;
/**
* Created by Wyh on 2020/1/16.
*/
public class BillItemAdapter extends BaseQuickAdapter<PrintBillBean, BaseViewHolder> {
private Context mContext;
public BillItemAdapter(@Nullable List<PrintBillBean> data, Context mContext) {
super(R.layout.print_item_bill, data);
this.mContext = mContext;
}
@Override
protected void convert(BaseViewHolder helper, PrintBillBean item) {
helper.setText(R.id.print_bill_name, item.getBillName());
helper.setText(R.id.print_bill_value, item.getBillAmount());
}
}
...@@ -43,7 +43,6 @@ public class OtherOrderAdapter extends BaseQuickAdapter<OrderDetails.DataBean.PR ...@@ -43,7 +43,6 @@ public class OtherOrderAdapter extends BaseQuickAdapter<OrderDetails.DataBean.PR
if (helper.getAdapterPosition() == 0) { if (helper.getAdapterPosition() == 0) {
indentation = px2dp(context, (int) ((TextView) helper.getView(R.id.tv_food_name)).getTextSize()); indentation = px2dp(context, (int) ((TextView) helper.getView(R.id.tv_food_name)).getTextSize());
Log.e("eee", "寬度:" + indentation);
} }
if (item.getChild() != null && item.getChild().size() > 0) { if (item.getChild() != null && item.getChild().size() > 0) {
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
android:text="" android:text=""
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_22" android:textSize="@dimen/dp_22"
android:textStyle="bold"/> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<TextView <TextView
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="合計:" android:text="合計:"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
...@@ -154,15 +155,21 @@ ...@@ -154,15 +155,21 @@
style="@style/printOtherOrderInfoPrintBoldTextStyle" style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_total_text" /> app:layout_constraintTop_toTopOf="@id/tv_total_text" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_bill"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/tv_lunchbox_cost_text" android:id="@+id/tv_lunchbox_cost_text"
style="@style/printOtherOrderInfoPrintBoldTextStyle" style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:visibility="gone"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="餐盒費:" android:text="餐盒費:"
...@@ -175,6 +182,7 @@ ...@@ -175,6 +182,7 @@
style="@style/printOtherOrderInfoPrintBoldTextStyle" style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_lunchbox_cost_text" /> app:layout_constraintTop_toTopOf="@id/tv_lunchbox_cost_text" />
...@@ -186,6 +194,7 @@ ...@@ -186,6 +194,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="送貨費:" android:text="送貨費:"
android:visibility="gone"
android:textStyle="normal" android:textStyle="normal"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_lunchbox_cost" /> app:layout_constraintTop_toBottomOf="@id/tv_lunchbox_cost" />
...@@ -195,6 +204,7 @@ ...@@ -195,6 +204,7 @@
style="@style/printOtherOrderInfoPrintBoldTextStyle" style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_delivery_fee_text" /> app:layout_constraintTop_toTopOf="@id/tv_delivery_fee_text" />
...@@ -205,6 +215,7 @@ ...@@ -205,6 +215,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:visibility="gone"
android:text="折扣:" android:text="折扣:"
android:textStyle="normal" android:textStyle="normal"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
...@@ -214,6 +225,7 @@ ...@@ -214,6 +225,7 @@
android:id="@+id/tv_discount" android:id="@+id/tv_discount"
style="@style/printOtherOrderInfoPrintBoldTextStyle" style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:visibility="gone"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_discount_text" /> app:layout_constraintTop_toTopOf="@id/tv_discount_text" />
...@@ -226,6 +238,7 @@ ...@@ -226,6 +238,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="總金額:" android:text="總金額:"
android:visibility="gone"
android:textStyle="normal" android:textStyle="normal"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_discount" /> app:layout_constraintTop_toBottomOf="@id/tv_discount" />
...@@ -234,6 +247,7 @@ ...@@ -234,6 +247,7 @@
android:id="@+id/tv_total_amount" android:id="@+id/tv_total_amount"
style="@style/printOtherOrderInfoPrintBoldTextStyle" style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:visibility="gone"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_total_amount_text" /> app:layout_constraintTop_toTopOf="@id/tv_total_amount_text" />
...@@ -245,13 +259,14 @@ ...@@ -245,13 +259,14 @@
android:maxLines="1" android:maxLines="1"
android:text="@string/print_split_line" android:text="@string/print_split_line"
android:textColor="@color/theme_333_color" android:textColor="@color/theme_333_color"
app:layout_constraintTop_toBottomOf="@id/tv_total_amount_text" /> app:layout_constraintTop_toBottomOf="@id/rv_bill" />
<TextView <TextView
android:id="@+id/tv_pay_amount_text" android:id="@+id/tv_pay_amount_text"
style="@style/printOtherOrderInfoPrintBoldTextStyle" style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"
android:text="支付金額:" android:text="支付金額:"
android:textSize="@dimen/dp_26" android:textSize="@dimen/dp_26"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
...@@ -263,6 +278,7 @@ ...@@ -263,6 +278,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="" android:text=""
android:visibility="gone"
android:textSize="@dimen/dp_26" android:textSize="@dimen/dp_26"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintLeft_toRightOf="@id/tv_pay_amount_text" app:layout_constraintLeft_toRightOf="@id/tv_pay_amount_text"
...@@ -274,6 +290,7 @@ ...@@ -274,6 +290,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:visibility="gone"
android:text="@string/print_split_line" android:text="@string/print_split_line"
android:textColor="@color/theme_333_color" /> android:textColor="@color/theme_333_color" />
...@@ -312,7 +329,8 @@ ...@@ -312,7 +329,8 @@
style="@style/printOtherOrderTextStyle_font_style_twenty" style="@style/printOtherOrderTextStyle_font_style_twenty"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="親愛的顧客,祝您用餐愉快,如您遇到任何問題請撥打8200 2022聯繫我們,期待您的下次光臨。" /> android:text="親愛的顧客,祝您用餐愉快,如您遇到任何問題請撥打8200 2022聯繫我們,期待您的下次光臨。"
android:visibility="gone" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/print_bill_name"
style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/print_bill_value"
style="@style/printOtherOrderInfoPrintBoldTextStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_weight="1"
android:gravity="right" />
</LinearLayout>
\ No newline at end of file
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