add-logistics.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <view class="container logistics" :style="{paddingBottom :isIphoneX ? (236+68)+'rpx' : '236rpx'}">
  3. <view class="logistics-list" v-for="(item,index) in logisticsList" :key="index">
  4. <view class="item-title">
  5. <view class="title-left">物流{{index+1}}</view>
  6. <view class="title-right" v-if="(index+1) > 1" @click="deleteLogistItemFn(item,index)">
  7. <text class="iconfont icon-shanchu" ></text>删除
  8. </view>
  9. </view>
  10. <view class="item-main">
  11. <view class="item-main-cell" @click.stop="pageNavigateTo">
  12. <input class="input" type="text" v-model="item.name" placeholder="物流公司" disabled="true">
  13. <text class="iconfont icon-xiayibu"></text>
  14. </view>
  15. <view class="item-main-cell">
  16. <input class="input" type="text" v-model="item.number" placeholder="物流单号">
  17. </view>
  18. <view class="item-main-cell none" @click.stop="AddScanCode" >
  19. <text class="iconfont icon-icon-test" ></text><text>扫码录入</text>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="logistics-btn">
  24. <view class="btn add-btn" @click="addListFn">添加物流</view>
  25. </view>
  26. <view class="logistics-btn-fiexd" :style="{paddingBottom :isIphoneX ? '68rpx' : '0'}">
  27. <view class="btn-tips" @click.stop="showShowRemarksFn">
  28. <text class="iconfont icon-xiangxiajiantou" v-if="isShowRemarks"></text>
  29. <text class="iconfont icon-xiangshangjiantou" v-else></text>
  30. 添加备注
  31. </view>
  32. <view class="logistics-remarks" :class="specClass" v-show="isShowRemarks">
  33. <view class="label">拍照备注</view>
  34. <view class="remarks-photo clearfix">
  35. <view class="photo-item" v-for="(item, index) in photoLists" :key="index">
  36. <image :src="item" mode="aspectFill" @click="previewImg(index)"></image>
  37. <text class="iconfont icon-iconfontguanbi" @click.stop="deletePhotoFn(index)"></text>
  38. </view>
  39. <view class="photo-item add" @click.stop="uploadPhotoFn" v-if="photoLists.length<10">
  40. <text class="iconfont icon-jiahao"></text>
  41. </view>
  42. </view>
  43. <view class="label">文字备注</view>
  44. <view class="remarks-textarea">
  45. <textarea class="textarea" v-model="contentText" value="" placeholder="文字备注,200字以内" maxlength="200" @input="conInput"/>
  46. <text class="limit-text"><text class="red">{{min}}</text>/{{max}}</text>
  47. </view>
  48. <view class="remarks-tips">请备注快递单、发货现场和货物的照片,最多10张</view>
  49. </view>
  50. <view class="btn confim-btn" @click="confirmDeliverFn">确认发货</view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import { mapState,mapMutations } from 'vuex'
  56. import authorize from '@/common/config/authorize.js'
  57. import { uploadFileImage } from "@/api/utils.js"
  58. var isPreviewImg;
  59. export default{
  60. data() {
  61. return{
  62. userID:'',
  63. isIphoneX:this.$store.state.isIphoneX,
  64. isShowRemarks:false,
  65. specClass:'',
  66. photoLists:[],
  67. logisticsList:[{
  68. name:'',
  69. number:''
  70. }],
  71. contentText:'',
  72. min:0,
  73. max:200
  74. }
  75. },
  76. onLoad(option) {
  77. },
  78. methods:{
  79. ...mapMutations(['login']),
  80. AddScanCode(item){
  81. let self = this;
  82. uni.scanCode({
  83. onlyFromCamera: true,
  84. success: function (res) {
  85. console.log(res);
  86. item.name=res.scanType
  87. item.number=res.result
  88. self.CommonService.getExpressInformation({resultv2:2,text:res.result}).then(response =>{
  89. console.log(response)
  90. })
  91. console.log('条码类型:' + res.scanType);
  92. console.log('条码内容:' + res.result);
  93. }
  94. });
  95. },
  96. addListFn(){
  97. this.isShowRemarks = false
  98. let obj ={name:'',number:''};
  99. this.logisticsList.push(obj)
  100. },
  101. deleteLogistItemFn(item,index){
  102. this.$util.modal('提示','确认删除物流信息吗?','确定','取消',true,() =>{
  103. this.logisticsList.splice(index, 1);
  104. })
  105. },
  106. pageNavigateTo(){
  107. this.$api.navigateTo('/supplier/pages/deliver/logistics-list')
  108. },
  109. showShowRemarksFn(){
  110. this.isShowRemarks = !this.isShowRemarks
  111. if(this.isShowRemarks){
  112. this.specClass = 'show';
  113. }else{
  114. this.specClass = 'hide';
  115. }
  116. },
  117. uploadPhotoFn(){
  118. uploadFileImage().then(res =>{
  119. this.photoLists.push(JSON.parse(res.data).data)
  120. })
  121. },
  122. deletePhotoFn(index){
  123. this.photoLists.splice(index, 1);
  124. },
  125. previewImg (index) {//顶部商品图片预览
  126. isPreviewImg = true
  127. let previewUrls = this.photoLists
  128. uni.previewImage({
  129. current: index, //图片索引
  130. urls: previewUrls, //必须是http图片,本地图片无效
  131. longPressActions:''
  132. })
  133. },
  134. conInput(e){
  135. let value = e.detail.value;
  136. let len = parseInt(value.length);
  137. if (len > this.max) return;
  138. this.min = len;
  139. if(this.min == 200){
  140. this.$util.msg('您输入的次数已达上限',2000);
  141. }
  142.              
  143. }
  144. },
  145. onShow() {
  146. this.$api.getStorage().then((resolve) => {
  147. this.userID = resolve.userID
  148. this.bindMobile = resolve.bindMobile
  149. })
  150. }
  151. }
  152. </script>
  153. <style lang="scss">
  154. page {
  155. height: auto;
  156. background:#F7F7F7;
  157. }
  158. @keyframes showRemarks {
  159. 0% {opacity: 0;}
  160. 20% {opacity: 0.2;}
  161. 40% {opacity: 0.4;}
  162. 60% {opacity: 0.6;}
  163. 80% {opacity: 0.8;}
  164. 100% {opacity: 1;}
  165. }
  166. @keyframes hideRemarks {
  167. 0% {opacity: 1;}
  168. 20% {opacity: 0.8;}
  169. 40% {opacity: 0.6;}
  170. 60% {opacity: 0.4;}
  171. 80% {opacity: 0.2;}
  172. 100% {opacity: 0;}
  173. }
  174. .logistics{
  175. border-top: 1px solid #EBEBEB;
  176. }
  177. .logistics-list{
  178. width: 100%;
  179. height: auto;
  180. padding: 10rpx 0;
  181. background-color: #FFFFFF;
  182. margin-bottom: 24rpx;
  183. .item-title{
  184. width: 702rpx;
  185. height: 80rpx;
  186. padding: 0 24rpx;
  187. line-height: 80rpx;
  188. text-align: left;
  189. font-size: $font-size-28;
  190. color: $text-color;
  191. border-bottom: 1px solid #EBEBEB;
  192. .title-left{
  193. float: left;
  194. }
  195. .title-right{
  196. float: right;
  197. .icon-shanchu{
  198. font-size: $font-size-30;
  199. color: #FF2A2A;
  200. }
  201. }
  202. }
  203. .item-main{
  204. width: 702rpx;
  205. padding: 0 24rpx;
  206. .item-main-cell{
  207. width: 100%;
  208. height: 80rpx;
  209. line-height: 80rpx;
  210. border-bottom: 1px solid #EBEBEB;
  211. position: relative;
  212. &.none{
  213. border-bottom: none;
  214. text-align: center;
  215. font-size: $font-size-28;
  216. color: $color-system;
  217. }
  218. .icon-xiayibu{
  219. width: 40rpx;
  220. height: 80rpx;
  221. display: block;
  222. position: absolute;
  223. right: 0;
  224. top: 0;
  225. font-size: $font-size-32;
  226. color: $text-color;
  227. text-align: center;
  228. }
  229. .icon-icon-test{
  230. color: $color-system;
  231. font-size: $font-size-28;
  232. margin-right: 10rpx;
  233. }
  234. .input{
  235. width: 100%;
  236. height: 44rpx;
  237. line-height: 44rpx;
  238. padding: 18rpx 0;
  239. font-size: $font-size-28;
  240. color: $text-color;
  241. }
  242. }
  243. }
  244. }
  245. .logistics-btn{
  246. width: 702rpx;
  247. height: 88rpx;
  248. margin: 0 auto;
  249. .btn{
  250. width: 100%;
  251. height: 100%;
  252. background-color: #FFF;
  253. border-radius: 14rpx;
  254. border: 1px solid $color-system;
  255. line-height: 88rpx;
  256. text-align: center;
  257. color: $color-system;
  258. }
  259. }
  260. .logistics-btn-fiexd{
  261. width: 702rpx;
  262. padding: 0 24rpx;
  263. height:auto;
  264. position: fixed;
  265. bottom: 0;
  266. left: 0;
  267. background-color: #FFF;
  268. border-radius: 20rpx 20rpx 0 0;
  269. box-shadow:0px 3px 10px rgba(51, 51, 51,0.5);
  270. z-index: 999;
  271. .btn-tips{
  272. height: 80rpx;
  273. line-height: 80rpx;
  274. text-align: center;
  275. font-size: $font-size-28;
  276. color: #999999;
  277. }
  278. .confim-btn{
  279. width: 702rpx;
  280. height: 88rpx;
  281. background: $btn-confirm;
  282. line-height: 88rpx;
  283. text-align: center;
  284. color: #FFF;
  285. font-size: $font-size-28;
  286. border-radius: 14rpx;
  287. }
  288. .logistics-remarks{
  289. width: 100%;
  290. height: auto;
  291. &.show {
  292. animation: showRemarks 0.2s linear both;
  293. }
  294. &.hide {
  295. animation: hideRemarks 0.2s linear both;
  296. }
  297. .label{
  298. height: 44rpx;
  299. line-height: 44rpx;
  300. font-size: $font-size-28;
  301. color: $text-color;
  302. }
  303. .remarks-photo{
  304. width: 100%;
  305. height: auto;
  306. padding: 10rpx 0;
  307. .photo-item{
  308. display: inline-block;
  309. width: 112rpx;
  310. height: 112rpx;
  311. margin: 10rpx 0;
  312. margin-right: 25rpx;
  313. border-radius: 10rpx;
  314. border:1px solid #F5F5F5;
  315. position: relative;
  316. float: left;
  317. &.add{
  318. width: 112rpx;
  319. height: 112rpx;
  320. border-color: #FFC684;
  321. text-align: center;
  322. line-height: 112rpx;
  323. margin-right: 0rpx;
  324. .icon-jiahao{
  325. font-size: $font-size-44;
  326. color:#FFC684 ;
  327. font-weight: bold;
  328. }
  329. }
  330. .icon-iconfontguanbi{
  331. width: 24rpx;
  332. height: 24rpx;
  333. border-radius: 0 10rpx 0 0;
  334. display: block;
  335. position: absolute;
  336. right: 0;
  337. top: 0;
  338. background: rgba(51, 51, 51, 0.7);
  339. text-align: center;
  340. line-height: 24rpx;
  341. color: #FFF;
  342. font-size: $font-size-22;
  343. }
  344. image{
  345. width: 112rpx;
  346. height: 112rpx;
  347. border-radius: 10rpx;
  348. }
  349. }
  350. .photo-list{
  351. width: 100%;
  352. height: 116rpx;
  353. overflow: hidden;
  354. white-space: nowrap;
  355. display: flex;
  356. align-items: flex-start;
  357. }
  358. .scoll-wrapper{
  359. display:flex;
  360. align-items: flex-start;
  361. }
  362. }
  363. .remarks-textarea{
  364. width: 652rpx;
  365. height: 124rpx;
  366. padding:10rpx 24rpx 24rpx 24rpx;
  367. margin-top: 20rpx;
  368. background-color: #F5F5F5;
  369. border-radius: 10rpx;
  370. position: relative;
  371. .textarea{
  372. width: 100%;
  373. height: 100%;
  374. line-height: 36rpx;
  375. font-size: $font-size-24;
  376. color: $text-color;
  377. z-index: 1;
  378. }
  379. .limit-text{
  380. position: absolute;
  381. right: 20rpx;
  382. bottom: 0;
  383. line-height: 44rpx;
  384. font-size: $font-size-24;
  385. color: #D0D0D0;
  386. .red{
  387. color: $color-system;
  388. }
  389. }
  390. }
  391. .remarks-tips{
  392. width: 100%;
  393. line-height: 70rpx;
  394. font-size: $font-size-24;
  395. color: #999999;
  396. }
  397. }
  398. }
  399. </style>