goods-name.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div class="app-content">
  3. <!-- 商品 -->
  4. <div class="prompt-text">客户想买此商品,但没价格,请设置</div>
  5. <div class="img-wrap">
  6. <img class="goods-img" :src="data.imgUrl" mode="widthFix" alt="商品图片" />
  7. </div>
  8. <!-- 信息 -->
  9. <div class="input-line-wrap">
  10. <tui-list-cell class="line-cell" :hover="false">
  11. <div class="tui-title">名称</div>
  12. <input placeholder-class="phcolor" v-model="form.name" class="tui-input" name="name" placeholder="请输入" type="text" />
  13. </tui-list-cell>
  14. <tui-list-cell class="line-cell" :hover="false">
  15. <div class="tui-title">价格</div>
  16. <input placeholder-class="phcolor" v-model="form.price" class="tui-input" name="price" placeholder="请输入" maxlength="50" type="number" />
  17. <div class="tui-prompt">元</div>
  18. </tui-list-cell>
  19. </div>
  20. <!-- button -->
  21. <button class="admin-button-com blue big confirm-btn" @click="confirmFn">确定</button>
  22. </div>
  23. </template>
  24. <script>
  25. import TuiListCell from '@/components/plugin/list-cell'
  26. // api
  27. import { getDetB, picRemark } from '@/api/img-store'
  28. export default {
  29. name: 'goods-name-setting',
  30. components: {
  31. TuiListCell
  32. },
  33. data() {
  34. return {
  35. data: {},
  36. form: {
  37. picIdList: [],
  38. price: 0,
  39. name: '',
  40. categoryIdList: []
  41. }
  42. }
  43. },
  44. onLoad() {
  45. // this.init()
  46. },
  47. methods: {
  48. init() {
  49. this._getDet()
  50. },
  51. _getDet() {
  52. getDetB({ id: this.option.id }).then(res => {
  53. if (this.$util.isEmpty(res.data)) return
  54. this.data = res.data
  55. Object.keys(this.form).forEach((i, index) => {
  56. this.form[i] = res.data[i]
  57. })
  58. this.form.picIdList = [res.data.id]
  59. console.log(this.form)
  60. })
  61. },
  62. confirmFn() {
  63. picRemark(this.form).then(res => {
  64. this.$msg('修改成功!')
  65. })
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss" scoped>
  71. .prompt-text {
  72. color: $fontColor2;
  73. font-size: 32px;
  74. padding: 36px 0;
  75. text-align: center;
  76. }
  77. .img-wrap {
  78. width: 80%;
  79. background-color: #fff;
  80. margin: 0 auto 54px;
  81. padding: 20px;
  82. .goods-img {
  83. width: 100%;
  84. }
  85. }
  86. .confirm-btn {
  87. width: calc(100% - 60px);
  88. margin: 60px 30px 0;
  89. }
  90. </style>