酒店桌布为微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
5.2 KiB

9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
8 months ago
9 months ago
  1. <template>
  2. <view class="page">
  3. <navbar title="我的物品" leftClick @leftClick="$utils.navigateBack" />
  4. <!-- <view class="tabs">
  5. <uv-tabs :list="tabs" :activeStyle="{color : '#FD5100', fontWeight : 600}" lineColor="#FD5100" lineHeight="8rpx"
  6. lineWidth="50rpx" :scrollable="false" @click="clickTabs"></uv-tabs>
  7. </view> -->
  8. <commoditySelect ref="commoditySelect"/>
  9. <view class="btn fixed" @click="open">
  10. <button class="a">添加物品</button>
  11. </view>
  12. <uv-popup ref="addPopup" :round="30">
  13. <view class="form">
  14. <view class="shopName">
  15. <view>物品分类</view>
  16. <view class="list">
  17. <view :class="{act : form.categoryId == item.id}"
  18. @click="form.categoryId = item.id"
  19. :key="index"
  20. v-for="(item, index) in category">
  21. {{ item.name }}
  22. </view>
  23. </view>
  24. </view>
  25. <view class="shopName">
  26. <view>物品照片</view>
  27. <view>
  28. <uv-upload :fileList="fileList" multiple :maxCount="1" width="180rpx"
  29. height="180rpx" multiple @afterRead="afterRead" @delete="deleteImage">
  30. <image src="../static/help/uploading.png" mode="aspectFill"
  31. style="width: 180rpx;height: 180rpx;" />
  32. </uv-upload>
  33. </view>
  34. </view>
  35. <view class="shopName">
  36. <view>物品名称</view>
  37. <view>
  38. <input v-model="form.name" placeholder="请输入物品名称" clearable></input>
  39. </view>
  40. </view>
  41. <view class="shopName">
  42. <view>物品长度CM</view>
  43. <view>
  44. <input v-model="form.length" type="number" placeholder="请输入物品长度" clearable></input>
  45. </view>
  46. </view>
  47. <view class="shopName">
  48. <view>物品宽度CM</view>
  49. <view>
  50. <input v-model="form.wide" type="number" placeholder="请输入物品宽度" clearable></input>
  51. </view>
  52. </view>
  53. <view class="shopName">
  54. <view>物品数量</view>
  55. <view>
  56. <uv-number-box v-model="form.num" :min="1"></uv-number-box>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="btn" @click="submit">
  61. <button class="a">添加</button>
  62. </view>
  63. </uv-popup>
  64. </view>
  65. </template>
  66. <script>
  67. import commoditySelect from "../components/commodity/commoditySelect.vue"
  68. import { mapState } from 'vuex'
  69. export default {
  70. components : {
  71. commoditySelect,
  72. },
  73. data() {
  74. return {
  75. tabs: [{
  76. name: '选择租赁物品'
  77. },
  78. {
  79. name: '选择我的物品'
  80. },
  81. ],
  82. form : {
  83. categoryId : 0,
  84. name : '',
  85. num : 1,
  86. length : '',
  87. wide : '',
  88. },
  89. fileList: [],
  90. }
  91. },
  92. computed : {
  93. ...mapState(['category']),
  94. },
  95. onShow() {
  96. this.$refs.commoditySelect.getList()
  97. },
  98. methods: {
  99. //点击tab栏
  100. clickTabs({
  101. index,
  102. name
  103. }) {
  104. // this.type = index;
  105. // this.queryParams.pageSize = 10
  106. // this.checkboxValue = []
  107. // this.mixinsListApi = ['orderPage', 'orderPage'][index]
  108. },
  109. submit(){
  110. this.form.pic = this.fileList.map((item) => item.url).join(",")
  111. if (this.$utils.verificationAll(this.form, {
  112. pic : '请上传物品照片',
  113. name : '请输入物品名称',
  114. length : '请输入物品长度',
  115. wide : '请输入物品宽度',
  116. })) {
  117. return
  118. }
  119. this.$api('tablecloth', this.form, res => {
  120. if(res.code == 200){
  121. this.$refs.commoditySelect.getList()
  122. this.$refs.addPopup.close()
  123. }
  124. })
  125. },
  126. open(){
  127. this.form = {
  128. categoryId : 0,
  129. name : '',
  130. num : 1,
  131. length : '',
  132. wide : '',
  133. }
  134. if(this.category.length){
  135. this.form.categoryId = this.category[0].id
  136. }
  137. this.$refs.addPopup.open('bottom')
  138. },
  139. deleteImage(e){
  140. this.fileList.splice(e.index, 1)
  141. },
  142. afterRead(e){
  143. let self = this
  144. e.file.forEach(file => {
  145. self.$Oss.ossUpload(file.url).then(url => {
  146. self.fileList.push({
  147. url
  148. })
  149. })
  150. })
  151. },
  152. }
  153. }
  154. </script>
  155. <style scoped lang="scss">
  156. .page{
  157. padding-bottom: 200rpx;
  158. .tabs{
  159. position: sticky;
  160. top: calc(var(--status-bar-height) + 120rpx);
  161. background-color: #fff;
  162. // padding-top: 20rpx;
  163. }
  164. .fixed{
  165. position: fixed;
  166. bottom: 20rpx;
  167. }
  168. .btn {
  169. display: flex;
  170. justify-content: center;
  171. width: 100%;
  172. .a {
  173. display: flex;
  174. justify-content: center;
  175. align-items: center;
  176. width: 90%;
  177. height: 100rpx;
  178. color: #FFF;
  179. background-color: $uni-color;
  180. border: 1px solid red;
  181. border-radius: 100rpx;
  182. font-size: 30rpx;
  183. }
  184. }
  185. .list {
  186. display: flex;
  187. flex-wrap: wrap;
  188. font-size: 22rpx;
  189. .act {
  190. color: $uni-color;
  191. border: 1px solid $uni-color;
  192. background-color: #F9E7DE;
  193. }
  194. view {
  195. border-radius: 15rpx;
  196. background-color: #F3F3F3;
  197. border: 1px solid #F3F3F3;
  198. margin: 10rpx;
  199. display: flex;
  200. justify-content: center;
  201. padding: 10rpx 20rpx;
  202. }
  203. }
  204. .form{
  205. padding: 20rpx 0;
  206. .shopName {
  207. display: flex;
  208. align-items: center;
  209. background-color: #FFF;
  210. margin: 10rpx 0 0 0;
  211. padding: 10rpx 20rpx;
  212. >view:nth-of-type(1) {
  213. width: 30%;
  214. // font-weight: 700;
  215. }
  216. >view:nth-of-type(2) {
  217. width: 70%;
  218. // padding: 0 20rpx 0 0;
  219. border-radius: 10rpx;
  220. overflow: hidden;
  221. input {
  222. background-color: #f5f5f5;
  223. // color: #a4a4a4;
  224. font-size: 28rpx;
  225. padding: 8rpx 8rpx 8rpx 15rpx;
  226. }
  227. }
  228. }
  229. }
  230. }
  231. </style>