推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
4.4 KiB

6 months ago
5 months ago
3 months ago
3 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
  1. <template>
  2. <view class="cardList">
  3. <view class="container" @click="toOrderDetails(item)" v-for="(item, index) in cardListData" :key="index">
  4. <view class="head">
  5. <text class="orderTime">{{$t('components.cart.cardList.orderTime')}}{{item.createTime}}</text>
  6. <text class="orderStatus active">{{ stateText[item.state] }}</text>
  7. <!-- <text class="orderStatus" :class="item.state === 'U' ? 'active' : ''">{{item.stateText}}</text> -->
  8. </view>
  9. <view class="content cardStyle_" :class="['U','S'].includes(item.state) ? 'content_border' : ''">
  10. <view class="left">
  11. <image :src="getImage(item)" mode="aspectFill"/>
  12. </view>
  13. <view class="right">
  14. <view class="detailed">
  15. <view class="title">{{ getTitle(item) }}</view>
  16. <!-- <view class="title">{{ item.title }}</view> -->
  17. <view class="date">{{item.startTime}}</view>
  18. <view class="address">{{ getAddress(item) }}</view>
  19. <!-- <view class="address">{{item.address}}</view> -->
  20. </view>
  21. <view class="price"><text>{{$t('components.cart.cardList.total')}}</text>¥{{item.payPrice}}</view>
  22. </view>
  23. </view>
  24. <view class="button-sp-area">
  25. <!-- <button @click.stop="skip(item,4)" v-if="item.state == 0" :style="{background: '#492623;', color: '#FF3E3F',margin:'0 30rpx 0 0'}"
  26. class="mini-btn" size="mini">立即支付</button> -->
  27. <button @click.stop="skip(item,0)" v-if="item.state == 1" :style="{background: '#34312E;', color: '#AFAFAF',margin:'0 30rpx 0 0'}"
  28. class="mini-btn" size="mini">{{$t('components.cart.cardList.cancelActivity')}}</button>
  29. <button @click.stop="skip(item,1)"
  30. v-if="item.state == 1"
  31. :style="{background: '#492623;', color: '#FF3E3F',margin:'0 30rpx 0 0'}"
  32. class="mini-btn" size="mini">{{$t('components.cart.cardList.signIn')}}</button>
  33. <button @click.stop="skip(item,2)" v-if="item.state == 2 && item.isPj == 'N'" :style="{background: '#492623;', color: '#FF3E3F',margin:'0 30rpx 0 0'}"
  34. class="mini-btn" size="mini">{{$t('components.cart.cardList.evaluate')}}</button>
  35. <button @click.stop="skip(item,3)" v-if="item.state == 2" :style="{background: '#49361D;', color: '#FFB245',margin:'0 30rpx 0 0'}"
  36. class="mini-btn" size="mini">{{$t('components.cart.cardList.invoice')}}</button>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. props: {
  44. cardListData: {
  45. type: Array,
  46. default: []
  47. },
  48. },
  49. data() {
  50. return {
  51. stateText : ['', this.$t('components.cart.cardList.states.pending'), this.$t('components.cart.cardList.states.completed'), this.$t('components.cart.cardList.states.cancelled')],
  52. };
  53. },
  54. components: {
  55. },
  56. computed: {},
  57. watch: {
  58. },
  59. created() {
  60. },
  61. mounted() {},
  62. methods: {
  63. skip(val, type) {
  64. this.$emit('btnClick', val, type)
  65. },
  66. toOrderDetails(val) {
  67. this.$emit('toOrderDetails', val)
  68. },
  69. getImage(item){
  70. return item.image && item.image.split(',')[0]
  71. },
  72. getTitle(item) {
  73. // 根据订单类型决定使用哪种对象类型进行国际化
  74. if (item.type == 0) {
  75. // 活动订单
  76. return this.$ot(item.activity, 'active', 'title')
  77. } else {
  78. // 旅行订单
  79. return this.$ot(item.travel, 'travel', 'title')
  80. }
  81. },
  82. getAddress(item) {
  83. // 根据订单类型决定使用哪种对象类型进行国际化
  84. if (item.type == 0) {
  85. // 活动订单
  86. return this.$ot(item.activity, 'active', 'address')
  87. } else {
  88. // 旅行订单
  89. return this.$ot(item.travel, 'travel', 'address')
  90. }
  91. },
  92. }
  93. };
  94. </script>
  95. <style scoped lang="scss">
  96. .cardList {
  97. padding: 10rpx 32rpx 0;
  98. .container {
  99. margin-top: 31rpx;
  100. padding: 25rpx 0;
  101. border-radius: 20rpx;
  102. background: $uni-color-card-background;
  103. .head {
  104. display: flex;
  105. justify-content: space-between;
  106. padding: 0 35rpx 28rpx;
  107. border-bottom: 1px solid #2A2A2A;
  108. .orderTime {
  109. font-size: 25rpx;
  110. color: $uni-text-color-grey;
  111. }
  112. .orderStatus {
  113. font-size: 26rpx;
  114. color: #ccc;
  115. }
  116. }
  117. .content_border {
  118. border-bottom: 1px solid #2A2A2A;
  119. }
  120. .button-sp-area {
  121. text-align: right;
  122. padding-top: 20rpx;
  123. .mini-btn {
  124. width: 166rpx;
  125. height: 53rpx;
  126. line-height: 53rpx;
  127. font-size: 24rpx;
  128. border-radius: 50rpx;
  129. margin-left: 20rpx;
  130. background-color: #34312E;
  131. color: #AFAFAF;
  132. }
  133. }
  134. }
  135. }
  136. .active {
  137. color: $uni-color-primary !important;
  138. }
  139. </style>