add-logistics.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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. onShow() {
  145. this.$api.getStorage().then((resolve) => {
  146. this.userID = resolve.userID
  147. this.bindMobile = resolve.bindMobile
  148. })
  149. }
  150. }
  151. </script>
  152. <style lang="scss">
  153. page {
  154. height: auto;
  155. background:#F7F7F7;
  156. }
  157. @keyframes showRemarks {
  158. 0% {opacity: 0;}
  159. 20% {opacity: 0.2;}
  160. 40% {opacity: 0.4;}
  161. 60% {opacity: 0.6;}
  162. 80% {opacity: 0.8;}
  163. 100% {opacity: 1;}
  164. }
  165. @keyframes hideRemarks {
  166. 0% {opacity: 1;}
  167. 20% {opacity: 0.8;}
  168. 40% {opacity: 0.6;}
  169. 60% {opacity: 0.4;}
  170. 80% {opacity: 0.2;}
  171. 100% {opacity: 0;}
  172. }
  173. .logistics{
  174. border-top: 1px solid #EBEBEB;
  175. }
  176. .logistics-list{
  177. width: 100%;
  178. height: auto;
  179. padding: 10rpx 0;
  180. background-color: #FFFFFF;
  181. margin-bottom: 24rpx;
  182. .item-title{
  183. width: 702rpx;
  184. height: 80rpx;
  185. padding: 0 24rpx;
  186. line-height: 80rpx;
  187. text-align: left;
  188. font-size: $font-size-28;
  189. color: $text-color;
  190. border-bottom: 1px solid #EBEBEB;
  191. .title-left{
  192. float: left;
  193. }
  194. .title-right{
  195. float: right;
  196. .icon-shanchu{
  197. font-size: $font-size-30;
  198. color: #FF2A2A;
  199. }
  200. }
  201. }
  202. .item-main{
  203. width: 702rpx;
  204. padding: 0 24rpx;
  205. .item-main-cell{
  206. width: 100%;
  207. height: 80rpx;
  208. line-height: 80rpx;
  209. border-bottom: 1px solid #EBEBEB;
  210. position: relative;
  211. &.none{
  212. border-bottom: none;
  213. text-align: center;
  214. font-size: $font-size-28;
  215. color: $color-system;
  216. }
  217. .icon-xiayibu{
  218. width: 40rpx;
  219. height: 80rpx;
  220. display: block;
  221. position: absolute;
  222. right: 0;
  223. top: 0;
  224. font-size: $font-size-32;
  225. color: $text-color;
  226. text-align: center;
  227. }
  228. .icon-icon-test{
  229. color: $color-system;
  230. font-size: $font-size-28;
  231. margin-right: 10rpx;
  232. }
  233. .input{
  234. width: 100%;
  235. height: 44rpx;
  236. line-height: 44rpx;
  237. padding: 18rpx 0;
  238. font-size: $font-size-28;
  239. color: $text-color;
  240. }
  241. }
  242. }
  243. }
  244. .logistics-btn{
  245. width: 702rpx;
  246. height: 88rpx;
  247. margin: 0 auto;
  248. .btn{
  249. width: 100%;
  250. height: 100%;
  251. background-color: #FFF;
  252. border-radius: 14rpx;
  253. border: 1px solid $color-system;
  254. line-height: 88rpx;
  255. text-align: center;
  256. color: $color-system;
  257. }
  258. }
  259. .logistics-btn-fiexd{
  260. width: 702rpx;
  261. padding: 0 24rpx;
  262. height:auto;
  263. position: fixed;
  264. bottom: 0;
  265. left: 0;
  266. background-color: #FFF;
  267. border-radius: 20rpx 20rpx 0 0;
  268. box-shadow:0px 3px 10px rgba(51, 51, 51,0.5);
  269. z-index: 999;
  270. .btn-tips{
  271. height: 80rpx;
  272. line-height: 80rpx;
  273. text-align: center;
  274. font-size: $font-size-28;
  275. color: #999999;
  276. }
  277. .confim-btn{
  278. width: 702rpx;
  279. height: 88rpx;
  280. background: $btn-confirm;
  281. line-height: 88rpx;
  282. text-align: center;
  283. color: #FFF;
  284. font-size: $font-size-28;
  285. border-radius: 14rpx;
  286. }
  287. .logistics-remarks{
  288. width: 100%;
  289. height: auto;
  290. &.show {
  291. animation: showRemarks 0.2s linear both;
  292. }
  293. &.hide {
  294. animation: hideRemarks 0.2s linear both;
  295. }
  296. .label{
  297. height: 44rpx;
  298. line-height: 44rpx;
  299. font-size: $font-size-28;
  300. color: $text-color;
  301. }
  302. .remarks-photo{
  303. width: 100%;
  304. height: auto;
  305. padding: 10rpx 0;
  306. .photo-item{
  307. display: inline-block;
  308. width: 112rpx;
  309. height: 112rpx;
  310. margin: 10rpx 0;
  311. margin-right: 25rpx;
  312. border-radius: 10rpx;
  313. border:1px solid #F5F5F5;
  314. position: relative;
  315. float: left;
  316. &.add{
  317. width: 112rpx;
  318. height: 112rpx;
  319. border-color: #FFC684;
  320. text-align: center;
  321. line-height: 112rpx;
  322. margin-right: 0rpx;
  323. .icon-jiahao{
  324. font-size: $font-size-44;
  325. color:#FFC684 ;
  326. font-weight: bold;
  327. }
  328. }
  329. .icon-iconfontguanbi{
  330. width: 24rpx;
  331. height: 24rpx;
  332. border-radius: 0 10rpx 0 0;
  333. display: block;
  334. position: absolute;
  335. right: 0;
  336. top: 0;
  337. background: rgba(51, 51, 51, 0.7);
  338. text-align: center;
  339. line-height: 24rpx;
  340. color: #FFF;
  341. font-size: $font-size-22;
  342. }
  343. image{
  344. width: 112rpx;
  345. height: 112rpx;
  346. border-radius: 10rpx;
  347. }
  348. }
  349. .photo-list{
  350. width: 100%;
  351. height: 116rpx;
  352. overflow: hidden;
  353. white-space: nowrap;
  354. display: flex;
  355. align-items: flex-start;
  356. }
  357. .scoll-wrapper{
  358. display:flex;
  359. align-items: flex-start;
  360. }
  361. }
  362. .remarks-textarea{
  363. width: 652rpx;
  364. height: 124rpx;
  365. padding:10rpx 24rpx 24rpx 24rpx;
  366. margin-top: 20rpx;
  367. background-color: #F5F5F5;
  368. border-radius: 10rpx;
  369. position: relative;
  370. .textarea{
  371. width: 100%;
  372. height: 100%;
  373. line-height: 36rpx;
  374. font-size: $font-size-24;
  375. color: $text-color;
  376. z-index: 1;
  377. }
  378. .limit-text{
  379. position: absolute;
  380. right: 20rpx;
  381. bottom: 0;
  382. line-height: 44rpx;
  383. font-size: $font-size-24;
  384. color: #D0D0D0;
  385. .red{
  386. color: $color-system;
  387. }
  388. }
  389. }
  390. .remarks-tips{
  391. width: 100%;
  392. line-height: 70rpx;
  393. font-size: $font-size-24;
  394. color: #999999;
  395. }
  396. }
  397. }
  398. </style>