index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='报修'></cus-header>
  4. <div class="form">
  5. <div class="item">
  6. <div class="left">报修位置</div>
  7. <div class="right">
  8. <div class="right" @tap="placeShow = true">
  9. <text v-if="receiptDto.warehouseName">{{receiptDto.warehouseName}} ></text>
  10. <div class="tip" v-else>
  11. 请选择<u-icon name="arrow-right" color="#B9C0C8" size="28"
  12. style="margin-left: 10rpx;"></u-icon>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="item">
  18. <div class="left">报修区域</div>
  19. <div class="right">
  20. <div class="right" @tap="areaShow = true">
  21. <text v-if="receiptDto.warehouseName">{{receiptDto.warehouseName}} ></text>
  22. <div class="tip" v-else>
  23. 请选择<u-icon name="arrow-right" color="#B9C0C8" size="28"
  24. style="margin-left: 10rpx;"></u-icon>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="item">
  30. <div class="left">报修类型</div>
  31. <div class="right">
  32. <div class="right" @tap="typeShow = true">
  33. <text v-if="receiptDto.warehouseName">{{receiptDto.warehouseName}} ></text>
  34. <div class="tip" v-else>
  35. 请选择<u-icon name="arrow-right" color="#B9C0C8" size="28"
  36. style="margin-left: 10rpx;"></u-icon>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="item">
  42. <div class="left">联系人</div>
  43. <div class="right">
  44. <input type="text" placeholder-class="repair-inp-ph" placeholder="请输入">
  45. </div>
  46. </div>
  47. <div class="item">
  48. <div class="left">联系电话</div>
  49. <div class="right">
  50. <input type="text" placeholder-class="repair-inp-ph" placeholder="请输入">
  51. </div>
  52. </div>
  53. <div class="pre">
  54. <div class="title">故障描述</div>
  55. <div class="desc">
  56. <u--textarea placeholder="请输入" placeholder-class="repair-inp-ph" autoHeight></u--textarea>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="upload">
  61. <div class="title">上传照片</div>
  62. <div class="box">
  63. <u-upload :fileList="fileList" @afterRead="afterRead" @delete="deletePic" multiple
  64. name="1" :maxCount="10"></u-upload>
  65. </div>
  66. </div>
  67. <div class="bottom">
  68. <div class="save">保存</div>
  69. </div>
  70. <u-picker :show="placeShow" :columns="placeColumns" title="报修位置" @cancel="placeShow=false" @confirm="e=>paramsConfirm(e,'')"></u-picker>
  71. <u-picker :show="areaShow" :columns="areaColumns" title="报修区域" @cancel="areaShow=false" @confirm="e=>paramsConfirm(e,'')"></u-picker>
  72. <u-picker :show="typeShow" :columns="typeColumns" title="报修类型" @cancel="typeShow=false" @confirm="e=>paramsConfirm(e,'')"></u-picker>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. placeShow: false,
  80. areaShow: false,
  81. typeShow: false,
  82. placeColumns:[
  83. ['位置1','位置2']
  84. ],
  85. areaColumns:[
  86. ['区域1','区域2']
  87. ],
  88. typeColumns:[
  89. ['类型1','类型2']
  90. ],
  91. params: {
  92. },
  93. fileList1: [],
  94. }
  95. },
  96. methods: {
  97. // 删除图片
  98. deletePic(event) {
  99. this[`fileList${event.name}`].splice(event.index, 1);
  100. },
  101. // 新增图片
  102. async afterRead(event) {
  103. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  104. let lists = [].concat(event.file);
  105. let fileListLen = this[`fileList${event.name}`].length;
  106. lists.map((item) => {
  107. this[`fileList${event.name}`].push({
  108. ...item,
  109. status: "uploading",
  110. message: "上传中",
  111. });
  112. });
  113. for (let i = 0; i < lists.length; i++) {
  114. const result = await this.uploadFilePromise(lists[i].url);
  115. let item = this[`fileList${event.name}`][fileListLen];
  116. this[`fileList${event.name}`].splice(
  117. fileListLen,
  118. 1,
  119. Object.assign(item, {
  120. status: "success",
  121. message: "",
  122. url: result,
  123. })
  124. );
  125. fileListLen++;
  126. }
  127. },
  128. uploadFilePromise(url) {
  129. return new Promise((resolve, reject) => {
  130. let a = uni.uploadFile({
  131. url: "http://192.168.2.21:7001/upload", // 仅为示例,非真实的接口地址
  132. filePath: url,
  133. name: "file",
  134. formData: {
  135. user: "test",
  136. },
  137. success: (res) => {
  138. setTimeout(() => {
  139. resolve(res.data.data);
  140. }, 1000);
  141. },
  142. });
  143. });
  144. },
  145. paramsConfirm(e,type){
  146. this.placeShow = this.areaShow = this.typeShow = false;
  147. }
  148. }
  149. }
  150. </script>
  151. <style>
  152. .repair-inp-ph{
  153. color: #1D2129 !important;
  154. }
  155. </style>
  156. <style scoped lang="less">
  157. ::v-deep .desc .u-textarea{
  158. border: none;
  159. padding: 0 !important;
  160. }
  161. ::v-deep .upload .u-upload .u-upload__button{
  162. width: 168rpx !important;
  163. height: 180rpx !important;
  164. }
  165. ::v-deep .upload .u-upload .u-icon__icon{
  166. font-size: 24px !important;
  167. }
  168. .page {
  169. padding: 0 24rpx 168rpx;
  170. box-sizing: border-box;
  171. background: #F4F8FB;
  172. .form{
  173. background: #FFFFFF;
  174. border-radius: 16rpx;
  175. padding: 0 24rpx;
  176. margin-top: 20rpx;
  177. .item{
  178. height: 90rpx;
  179. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECECEC;
  180. display: flex;
  181. align-items: center;
  182. justify-content: space-between;
  183. .left{
  184. font-family: PingFangSC, PingFang SC;
  185. font-weight: 400;
  186. font-size: 30rpx;
  187. color: #1D2129;
  188. line-height: 42rpx;
  189. }
  190. .right{
  191. font-family: PingFangSC, PingFang SC;
  192. font-weight: 400;
  193. font-size: 28rpx;
  194. color: #1D2129;
  195. line-height: 40rpx;
  196. text-align: right;
  197. .tip{
  198. font-family: PingFangSC, PingFang SC;
  199. font-weight: 400;
  200. font-size: 28rpx;
  201. color: #B9C0C8;
  202. line-height: 40rpx;
  203. text-align: right;
  204. display: flex;
  205. align-items: center;
  206. }
  207. input{
  208. border: none;
  209. outline: none;
  210. font-family: PingFangSC, PingFang SC;
  211. font-weight: 400;
  212. font-size: 28rpx;
  213. color: #1D2129;
  214. line-height: 40rpx;
  215. text-align: right;
  216. }
  217. }
  218. }
  219. .pre{
  220. margin-top: 24rpx;
  221. overflow: hidden;
  222. .title{
  223. font-family: PingFangSC, PingFang SC;
  224. font-weight: 400;
  225. font-size: 30rpx;
  226. color: #1D2129;
  227. line-height: 42rpx;
  228. }
  229. .desc{
  230. margin: 24rpx 0 40rpx;
  231. }
  232. }
  233. }
  234. .upload{
  235. padding: 38rpx 24rpx;
  236. background: #FFFFFF;
  237. border-radius: 16rpx;
  238. margin-top: 20rpx;
  239. .title{
  240. font-family: PingFang-SC, PingFang-SC;
  241. font-weight: bold;
  242. font-size: 30rpx;
  243. color: #1D2129;
  244. line-height: 36rpx;
  245. }
  246. .box{
  247. margin-top: 34rpx;
  248. width: 168rpx;
  249. height: 180rpx;
  250. }
  251. }
  252. .bottom{
  253. width: 100%;
  254. height: 148rpx;
  255. padding: 20rpx 48rpx 0;
  256. box-sizing: border-box;
  257. background: #FFFFFF;
  258. position: fixed;
  259. left: 0;
  260. bottom: 0;
  261. .save{
  262. width: 100%;
  263. height: 88rpx;
  264. background: #198CFF;
  265. border-radius: 16rpx;
  266. font-family: PingFang-SC, PingFang-SC;
  267. font-weight: bold;
  268. font-size: 32rpx;
  269. color: #FFFFFF;
  270. line-height: 88rpx;
  271. text-align: center;
  272. letter-spacing: 2rpx;
  273. }
  274. }
  275. }
  276. </style>