change_price.vue 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="cu-modal" :class="{'show': visible}">
  3. <view class="cu-dialog wrapper">
  4. <view class="content">
  5. <view class="flex-align-center">
  6. <image :src="resource.sell_change_title" webp style="width: 320rpx; height: 46rpx" />
  7. </view>
  8. <view class="input-wrapper marginY20 flex-align paddingX10">
  9. <input v-model.trim="price" class="flex1 color-white" />
  10. <image v-if="price" @click="price = ''" :src="resource.weal_cancel" webp style="width: 32rpx;height: 32rpx" />
  11. </view>
  12. <view class="flex-align-between">
  13. <image :src="resource.modal_cancel" webp style="width: 254rpx;height:92rpx" @click="close" />
  14. <image :src="resource.modal_ok" webp style="width: 254rpx;height:92rpx" @click="apply" />
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import { throttle } from '@/utils'
  22. import resource from '@/utils/resource'
  23. export default {
  24. data() {
  25. return {
  26. resource,
  27. visible: false,
  28. price: '',
  29. index: null,
  30. goodsId: null
  31. }
  32. },
  33. computed: {},
  34. methods: {
  35. show(index, goodsId) {
  36. this.$parent.$parent.$parent.lock = true
  37. this.index = index
  38. this.goodsId = goodsId
  39. this.price = ''
  40. this.visible = true
  41. },
  42. async apply() {
  43. if (!this.price) return
  44. throttle.call(this.realApply)
  45. },
  46. async realApply() {
  47. const res = await this.$service.sell.change(this.goodsId, this.price)
  48. if (res) {
  49. this.$emit('success', { index: this.index, price: this.price })
  50. this.close()
  51. } else {
  52. this.price = ''
  53. }
  54. },
  55. close() {
  56. this.$parent.$parent.$parent.lock = false
  57. this.visible = false
  58. this.index = null
  59. this.goodsId = null
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .mask {
  66. position: absolute;
  67. left: 0;
  68. right: 0;
  69. top: 0;
  70. bottom: 0;
  71. }
  72. .wrapper {
  73. width: 100%;
  74. margin-top: -100px;
  75. background: transparent;
  76. .content {
  77. padding: 40rpx 60rpx;
  78. margin: 0 20px;
  79. background: #000000;
  80. border-radius: 16px;
  81. border: 4px solid;
  82. border-image: linear-gradient(180deg, rgba(89, 55, 195, 1), rgba(169, 27, 136, 1)) 2 2;
  83. .input-wrapper {
  84. height: 100rpx;
  85. background: rgba(0, 0, 0, 0.5);
  86. box-shadow: 0px 0px 8rpx 4rpx rgba(147, 67, 255, 0.3);
  87. border-radius: 8rpx;
  88. border: 2rpx solid rgba(174, 231, 255, 0.5);
  89. }
  90. }
  91. }
  92. </style>