publish_record.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view>
  3. <scroll-view class="wrapper" :style="{top: top + 'px'}" scroll-y refresher-enabled refresher-default-style="white"
  4. @refresherrefresh="pullRefresh" :refresher-triggered="refreshing" @scrolltolower="loadMore">
  5. <tabbar2 custom-class="marginX14 marginY10" :tabs="tabs" @change="clickTab" />
  6. <view v-if="tableData" class="paddingX14">
  7. <view v-for="(item, index) in tableData" :key="item.id" class="cell marginB12 paddingX15 relative"
  8. @click="showDetail(item)">
  9. <view class="paddingT15 paddingB10 flex-align">
  10. <image :src="item.cover" class="image flex-shrink0" mode="aspectFit" />
  11. <view class="flex1 self-stretch paddingY5 flex-column-between paddingL12 color-white">
  12. <view class="flex-align">
  13. <view class="font4 line-ellipsis flex1 bold" style="width: 0">{{item.name}}</view>
  14. </view>
  15. <view class="flex-align font4">
  16. <view>售价:¥</view>
  17. <view class="bold flex1">{{item.price}}</view>
  18. <image v-if="item.level" style="width: 110rpx; height: 32rpx" :src="LEVEL_MAP[item.level].titleText" />
  19. </view>
  20. <view class="flex-align font4">
  21. <view>发布时间:{{item.createTime}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view v-if="item.status === 1" class="line"></view>
  26. <view v-if="item.status === 1" class="font2 color-white paddingY9 flex-align-between">
  27. <view><button class="btn blue" @click.stop="showBidGoods(index, item)">查看出价</button></view>
  28. <view class="flex-align">
  29. <button class="btn yellow" @click.stop="cancel(item, index)">下架</button>
  30. <button class="btn theme marginL20" @click.stop="showChange(index, item)">改价</button>
  31. </view>
  32. </view>
  33. <image v-if="item.status === 1" :src="resource.sell_status_ing" class="status" />
  34. <image v-else-if="[10, 11].includes(item.status)" :src=" resource.sell_status_off" class="status" />
  35. </view>
  36. </view>
  37. <empty v-if="isEmpty" :top="200" light />
  38. </scroll-view>
  39. <change-price ref="changeRef" @success="onChangeSuccess" />
  40. <bid-goods-record ref="bidGoodsRef" @success="onChangeSuccess" />
  41. </view>
  42. </template>
  43. <script>
  44. import { LEVEL_MAP } from '@/utils/config'
  45. import tabbar2 from '@/components/tabbar2'
  46. import empty from '@/components/empty'
  47. import pageMixin from './../../mixin/page'
  48. import resource from '@/utils/resource'
  49. import changePrice from './change_price'
  50. import bidGoodsRecord from './bid_goods_record'
  51. const Tabs = [
  52. { title: '进行中', value: 1 },
  53. { title: '已下架', value: 10 },
  54. { title: '全部', value: '' }
  55. ]
  56. export default {
  57. mixins: [pageMixin],
  58. components: { empty, tabbar2, changePrice, bidGoodsRecord },
  59. data() {
  60. return {
  61. resource,
  62. LEVEL_MAP,
  63. tabs: Tabs,
  64. tab: Tabs[0],
  65. refreshing: false
  66. }
  67. },
  68. computed: {
  69. top() {
  70. let height = this.$store.state.systemInfo.statusBarHeight + 36 + 50
  71. return height
  72. }
  73. },
  74. mounted() {
  75. this.refresh(true)
  76. },
  77. methods: {
  78. pullRefresh() {
  79. this.refreshing = true
  80. this.refresh()
  81. },
  82. async loadData(loading) {
  83. const res = await this.$service.sell.listMy(
  84. this.pageNum,
  85. this.pageSize,
  86. this.tab.value,
  87. loading
  88. )
  89. setTimeout(() => {
  90. this.refreshing = false
  91. }, 1000)
  92. return res
  93. },
  94. clickTab(item) {
  95. this.tab = item
  96. this.refresh(true)
  97. },
  98. showDetail(item) {
  99. if (item.status !== 1) return
  100. this.$router.push('sell_detail', { id: item.id })
  101. },
  102. async cancel(item, index) {
  103. this.$message.confirm('是否确认下架?', async () => {
  104. const res = await this.$service.sell.cancel(item.id)
  105. if (res) {
  106. item.status = 10
  107. if (this.tab.value == 1) {
  108. this.tableData.splice(index, 1)
  109. this.isEmpty = this.tableData.length === 0
  110. }
  111. }
  112. })
  113. },
  114. showChange(index, item) {
  115. this.$refs.changeRef.show(index, item.id)
  116. },
  117. onChangeSuccess({ index, price }) {
  118. this.tableData[index].price = price
  119. },
  120. showBidGoods(index, item) {
  121. this.$refs.bidGoodsRef.show(index, item.id)
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. .wrapper {
  128. position: fixed;
  129. left: 0;
  130. right: 0;
  131. bottom: 0;
  132. }
  133. .cell {
  134. background: rgba(0, 0, 0, 0.5);
  135. box-shadow: 0px 0px 5px 0px rgba(167, 110, 244, 0.5);
  136. border-radius: 8px;
  137. border: 1px solid rgba(255, 255, 255, 0.2);
  138. overflow: hidden;
  139. .line {
  140. height: 1px;
  141. opacity: 0.2;
  142. background: #e9d9ff;
  143. }
  144. .image {
  145. box-shadow: 0px 0px 5px 0px rgba(167, 110, 244, 0.5);
  146. border-radius: 8px;
  147. width: 180rpx;
  148. height: 180rpx;
  149. }
  150. .mask {
  151. position: absolute;
  152. left: 0;
  153. right: 0;
  154. top: 0;
  155. bottom: 0;
  156. background: rgba($color: #222335, $alpha: 0.6);
  157. .btn-delete {
  158. width: 88px;
  159. height: 30px;
  160. background: rgba(0, 0, 0, 0.5);
  161. border-radius: 15px;
  162. border: 1px solid #a66ef4;
  163. color: #fff;
  164. font-size: 14px;
  165. }
  166. .btn-cm {
  167. width: 88px;
  168. height: 30px;
  169. background: linear-gradient(270deg, #d070ff 0%, #8b3dff 100%);
  170. border-radius: 15px;
  171. color: #fff;
  172. font-size: 14px;
  173. }
  174. }
  175. .status {
  176. width: 100rpx;
  177. height: 40rpx;
  178. position: absolute;
  179. right: 0;
  180. top: 0;
  181. z-index: 100;
  182. }
  183. .btn {
  184. height: 48rpx;
  185. line-height: 48rpx;
  186. text-align: center;
  187. padding: 0 20rpx;
  188. color: #fff;
  189. font-size: 28rpx;
  190. border-radius: 24rpx;
  191. &.theme {
  192. background: linear-gradient(270deg, #d070ff 0%, #8b3dff 100%);
  193. }
  194. &.yellow {
  195. background: linear-gradient(270deg, #ff7f2e 0%, #ff7474 100%);
  196. }
  197. &.blue {
  198. background: linear-gradient(315deg, #44e5e3 0%, #5dabf2 100%);
  199. }
  200. }
  201. }
  202. </style>