中建365-二期开发-商城开发
parent
35996556a9
commit
1faf1b65e5
@ -0,0 +1,56 @@
|
||||
package com.zj365.dc.activity.shop
|
||||
|
||||
import android.view.View
|
||||
import com.xty.base.act.BaseVmAct
|
||||
import com.xty.base.vm.BaseVm
|
||||
import com.xty.common.arouter.ARouterUrl
|
||||
import com.xty.common.arouter.RouteManager
|
||||
import com.zj365.dc.BuildConfig
|
||||
import com.zj365.dc.databinding.ActCreateGoodsOrderBinding
|
||||
import com.zj365.dc.vm.ShopMallVm
|
||||
|
||||
class CreateGoodsOrderAct : BaseVmAct<ShopMallVm>() {
|
||||
val binding by lazy { ActCreateGoodsOrderBinding.inflate(layoutInflater) }
|
||||
override fun liveObserver() {
|
||||
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
super.initView()
|
||||
statusBar(binding.title.mView)
|
||||
binding.title.mTvTitle.text = "创建订单"
|
||||
binding.title.mIvBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
|
||||
onClickedListener()
|
||||
}
|
||||
|
||||
fun onClickedListener(){
|
||||
binding.tvPay.setOnClickListener {
|
||||
|
||||
}
|
||||
|
||||
binding.tvChooseAddress.setOnClickListener {
|
||||
bundle.clear()
|
||||
bundle.putString(
|
||||
"web_site_url",
|
||||
"${BuildConfig.h5url}pages/index/index?pageId=address&type=order"
|
||||
)
|
||||
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
|
||||
|
||||
}
|
||||
|
||||
binding.tvDiscounts.setOnClickListener {
|
||||
bundle.clear()
|
||||
bundle.putString(
|
||||
"web_site_url",
|
||||
"${BuildConfig.h5url}pages/index/index?pageId=coupon&type=order"
|
||||
)
|
||||
RouteManager.goAct(ARouterUrl.H5_ACT, bundle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun setLayout()=binding.root
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.zj365.health.act
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.xty.base.act.BaseVmAct
|
||||
import com.xty.common.arouter.ARouterUrl
|
||||
import com.xty.common.setImage
|
||||
import com.xty.network.model.ShopOrderDetailBean
|
||||
import com.zj365.health.databinding.ActShopOrderDetailBinding
|
||||
import com.zj365.health.vm.ShopOrderVm
|
||||
|
||||
@Route(path = ARouterUrl.SHOP_ORDER_DETAIL_ACT)
|
||||
class ShopOrderDetailAct: BaseVmAct<ShopOrderVm>() {
|
||||
val binding by lazy { ActShopOrderDetailBinding.inflate(layoutInflater) }
|
||||
var orderDetailBean:ShopOrderDetailBean? = null
|
||||
override fun liveObserver() {
|
||||
mViewModel.orderDetailLiveData.observe(this){
|
||||
it.data?.let {
|
||||
orderDetailBean = it
|
||||
binding.imgGoods.setImage(this@ShopOrderDetailAct,it.goods_pic)
|
||||
binding.tvPrice.text = "¥ ${it.pay_price}"
|
||||
binding.tvGoodsName.text = it.goods_name
|
||||
binding.tvStatus.text = it.status_name
|
||||
binding.tvTotalPrice.text = "商品总价:¥ ${it.pay_price}"
|
||||
binding.tvOrderNo.text = "订单编号:${it.order_no}"
|
||||
binding.tvPayTime.text = "支付时间:${it.pay_time}"
|
||||
binding.tvCompleteTime.text = "成交时间:${it.create_time}"
|
||||
binding.tvPayType.text ="支付类型:${it.pay_type_name}"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
super.initView()
|
||||
statusBar(binding.title.mView)
|
||||
binding.title.mTvTitle.text = "订单详情"
|
||||
binding.title.mIvBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
var id = intent.getLongExtra("id",0)
|
||||
mViewModel.getOrderDetail(id)
|
||||
binding.tvCopy.setOnClickListener {
|
||||
orderDetailBean?.let {
|
||||
val clipboard: ClipboardManager =
|
||||
getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clipData = ClipData.newPlainText("date", it.order_no)
|
||||
clipboard.setPrimaryClip(clipData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLayout() = binding.root
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package com.zj365.health.act
|
||||
|
||||
import android.graphics.Rect
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.androidkun.xtablayout.XTabLayout
|
||||
import com.xty.base.act.BaseListAct
|
||||
import com.xty.common.arouter.ARouterUrl
|
||||
import com.xty.common.arouter.RouteManager
|
||||
import com.xty.network.model.ShopOrderListBean
|
||||
import com.zj365.health.R
|
||||
import com.zj365.health.adapter.GoodsOrderAdapter
|
||||
import com.zj365.health.databinding.ActShopOrderListBinding
|
||||
import com.zj365.health.vm.ShopOrderVm
|
||||
|
||||
@Route(path = ARouterUrl.SHOP_ORDER_LIST_ACT)
|
||||
class ShopOrderListAct : BaseListAct<ShopOrderVm>() {
|
||||
|
||||
val binding by lazy { ActShopOrderListBinding.inflate(layoutInflater) }
|
||||
|
||||
var orderType: Int = 0
|
||||
|
||||
val mAdapter by lazy { GoodsOrderAdapter() }
|
||||
|
||||
private val mTitles = mutableListOf<String>()
|
||||
|
||||
override fun initAdapter() {
|
||||
binding.mRecycle.adapter = mAdapter
|
||||
binding.mRecycle.layoutManager = LinearLayoutManager(this)
|
||||
binding.mRecycle.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||
override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) {
|
||||
super.getItemOffsets(outRect, itemPosition, parent)
|
||||
outRect.bottom = 12
|
||||
outRect.right = 14
|
||||
outRect.left = 14
|
||||
}
|
||||
})
|
||||
|
||||
setRecycleRefresh(binding.mRecycle,binding.mRefresh,true)
|
||||
|
||||
mAdapter.addChildClickViewIds(R.id.tv_confirm_receive_goods,R.id.tv_logistics,R.id.tv_refund)
|
||||
mAdapter.setOnItemClickListener { adapter, view, position ->
|
||||
var bean = adapter.data[position] as ShopOrderListBean.ShopOrderBean
|
||||
bundle.clear()
|
||||
bundle.putLong("id",bean.id)
|
||||
RouteManager.goAct(ARouterUrl.SHOP_ORDER_DETAIL_ACT,bundle)
|
||||
|
||||
}
|
||||
|
||||
mAdapter.setOnItemChildClickListener { adapter, view, position ->
|
||||
|
||||
var bean = adapter.data[position] as ShopOrderListBean.ShopOrderBean
|
||||
when(view.id){
|
||||
R.id.tv_confirm_receive_goods ->{
|
||||
mViewModel.receiveGoods(bean.id)
|
||||
}
|
||||
R.id.tv_logistics->{
|
||||
if (bean.status == 1){
|
||||
mViewModel.cancelOrder(bean.id)
|
||||
}
|
||||
}
|
||||
R.id.tv_refund ->{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun loadData() {
|
||||
mViewModel.getOrderList(page,orderType)
|
||||
}
|
||||
|
||||
override fun initView() {
|
||||
super.initView()
|
||||
statusBar(binding.title.mView)
|
||||
binding.title.mTvTitle.text = "我的订单"
|
||||
binding.title.mIvBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
initTab()
|
||||
}
|
||||
|
||||
fun initTab() {
|
||||
|
||||
mTitles.add("全部订单")
|
||||
mTitles.add("待发货")
|
||||
mTitles.add("待收货")
|
||||
mTitles.add("已完成")
|
||||
mTitles.add("已取消")
|
||||
|
||||
|
||||
//设置tab
|
||||
mTitles.forEach { tabData ->
|
||||
val tab = binding.xTablayout.newTab()
|
||||
tab.text = tabData
|
||||
binding.xTablayout.addTab(tab)
|
||||
}
|
||||
binding.xTablayout.setOnTabSelectedListener(object : XTabLayout.OnTabSelectedListener{
|
||||
override fun onTabSelected(tab: XTabLayout.Tab?) {
|
||||
when(tab!!.position){
|
||||
0->{
|
||||
orderType = 0
|
||||
}
|
||||
1->{
|
||||
orderType = 2
|
||||
}
|
||||
2->{
|
||||
orderType = 3
|
||||
|
||||
}
|
||||
3->{
|
||||
orderType = 4
|
||||
|
||||
}
|
||||
4->{
|
||||
orderType = 5
|
||||
|
||||
}
|
||||
}
|
||||
page = 1
|
||||
mViewModel.getOrderList(page,orderType)
|
||||
|
||||
}
|
||||
|
||||
override fun onTabUnselected(tab: XTabLayout.Tab?) {
|
||||
}
|
||||
|
||||
override fun onTabReselected(tab: XTabLayout.Tab?) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun liveObserver() {
|
||||
mViewModel.shopOrderLiveDate.observe(this){
|
||||
setDate(mAdapter,it.data.list)
|
||||
}
|
||||
|
||||
mViewModel.cancelOrderLiveData.observe(this){
|
||||
page = 1
|
||||
mViewModel.getOrderList(page,orderType)
|
||||
}
|
||||
|
||||
mViewModel.receiveGoodsLiveData.observe(this){
|
||||
page = 1
|
||||
mViewModel.getOrderList(page,orderType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLayout() = binding.root
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.zj365.health.adapter
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.Typeface
|
||||
import android.text.SpannableString
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.ruffian.library.widget.RImageView
|
||||
import com.xty.base.adapter.BaseAdapter
|
||||
import com.xty.common.setImage
|
||||
import com.xty.common.util.SpannableUtils
|
||||
import com.xty.network.model.ShopOrderListBean
|
||||
import com.zj365.health.R
|
||||
|
||||
class GoodsOrderAdapter : BaseAdapter<ShopOrderListBean.ShopOrderBean>(R.layout.item_shop_order_list) {
|
||||
override fun convert(holder: BaseViewHolder, item: ShopOrderListBean.ShopOrderBean) {
|
||||
holder.setText(R.id.tv_order_no,"订单 ${item.order_no}")
|
||||
holder.setText(R.id.tv_goods_name,item.goods_name)
|
||||
holder.setText(R.id.tv_spec,item.goods_sku)
|
||||
holder.getView<RImageView>(R.id.img_goods).setImage(context,item.goods_pic)
|
||||
var priceTxt = holder.getView<TextView>(R.id.tv_price)
|
||||
var fontStr = "订单金额:"
|
||||
var str = SpannableString("¥ ${item.pay_price}")
|
||||
|
||||
priceTxt.text = SpannableUtils.setStrSpan(
|
||||
"${fontStr}${str}",
|
||||
-1,
|
||||
ContextCompat.getColor(
|
||||
context, R.color.col_2621
|
||||
),
|
||||
-1,
|
||||
"${fontStr}${str}".length -"${str}".length,
|
||||
"${fontStr}${str}".length
|
||||
)
|
||||
holder.setText(R.id.tv_num,"数量:${item.goods_num}")
|
||||
var status = holder.getView<TextView>(R.id.tv_order_status)
|
||||
|
||||
status.text = item.status_name
|
||||
when(item.status){ //1待支付 2已支付(待发货) 3待收货 4已完成5已取消6退款中7退款成功8退款失败
|
||||
1 ->{
|
||||
status.setTextColor(context.getColor(R.color.col_9BD))
|
||||
holder.setGone(R.id.tv_confirm_receive_goods,true)
|
||||
holder.setText(R.id.tv_logistics,"取消订单")
|
||||
holder.setText(R.id.tv_refund,"立即支付")
|
||||
}
|
||||
3->{
|
||||
status.setTextColor(context.getColor(R.color.col_9BD))
|
||||
holder.setGone(R.id.tv_confirm_receive_goods,false)
|
||||
holder.setText(R.id.tv_logistics,"查看物流")
|
||||
holder.setText(R.id.tv_refund,"申请退款")
|
||||
|
||||
}
|
||||
4->{
|
||||
status.setTextColor(context.getColor(R.color.col_02c))
|
||||
holder.setGone(R.id.tv_confirm_receive_goods,true)
|
||||
holder.setGone(R.id.tv_logistics,true)
|
||||
|
||||
holder.setGone(R.id.tv_refund,true)
|
||||
holder.setGone(R.id.line,true)
|
||||
|
||||
}
|
||||
else ->{
|
||||
status.setTextColor(context.getColor(R.color.col_9BD))
|
||||
|
||||
holder.setGone(R.id.tv_confirm_receive_goods,true)
|
||||
holder.setGone(R.id.tv_logistics,true)
|
||||
|
||||
holder.setGone(R.id.tv_refund,true)
|
||||
holder.setGone(R.id.line,true)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package com.zj365.health.vm
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.xty.base.vm.BaseVm
|
||||
import com.xty.network.model.RespBody
|
||||
import com.xty.network.model.ShopOrderDetailBean
|
||||
import com.xty.network.model.ShopOrderListBean
|
||||
import org.json.JSONObject
|
||||
|
||||
class ShopOrderVm : BaseVm() {
|
||||
|
||||
val shopOrderLiveDate by lazy { MutableLiveData<RespBody<ShopOrderListBean>>() }
|
||||
|
||||
val orderDetailLiveData by lazy { MutableLiveData<RespBody<ShopOrderDetailBean>>() }
|
||||
|
||||
val receiveGoodsLiveData by lazy { MutableLiveData<RespBody<Any>>() }
|
||||
|
||||
val cancelOrderLiveData by lazy { MutableLiveData<RespBody<Any>>() }
|
||||
fun getOrderList(pageNum:Int,status:Int){
|
||||
|
||||
startHttp {
|
||||
val json = JSONObject()
|
||||
json.put("pageNum",pageNum)
|
||||
json.put("pageSize", 10)
|
||||
json.put("status",status)
|
||||
|
||||
val response = apiInterface().getShopOrderList(retrofits.getRequestBody(json.toString()))
|
||||
response.getCodeStatus(shopOrderLiveDate, nowData)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun getOrderDetail(id:Long){
|
||||
startHttp {
|
||||
val response = apiInterface().getOrderDetail(id)
|
||||
response.getCodeStatus(orderDetailLiveData, nowData)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun receiveGoods(id:Long){
|
||||
startHttp {
|
||||
val response = apiInterface().receiveGoods(id)
|
||||
response.getCodeStatus(receiveGoodsLiveData, nowData)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun cancelOrder(id:Long){
|
||||
startHttp {
|
||||
val response = apiInterface().cancelOrder(id)
|
||||
response.getCodeStatus(cancelOrderLiveData, nowData)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/col_6f7">
|
||||
|
||||
<include layout="@layout/title_white_bar"
|
||||
android:id="@+id/title"/>
|
||||
|
||||
<com.androidkun.xtablayout.XTabLayout
|
||||
android:background="@color/col_6f7"
|
||||
android:id="@+id/xTablayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_60"
|
||||
app:xTabMode="scrollable"
|
||||
app:xTabSelectedTextColor="@color/col_02c"
|
||||
app:xTabTextColor="@color/col_c7c"
|
||||
app:xTabTextSize="@dimen/sp_15"
|
||||
app:xTabDisplayNum="5"
|
||||
app:xTabSelectedTextSize="@dimen/sp_15"
|
||||
app:xTabIndicatorWidth="@dimen/dp_20"
|
||||
app:xTabIndicatorHeight="@dimen/dp_3"
|
||||
app:xTabIndicatorColor="@color/col_02c"
|
||||
app:xTabIndicatorRoundY="@dimen/dp_3"/>
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/mRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.scwang.smart.refresh.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mRecycle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,50 @@
|
||||
package com.zj365.mime.act
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.xty.base.act.BaseListAct
|
||||
import com.xty.common.arouter.ARouterUrl
|
||||
import com.zj365.mime.adapter.EnterpriseInformationChildAdapter
|
||||
import com.zj365.mime.databinding.ActEnterpriseInformationTypeBinding
|
||||
import com.zj365.mime.vm.EnterpriseInformationVm
|
||||
@Route(path = ARouterUrl.ENTERPRISE_TYPE_INFO)
|
||||
class EnterpriseInformationForTypeAct : BaseListAct<EnterpriseInformationVm>() {
|
||||
|
||||
val binding by lazy { ActEnterpriseInformationTypeBinding.inflate(layoutInflater) }
|
||||
|
||||
val mAdapter by lazy { EnterpriseInformationChildAdapter(1) }
|
||||
|
||||
var type = 0
|
||||
override fun initAdapter() {
|
||||
binding.mRecycle.adapter = mAdapter
|
||||
binding.mRecycle.layoutManager = LinearLayoutManager(this@EnterpriseInformationForTypeAct)
|
||||
|
||||
setRecycleRefresh(binding.mRecycle,binding.mRefresh,true)
|
||||
}
|
||||
|
||||
|
||||
override fun initView() {
|
||||
super.initView()
|
||||
statusBar(binding.title.mView)
|
||||
binding.title.mTvTitle.text = "企业资料"
|
||||
binding.title.mIvBack.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun loadData() {
|
||||
type = intent.getIntExtra("type",0)
|
||||
mViewModel.getEnterpriseInformationForType(type,page)
|
||||
}
|
||||
|
||||
override fun liveObserver() {
|
||||
mViewModel.enterpriseInfoForTypeLiveData.observe(this){
|
||||
setDate(mAdapter,it.data.list)
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLayout() = binding.root
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/col_6f7"
|
||||
tools:ignore="MissingDefaultResource">
|
||||
<include layout="@layout/title_white_bar"
|
||||
android:id="@+id/title"/>
|
||||
|
||||
<com.scwang.smart.refresh.layout.SmartRefreshLayout
|
||||
android:id="@+id/mRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.scwang.smart.refresh.header.ClassicsHeader
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/mRecycle"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:overScrollMode="never" />
|
||||
|
||||
<com.scwang.smart.refresh.footer.ClassicsFooter
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,16 @@
|
||||
package com.xty.network.model
|
||||
|
||||
data class ShopOrderDetailBean(
|
||||
var order_no:String,
|
||||
var goods_sku:String,
|
||||
var goods_name:String,
|
||||
var pay_price:String,
|
||||
var create_time:String,
|
||||
var goods_pic:String,
|
||||
var status_name:String,
|
||||
var pay_type_name:String,
|
||||
var goods_num:String,
|
||||
var pay_type:Int,
|
||||
var pay_time:String,
|
||||
var status:Int
|
||||
)
|
@ -0,0 +1,17 @@
|
||||
package com.xty.network.model
|
||||
|
||||
data class ShopOrderListBean(
|
||||
var list:ArrayList<ShopOrderBean>
|
||||
){
|
||||
data class ShopOrderBean(
|
||||
var order_no:String,
|
||||
var goods_sku:String,
|
||||
var goods_name:String,
|
||||
var pay_price:String,
|
||||
var goods_pic:String,
|
||||
var status_name:String,
|
||||
var goods_num:Int,
|
||||
var id:Long,
|
||||
var status:Int //1待支付 2已支付(待发货) 3待收货 4已完成5已取消6退款中7退款成功8退款失败
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue