index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <base-drawer mode="bottom" :visible="visible" background-color="transparent" mask maskClosable @close="closeDrawer">
  3. <view class="edit-price rd-t-40rpx" v-if="goodsInfo.attr_value">
  4. <view class="title">增加库存
  5. <view class="close acea-row row-center-wrapper" @tap="closeDrawer">
  6. <text class="iconfont icon-guanbi"></text>
  7. </view>
  8. </view>
  9. <view class="list">
  10. <view class="item acea-row row-between-wrapper">
  11. <view>库存</view>
  12. <input type="number" :placeholder="'请填写增加库存数'" placeholder-class="placeholder" v-model="goodsInfo.attr_value.stock" />
  13. </view>
  14. </view>
  15. <view v-if="goodsInfo.spec_type" class="bnt acea-row row-center-wrapper" @tap="defineSpec">确定</view>
  16. <view v-else class="bnt acea-row row-center-wrapper" @tap="define">保存</view>
  17. </view>
  18. </base-drawer>
  19. </template>
  20. <script>
  21. // import {
  22. // postUpdateAttrs
  23. // } from "@/api/admin";
  24. import baseDrawer from '@/components/tui-drawer/tui-drawer.vue';
  25. export default {
  26. components:{
  27. baseDrawer
  28. },
  29. props:{
  30. visible: {
  31. type: Boolean,
  32. default: false,
  33. },
  34. goodsInfo: {
  35. type: Object,
  36. default: () => {}
  37. },
  38. },
  39. data: function() {
  40. return {
  41. tips:'',
  42. };
  43. },
  44. mounted() {
  45. // this.tips = this.goodsInfo.spec_type?'(可为空)':''
  46. },
  47. methods:{
  48. defineSpec(){
  49. let info = this.goodsInfo.attr_value;
  50. if(info.cost || info.price || info.ot_price || info.stock){
  51. this.$emit('successChange',info);
  52. }else{
  53. this.$util.Tips({
  54. title: '修改类容至少填写一项'
  55. });
  56. }
  57. },
  58. define(){
  59. let data = {
  60. attr_value:[]
  61. }
  62. data.attr_value.push(this.goodsInfo.attr_value)
  63. postUpdateAttrs(this.goodsInfo.id,data).then(res=>{
  64. this.$util.Tips({
  65. title: res.msg
  66. });
  67. this.$emit('successChange');
  68. }).catch(err=>{
  69. this.$util.Tips({
  70. title: err
  71. });
  72. })
  73. },
  74. closeDrawer() {
  75. this.$emit('closeDrawer');
  76. }
  77. }
  78. }
  79. </script>
  80. <style lang="scss" scoped>
  81. .edit-price{
  82. background-color: #fff;
  83. padding-bottom: 60rpx;
  84. .title{
  85. text-align: center;
  86. height: 108rpx;
  87. line-height: 108rpx;
  88. font-size: 32rpx;
  89. font-family: PingFang SC, PingFang SC;
  90. font-weight: 600;
  91. color: #333333;
  92. position: relative;
  93. padding: 0 30rpx;
  94. .close{
  95. width: 36rpx;
  96. height: 36rpx;
  97. line-height: 36rpx;
  98. background: #EEEEEE;
  99. border-radius: 50%;
  100. position: absolute;
  101. right: 30rpx;
  102. top:38rpx;
  103. .iconfont {
  104. font-weight: 300;
  105. font-size: 20rpx;
  106. }
  107. }
  108. }
  109. .list{
  110. padding: 0 10rpx 0 30rpx;
  111. .item{
  112. font-size: 28rpx;
  113. font-family: PingFang SC, PingFang SC;
  114. font-weight: 400;
  115. color: #333333;
  116. height: 72rpx;
  117. margin-bottom: 32rpx;
  118. box-sizing: border-box;
  119. input {
  120. text-align: right;
  121. font-size: 28rpx;
  122. height: 100%;
  123. padding-right: 20rpx;
  124. }
  125. .placeholder{
  126. font-size: 28rpx;
  127. padding-right: 20rpx;
  128. }
  129. }
  130. }
  131. .bnt{
  132. font-size: 26rpx;
  133. font-family: PingFang SC, PingFang SC;
  134. font-weight: 500;
  135. color: #FFFFFF;
  136. width: 710rpx;
  137. height: 72rpx;
  138. background: #2A7EFB;
  139. border-radius: 50rpx;
  140. margin: 72rpx auto 0 auto;
  141. }
  142. }
  143. </style>