singleSpecification.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view class="container">
  3. <select-form :platformClassification="formList" :form="singleSpecification" @input="input"></select-form>
  4. <view class="more_than" @click="selectMoreThan" v-if="moreThanFlag">
  5. <view>更多</view>
  6. </view>
  7. <view class="handle">
  8. <view class="button" @click="saveSingleSpecification">
  9. 保存
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. // +----------------------------------------------------------------------
  16. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  17. // +----------------------------------------------------------------------
  18. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  19. // +----------------------------------------------------------------------
  20. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  21. // +----------------------------------------------------------------------
  22. // | Author: CRMEB Team <admin@crmeb.com>
  23. // +----------------------------------------------------------------------
  24. import selectForm from '../components/selectForm.vue';
  25. import { navigateTo, navigateBack, serialize, setStorage, getStorage} from '../../../libs/uniApi.js';
  26. // 单规格商品 attrValue
  27. export default {
  28. components:{
  29. selectForm
  30. },
  31. data() {
  32. return {
  33. singleSpecification: {
  34. price: '', // 售价
  35. cost: '', // 成本价
  36. ot_price: '', // 原价
  37. stock: '', // 库存
  38. bar_code: '', // 商品编号
  39. weight: '', // 重量
  40. volume: '', // 体积
  41. image: '',
  42. extension_one: '',
  43. extension_two: ''
  44. },
  45. moreThanFlag: true,
  46. formList: [
  47. {
  48. id: 1,
  49. label: '售价',
  50. type: 'input',
  51. model: 'price',
  52. holder: '请填写售价'
  53. },
  54. {
  55. id: 2,
  56. label: '成本价',
  57. type: 'input',
  58. holder: '请填写成本价',
  59. model: 'cost'
  60. },
  61. {
  62. id: 3,
  63. label: '原价',
  64. type: 'input',
  65. holder: '请填写原价',
  66. model: 'ot_price'
  67. },
  68. {
  69. id: 4,
  70. label: '库存',
  71. type: 'input',
  72. holder: '请填写库存',
  73. model: 'stock'
  74. }
  75. ],
  76. moreThanList: [
  77. {
  78. id: 5,
  79. label: '商品编号',
  80. type: 'input',
  81. holder: '请填写商品编号',
  82. model: 'bar_code'
  83. },
  84. {
  85. id: 6,
  86. label: '重量',
  87. type: 'input',
  88. holder: '请输入重量',
  89. model: 'weight'
  90. },
  91. {
  92. id: 7,
  93. label: '体积',
  94. type: 'input',
  95. holder: '请输入体积',
  96. model: 'volume'
  97. },
  98. {
  99. id: 8,
  100. label: '佣金(一级)',
  101. type: 'input',
  102. holder: '请输入一级佣金',
  103. model: 'extension_one'
  104. },
  105. {
  106. id: 8,
  107. label: '佣金(二级)',
  108. type: 'input',
  109. holder: '请输入二级佣金',
  110. model: 'extension_two'
  111. }
  112. ],
  113. }
  114. },
  115. watch: {
  116. singleSpecification: {
  117. handler(val) {
  118. this.singleSpecification = val
  119. },
  120. deep: true
  121. }
  122. },
  123. onShow() {
  124. if(getStorage('addGoodsFormData').image) {
  125. this.singleSpecification.image = getStorage('addGoodsFormData').image;
  126. }
  127. if(getStorage('singleSpecification')) {
  128. Object.keys(this.singleSpecification).forEach(item => {
  129. if(getStorage('singleSpecification')[item]) {
  130. this.singleSpecification[item] = getStorage('singleSpecification')[item]
  131. }
  132. })
  133. }
  134. },
  135. methods: {
  136. selectMoreThan() {
  137. this.formList = this.formList.concat(this.moreThanList);
  138. this.moreThanFlag = false;
  139. },
  140. spliceMoreThan() {
  141. this.moreThanFlag = true;
  142. this.formList.splice(3, 4);
  143. },
  144. input(val) {
  145. this.singleSpecification = val
  146. },
  147. // 保存
  148. saveSingleSpecification() {
  149. setStorage('singleSpecification', this.singleSpecification);
  150. navigateBack(1);
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss" scoped>
  156. .container {
  157. padding-bottom: 126rpx;
  158. }
  159. .more_than {
  160. background: #FFFFFF;
  161. border-radius: 10px;
  162. margin: auto;
  163. margin-top: 15rpx;
  164. display: flex;
  165. align-items: center;
  166. justify-content: center;
  167. width: 710rpx;
  168. height: 84rpx;
  169. color: #333333;
  170. font-size: 30rpx;
  171. }
  172. .handle {
  173. position: fixed;
  174. left: 0;
  175. bottom: 0;
  176. width: 100%;
  177. height: 126rpx;
  178. background: #FFFFFF;
  179. display: flex;
  180. align-items: center;
  181. justify-content: center;
  182. .button {
  183. display: flex;
  184. align-items: center;
  185. justify-content: center;
  186. color: #FFFFFF;
  187. font-size: 32rpx;
  188. width: 690rpx;
  189. height: 86rpx;
  190. background: #E93323;
  191. border-radius: 43rpx;
  192. }
  193. }
  194. </style>