index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <page title="发布商品" ref="pageRef" light nav-color="transparent">
  3. <view class="wrapper">
  4. <view class="flex-align padding14">
  5. <image :src="resource.weal_create_remind" style="width: 32rpx; height: 32rpx" />
  6. <view class="font2 color-white marginL10">
  7. 发布商品发布商品发布商品发布商品发布商品发布商品
  8. </view>
  9. </view>
  10. <view class="content-wrapper">
  11. <view class="paddingY20">
  12. <view class="title">商品:</view>
  13. <view class="flex-wrap paddingT17 flex-align">
  14. <view v-if="goods" class="item">
  15. <view class="marginT11 flex-align-center">
  16. <image :src="goods.spu.cover" mode="aspectFill" class="image" />
  17. </view>
  18. <image
  19. :src="LEVEL_MAP[goods.level].titleImg"
  20. class="title-level translateX"
  21. />
  22. <image
  23. :src="resource.weal_create_minus"
  24. class="minus"
  25. @click="minus()"
  26. />
  27. </view>
  28. <view v-else class="add flex-column-align-center" @click="showStoreChoose">
  29. <image
  30. :src="resource.weal_create_plus"
  31. style="width: 32rpx; height: 32rpx"
  32. />
  33. <view class="color-white font4 paddingT18">选择商品</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="flex-align paddingB20 line">
  38. <view class="title">商品名称:</view>
  39. <view class="flex1 color-white">{{ goods.spu.name }}</view>
  40. </view>
  41. <view class="flex-align paddingY20 line">
  42. <view class="title">商品价格:</view>
  43. <view class="flex1">
  44. <input
  45. v-model.trim="price"
  46. type="number"
  47. placeholder="请输入商品价格"
  48. class="input"
  49. maxlength="15"
  50. />
  51. </view>
  52. </view>
  53. </view>
  54. <view class="bottom-wrapper flex-align-center">
  55. <image :src="resource.sell_btn_create" webp class="btn-create" @click="submit" />
  56. </view>
  57. </view>
  58. </page>
  59. </template>
  60. <script>
  61. import resource from '@/utils/resource'
  62. import { LEVEL_MAP } from '@/utils/config'
  63. export default {
  64. data() {
  65. return {
  66. resource,
  67. LEVEL_MAP,
  68. price: '',
  69. goods: null
  70. }
  71. },
  72. onLoad(options) {
  73. this.$event.on(this.$event.key.STORE_CHOOSE, (map) => {
  74. this.goods = Object.values(map)[0]
  75. })
  76. },
  77. onUnload() {
  78. this.$event.off(this.$event.key.STORE_CHOOSE)
  79. },
  80. methods: {
  81. minus() {
  82. this.goods = null
  83. },
  84. showStoreChoose() {
  85. if (this.goods) {
  86. this.$cache.set(this.$cache.key.STORE_CHOOSE, { [this.goods.id]: this.goods })
  87. }
  88. this.$router.push('store-choose', { single: true })
  89. },
  90. submit() {
  91. if (!this.goods || !this.price) {
  92. this.$message.error('请完善表单')
  93. return
  94. }
  95. this.$message.confirm('确定要发布商品吗?', () => {
  96. this.realSubmit()
  97. })
  98. },
  99. async realSubmit() {}
  100. }
  101. }
  102. </script>
  103. <style>
  104. </style>
  105. <style lang="scss" scoped>
  106. .bg {
  107. position: fixed;
  108. z-index: -1;
  109. left: 0;
  110. right: 0;
  111. top: 0;
  112. width: 100%;
  113. height: 100%;
  114. opacity: 0.3;
  115. }
  116. .wrapper {
  117. padding-bottom: 176rpx;
  118. }
  119. .content-wrapper {
  120. margin: 0 14px;
  121. background: rgba(0, 0, 0, 0.5);
  122. box-shadow: 0px 0px 4px 2px rgba(147, 67, 255, 0.3);
  123. border: 1px solid rgba(174, 231, 255, 0.5);
  124. padding: 0 22rpx;
  125. .title {
  126. width: 160rpx;
  127. color: #fff;
  128. font-size: 32rpx;
  129. }
  130. .line {
  131. // box-shadow: inset 0px 2rpx 20rpx 60rpx rgba(0,0,0,0.55);
  132. border-bottom: 2rpx solid rgba(255, 255, 255, 0.1);
  133. }
  134. .item,
  135. .add {
  136. width: 192rpx;
  137. height: 256rpx;
  138. border-radius: 8rpx;
  139. margin-right: 20rpx;
  140. position: relative;
  141. background: #363748;
  142. box-shadow: 0px 0px 8rpx 0px rgba(167, 110, 244, 0.5);
  143. margin-block: 20rpx;
  144. }
  145. .item {
  146. .image {
  147. width: 156rpx;
  148. height: 194rpx;
  149. border-radius: 8rpx;
  150. }
  151. .num {
  152. position: absolute;
  153. left: 0;
  154. top: 0;
  155. height: 24rpx;
  156. line-height: 24rpx;
  157. border-radius: 8rpx 0px 8rpx 0px;
  158. font-size: 24rpx;
  159. font-weight: bold;
  160. padding: 0 24rpx;
  161. color: #fff;
  162. }
  163. .title-level {
  164. position: absolute;
  165. bottom: 2rpx;
  166. width: 112rpx;
  167. height: 48rpx;
  168. }
  169. .minus {
  170. position: absolute;
  171. right: -5rpx;
  172. top: -5rpx;
  173. width: 32rpx;
  174. height: 32rpx;
  175. }
  176. }
  177. }
  178. .bottom-wrapper {
  179. background: #222335;
  180. padding-bottom: 48rpx;
  181. position: fixed;
  182. bottom: 0;
  183. left: 0;
  184. right: 0;
  185. }
  186. .btn-create {
  187. width: 616rpx;
  188. height: 128rpx;
  189. }
  190. .input {
  191. height: 32rpx;
  192. color: #fff;
  193. }
  194. </style>