specificationAttr.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view>
  3. <view class="pouponCount" :class="specData.showpopup==true?'on':''">
  4. <button class='iconfont icon-guanbi' @tap="close"></button>
  5. <view class="container_content">
  6. <view class="specifications">
  7. <textarea v-model="specData.name" maxlength="20" placeholder="输入规格名称,例如:尺码" placeholder-class="textPlaceHolder" />
  8. <view><text v-if="specData.name">{{specData.name.length}}</text><text v-else>0</text>/20</view>
  9. </view>
  10. <view class="specification_properties">
  11. <view class="specification_properties_title">规格属性</view>
  12. <view class="specification_properties_textarea">
  13. <textarea v-model="specData.detail" placeholder="请填写规格属性,例如:大码中码小码,使用换行符换行" placeholder-class="propertiesPlaceholder" />
  14. </view>
  15. <view class="tip">
  16. <text class="iconfont">&#xe688;</text>
  17. <text>每行只能填一个规格属性,多个请换行输入</text>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="handle"><button class="handle_button" :disabled="loading" @click="save">保存</button></view>
  22. </view>
  23. <view class='mask' catchtouchmove="true" :hidden='specData.showpopup==false' @tap='close'></view>
  24. </view>
  25. </template>
  26. <script>
  27. // +----------------------------------------------------------------------
  28. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  29. // +----------------------------------------------------------------------
  30. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  31. // +----------------------------------------------------------------------
  32. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  33. // +----------------------------------------------------------------------
  34. // | Author: CRMEB Team <admin@crmeb.com>
  35. // +----------------------------------------------------------------------
  36. export default {
  37. props: {
  38. specData: {
  39. type: Object,
  40. default: function() {
  41. return {
  42. showpopup: false,
  43. name: '',
  44. detail: ''
  45. };
  46. }
  47. },
  48. },
  49. data() {
  50. return {
  51. specification: [],
  52. name: this.names,
  53. detail: this.details,
  54. loading: false
  55. }
  56. },
  57. watch: {
  58. },
  59. onLoad(option) {
  60. },
  61. onShow(){
  62. },
  63. methods: {
  64. close(){
  65. this.$emit('changeClose')
  66. },
  67. resetData(){
  68. this.$set(this.specData, "name", "");
  69. this.$set(this.specData, "detail", "");
  70. },
  71. save(){
  72. let that = this
  73. if (!that.specData.name) return that.$util.Tips({
  74. title: '请输入规格名称'
  75. });
  76. if (!that.specData.detail) return that.$util.Tips({
  77. title: '请输入规格属性'
  78. });
  79. let detail = that.specData.detail.split(/[(\r\n)\r\n]+/);
  80. that.loading = true;
  81. detail.forEach((item,index)=>{
  82. if(!item){
  83. detail.splice(index,1);//删除空项
  84. }
  85. })
  86. this.$emit('getData',{value: that.specData.name, detail: detail});
  87. that.loading = false;
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .pouponCount {
  94. padding-top: 60rpx;
  95. padding-bottom: 130rpx;
  96. position: fixed;
  97. bottom: 0;
  98. width: 100%;
  99. left: 0;
  100. background-color: #fff;
  101. z-index: 77;
  102. border-radius: 16rpx 16rpx 0 0;
  103. padding-bottom: 20rpx;
  104. transform: translate3d(0, 100%, 0);
  105. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  106. }
  107. .pouponCount.on {
  108. transform: translate3d(0, 0, 0);
  109. }
  110. .pouponCount .icon-guanbi {
  111. position: absolute;
  112. right: 30rpx;
  113. color: #8a8a8a;
  114. font-size: 35rpx;
  115. top: 20rpx;
  116. }
  117. .container_content {
  118. width: 710rpx;
  119. background: #fff;
  120. margin: 0 auto 90rpx;
  121. .specifications {
  122. padding: 32rpx 20rpx 30rpx 20rpx;
  123. textarea {
  124. height: 122rpx;
  125. }
  126. > view {
  127. text-align: right;
  128. color: #666666;
  129. font-size: 24rpx;
  130. border-bottom: 1px solid #eeeeee;
  131. padding-bottom: 19rpx;
  132. }
  133. }
  134. .specification_properties {
  135. &_title {
  136. padding: 0rpx 19rpx 20rpx 19rpx;
  137. }
  138. &_textarea {
  139. height: 180rpx;
  140. padding: 0 19rpx 20rpx 19rpx;
  141. textarea {
  142. width: 100%;
  143. height: 100%;
  144. background: #f5f5f5;
  145. padding: 21rpx 35rpx 0 20rpx;
  146. }
  147. }
  148. .tip {
  149. color: #e93323;
  150. font-size: 22rpx;
  151. display: flex;
  152. align-items: center;
  153. padding: 10rpx 40rpx 40rpx 40rpx;
  154. > span:nth-child(1) {
  155. margin-right: 10rpx;
  156. }
  157. }
  158. }
  159. }
  160. .handle {
  161. position: fixed;
  162. bottom: 0;
  163. left: 0;
  164. width: 100%;
  165. height: 126rpx;
  166. background: #fff;
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. &_button {
  171. display: flex;
  172. align-items: center;
  173. justify-content: center;
  174. color: #FFFFFF;
  175. font-size: 32rpx;
  176. width: 690rpx;
  177. height: 86rpx;
  178. background: #E93323;
  179. border-radius: 43rpx;
  180. }
  181. }
  182. .textPlaceHolder {
  183. font-size: 30rpx;
  184. color: #bbbbbb;
  185. }
  186. .propertiesPlaceholder {
  187. color: #bbbbbb;
  188. font-size: 28rpx;
  189. }
  190. </style>
  191. </style>