酒店桌布为微信小程序
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.

256 lines
5.4 KiB

5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
4 months ago
5 months ago
4 months ago
4 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 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. type : '',
  91. }
  92. },
  93. computed : {
  94. ...mapState(['category']),
  95. },
  96. onLoad(args) {
  97. this.type = args.type
  98. if(this.type == 'add'){
  99. this.$refs.addPopup.open('bottom')
  100. }
  101. },
  102. onShow() {
  103. this.$refs.commoditySelect.getList()
  104. },
  105. methods: {
  106. //点击tab栏
  107. clickTabs({
  108. index,
  109. name
  110. }) {
  111. // this.type = index;
  112. // this.queryParams.pageSize = 10
  113. // this.checkboxValue = []
  114. // this.mixinsListApi = ['orderPage', 'orderPage'][index]
  115. },
  116. submit(){
  117. this.form.pic = this.fileList.map((item) => item.url).join(",")
  118. if (this.$utils.verificationAll(this.form, {
  119. pic : '请上传物品照片',
  120. name : '请输入物品名称',
  121. length : '请输入物品长度',
  122. wide : '请输入物品宽度',
  123. })) {
  124. return
  125. }
  126. this.$api('tablecloth', this.form, res => {
  127. if(res.code == 200){
  128. this.$refs.commoditySelect.getList()
  129. this.$refs.addPopup.close()
  130. }
  131. })
  132. },
  133. open(){
  134. this.form = {
  135. categoryId : 0,
  136. name : '',
  137. num : 1,
  138. length : '',
  139. wide : '',
  140. }
  141. if(this.category.length){
  142. this.form.categoryId = this.category[0].id
  143. }
  144. this.$refs.addPopup.open('bottom')
  145. },
  146. deleteImage(e){
  147. this.fileList.splice(e.index, 1)
  148. },
  149. afterRead(e){
  150. let self = this
  151. e.file.forEach(file => {
  152. self.$Oss.ossUpload(file.url).then(url => {
  153. self.fileList.push({
  154. url
  155. })
  156. })
  157. })
  158. },
  159. }
  160. }
  161. </script>
  162. <style scoped lang="scss">
  163. .page{
  164. padding-bottom: 200rpx;
  165. .tabs{
  166. position: sticky;
  167. top: calc(var(--status-bar-height) + 120rpx);
  168. background-color: #fff;
  169. // padding-top: 20rpx;
  170. }
  171. .fixed{
  172. position: fixed;
  173. bottom: 20rpx;
  174. }
  175. .btn {
  176. display: flex;
  177. justify-content: center;
  178. width: 100%;
  179. .a {
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. width: 90%;
  184. height: 100rpx;
  185. color: #FFF;
  186. background-color: $uni-color;
  187. border: 1px solid red;
  188. border-radius: 100rpx;
  189. font-size: 30rpx;
  190. }
  191. }
  192. .list {
  193. display: flex;
  194. flex-wrap: wrap;
  195. font-size: 22rpx;
  196. .act {
  197. color: $uni-color;
  198. border: 1px solid $uni-color;
  199. background-color: #F9E7DE;
  200. }
  201. view {
  202. border-radius: 15rpx;
  203. background-color: #F3F3F3;
  204. border: 1px solid #F3F3F3;
  205. margin: 10rpx;
  206. display: flex;
  207. justify-content: center;
  208. padding: 10rpx 20rpx;
  209. }
  210. }
  211. .form{
  212. padding: 20rpx 0;
  213. .shopName {
  214. display: flex;
  215. align-items: center;
  216. background-color: #FFF;
  217. margin: 10rpx 0 0 0;
  218. padding: 10rpx 20rpx;
  219. >view:nth-of-type(1) {
  220. width: 30%;
  221. // font-weight: 700;
  222. }
  223. >view:nth-of-type(2) {
  224. width: 70%;
  225. // padding: 0 20rpx 0 0;
  226. border-radius: 10rpx;
  227. overflow: hidden;
  228. input {
  229. background-color: #f5f5f5;
  230. // color: #a4a4a4;
  231. font-size: 28rpx;
  232. padding: 8rpx 8rpx 8rpx 15rpx;
  233. }
  234. }
  235. }
  236. }
  237. }
  238. </style>