confirmCompanyOrder.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. <template>
  2. <view>
  3. <view class="inner-box">
  4. <!-- 药品列表 -->
  5. <view class="goods-list">
  6. <view v-for="(item,index) in carts" :key="index" class="item" @click="showDetail(item)">
  7. <view class="img-box">
  8. <image :src="item.productImage" mode="aspectFill"></image>
  9. </view>
  10. <view class="info-box">
  11. <view>
  12. <view class="name-box ellipsis2">
  13. <view class="tag">{{utils.getDictLabelName("storeProductType",item.productType)}}</view>{{item.productName}}
  14. </view>
  15. <view class="spec ellipsis2">{{item.productAttrName}}</view>
  16. </view>
  17. <view class="price-num">
  18. <view class="price">
  19. <text class="unit">¥</text>
  20. <text class="num">{{item.price.toFixed(2)}}</text>
  21. </view>
  22. <view class="num">x{{item.cartNum}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 小计 -->
  27. <view class="sub-total">
  28. <text class="label">合计金额:</text>
  29. <view class="price">
  30. <text class="unit">¥</text>
  31. <text class="num">{{price.payPrice.toFixed(2)}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="bgf p20 radius24 mt28 justify-start align-center">
  36. <view v-for="(item,index) in authList" :key="index" class="mr20 ">
  37. <view :class="authType==index?'acttype ':''" class="p16 radius12"
  38. @click="getauthType(item.type)">{{item.name}}</view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 底部按钮 -->
  43. <view class="btn-foot">
  44. <view class="right">
  45. <view class="total" >
  46. <text class="label">总金额:</text>
  47. <view class="price">
  48. <text class="unit">¥</text>
  49. <text class="num">{{price.totalPrice.toFixed(2)}}</text>
  50. </view>
  51. </view>
  52. <view class="btn" @click="openUpdateMoney()" >
  53. 实收金额
  54. </view>
  55. <view class="btn" >
  56. 分享
  57. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  58. </view>
  59. </view>
  60. </view>
  61. <modal v-if="inputShow" title="定金金额" confirm-text="保存" cancel-text="取消" @cancel="cancelUpdateMoney" @confirm="confirmUpdateMoney">
  62. <view class="pay-types">
  63. <radio-group @change="payTypeChange" class="justify-between" >
  64. <!-- <view class="item" >
  65. <view class="left" >
  66. <image src="https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/shop/images/wecha_pay.png" mode=""></image>
  67. <text class="text">实付金额</text>
  68. </view>
  69. <label>
  70. <radio :value="1" :checked="payType=='1'" />
  71. </label>
  72. </view> -->
  73. <view class="item" v-if='price.totalPrice>99'>
  74. <view class="left" >
  75. <image src="https://ysy-1329817240.cos.ap-guangzhou.myqcloud.com/shop/images/pay_de.png" mode=""></image>
  76. <text class="text">物流代收</text>
  77. </view>
  78. <label>
  79. <radio :value="3" :checked="payType=='3'" />
  80. </label>
  81. </view>
  82. </radio-group>
  83. </view>
  84. <!-- <input type="text" v-model="inputTxt"
  85. placeholder="请输入实收金额" class="intxt" maxlength="8" /> -->
  86. <view class="justify-start align-center">
  87. <view>定金金额:</view>
  88. <input type="text" v-model="payAmount"
  89. placeholder="请输入定金金额" class="intxt" maxlength="8" v-if="payType==3" />
  90. </view>
  91. </modal>
  92. </view>
  93. </template>
  94. <script>
  95. import {getSalesOrder,addUserCart,updateSalseOrderMoney} from '@/api/companyOrder.js'
  96. export default {
  97. data() {
  98. return {
  99. inputShow:false,
  100. inputTxt:null,
  101. orderKey:null,
  102. price:{
  103. payPrice:0.00,
  104. totalPrice:0.00,
  105. },
  106. carts:[],
  107. isAgreement:false,
  108. payAmount:'',
  109. shareimg:'',
  110. sharetitle:"",
  111. CompanyUserInfo:null,
  112. payType:3,
  113. authList:[
  114. {
  115. name:'手机号登录',
  116. type:0
  117. },
  118. {
  119. name:'静默授权',
  120. type:1
  121. }
  122. ],
  123. authType:0
  124. }
  125. },
  126. onLoad(option) {
  127. this.orderKey=option.orderKey;
  128. this.getSalesOrder();
  129. this.CompanyUserInfo=uni.getStorageSync('CompanyUserInfo')
  130. },
  131. //发送给朋友
  132. onShareAppMessage(res) {
  133. return {
  134. title: this.sharetitle,
  135. path: '/pages_company/order/confirmOrder?orderKey='+this.orderKey+'&companyUserId='+this.CompanyUserInfo.userId
  136. +'&authType='+this.authType,
  137. imageUrl:this.shareimg //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  138. }
  139. },
  140. //分享到朋友圈
  141. onShareTimeline(res) {
  142. return {
  143. title:this.sharetitle,
  144. query:'orderKey='+this.orderKey+'&companyUserId='+this.CompanyUserInfo.userId+'&authType='+this.authType,
  145. imageUrl:this.shareimg //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  146. }
  147. },
  148. methods: {
  149. getauthType(type){
  150. this.authType=type
  151. },
  152. payTypeChange(e){
  153. this.payType=e.detail.value
  154. console.log(this.payType)
  155. },
  156. handleAgreement(){
  157. this.isAgreement=!this.isAgreement
  158. },
  159. openUpdateMoney(){
  160. console.log(1)
  161. this.inputShow = true
  162. },
  163. cancelUpdateMoney(){
  164. this.inputShow = false
  165. },
  166. confirmUpdateMoney(){
  167. console.log(parseFloat(this.inputTxt) )
  168. console.log(parseFloat(this.payAmount) )
  169. if(this.inputTxt==null){
  170. this.inputTxt=this.price.payPrice
  171. }
  172. if(this.payAmount==null&&this.payType==3){
  173. uni.showToast({
  174. icon:'none',
  175. title: '请输入物流代收金额',
  176. // title: '请输入物流代收金额,金额必须大于0',
  177. });
  178. return
  179. }
  180. if(this.inputTxt==null&&this.payType==3){
  181. uni.showToast({
  182. icon:'none',
  183. title: '请输入实收金额',
  184. });
  185. return
  186. }
  187. if(parseFloat(this.inputTxt)>0||parseFloat(this.payAmount)>0){
  188. var that=this;
  189. if(this.inputTxt==0){
  190. this.inputTxt=this.price.totalPrice.toFixed(2)
  191. }
  192. var data={createOrderKey:this.orderKey,token:uni.getStorageSync('CompanyUserToken'),
  193. money:this.inputTxt,payAmount:this.payAmount,payType:this.payType}
  194. updateSalseOrderMoney(data).then(
  195. res => {
  196. if(res.code==200){
  197. this.inputShow = false
  198. this.getSalesOrder();
  199. }else{
  200. uni.showToast({
  201. icon:'none',
  202. title: res.msg,
  203. });
  204. }
  205. },
  206. rej => {}
  207. );
  208. }
  209. else{
  210. uni.showToast({
  211. icon:'none',
  212. title: "必须其中一个金额大于0",
  213. });
  214. }
  215. },
  216. showDetail(item) {
  217. uni.navigateTo({
  218. url: 'productDetails?productId='+item.productId
  219. })
  220. },
  221. getSalesOrder(){
  222. var that=this;
  223. that.price.payPrice=0;
  224. that.price.totalPrice=0;
  225. var data={createOrderKey:this.orderKey}
  226. getSalesOrder(data).then(
  227. res => {
  228. if(res.code==200){
  229. this.carts=res.carts;
  230. this.shareimg=res.carts[0].productImage
  231. this.sharetitle=res.carts[0].productName
  232. this.carts.forEach(function(element) {
  233. that.price.payPrice+=element.price*element.cartNum;
  234. });
  235. that.price.totalPrice=res.totalMoney
  236. }else{
  237. uni.showToast({
  238. icon:'none',
  239. title: res.msg,
  240. });
  241. }
  242. },
  243. rej => {}
  244. );
  245. },
  246. }
  247. }
  248. </script>
  249. <style lang="scss">
  250. .acttype{
  251. background-color: #2BC7B9;
  252. color: #fff;
  253. }
  254. .pay-types{
  255. box-sizing: border-box;
  256. // background: #FFFFFF;
  257. border-radius: 16upx;
  258. margin-top: 20upx;
  259. padding: 10upx 10upx;
  260. .title{
  261. font-size: 28upx;
  262. font-family: PingFang SC;
  263. font-weight: 500;
  264. color: #999999;
  265. line-height: 1;
  266. margin-bottom: 10upx;
  267. }
  268. .item{
  269. padding: 15upx 0upx;
  270. display: flex;
  271. align-items: center;
  272. justify-content: space-between;
  273. margin-left: 12rpx;
  274. .left{
  275. display: flex;
  276. align-items: center;
  277. image{
  278. width: 44upx;
  279. height: 44upx;
  280. margin-right: 20upx;
  281. }
  282. .text{
  283. font-size: 30upx;
  284. font-family: PingFang SC;
  285. margin-right: 10rpx;
  286. font-weight: bold;
  287. color: #222222;
  288. line-height: 1;
  289. }
  290. }
  291. }
  292. }
  293. .inner-box{
  294. padding: 20upx 20upx 140upx;
  295. .goods-list{
  296. margin-top: 20upx;
  297. padding: 0 30upx;
  298. background-color: #FFFFFF;
  299. border-radius: 16upx;
  300. .item{
  301. padding: 30upx 0;
  302. border-bottom: 1px solid #EDEEEF;
  303. display: flex;
  304. align-items: center;
  305. .img-box{
  306. width: 160upx;
  307. height: 160upx;
  308. margin-right: 30upx;
  309. image{
  310. width: 100%;
  311. height: 100%;
  312. }
  313. }
  314. .info-box{
  315. width: calc(100% - 190upx);
  316. height: 160upx;
  317. display: flex;
  318. flex-direction: column;
  319. justify-content: space-between;
  320. .name-box{
  321. font-size: 28upx;
  322. font-family: PingFang SC;
  323. font-weight: 500;
  324. color: #111111;
  325. line-height: 40upx;
  326. .tag{
  327. display: inline-block;
  328. padding: 0 6upx;
  329. height: 30upx;
  330. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  331. border-radius: 4upx;
  332. margin-right: 10upx;
  333. font-size: 22upx;
  334. font-family: PingFang SC;
  335. font-weight: bold;
  336. color: #FFFFFF;
  337. line-height: 30upx;
  338. float: left;
  339. margin-top: 7upx;
  340. }
  341. }
  342. .spec{
  343. margin-top: 10upx;
  344. font-size: 24upx;
  345. font-family: PingFang SC;
  346. font-weight: 500;
  347. color: #999999;
  348. line-height: 1;
  349. }
  350. .price-num{
  351. display: flex;
  352. align-items: center;
  353. justify-content: space-between;
  354. .price{
  355. display: flex;
  356. align-items: flex-end;
  357. .unit{
  358. font-size: 24upx;
  359. font-family: PingFang SC;
  360. font-weight: 500;
  361. color: #111111;
  362. line-height: 1.2;
  363. margin-right: 4upx;
  364. }
  365. .num{
  366. font-size: 32upx;
  367. font-family: PingFang SC;
  368. font-weight: 500;
  369. color: #111111;
  370. line-height: 1;
  371. }
  372. }
  373. .num{
  374. font-size: 24upx;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. color: #999999;
  378. line-height: 1;
  379. }
  380. }
  381. }
  382. }
  383. .sub-total{
  384. height: 88upx;
  385. display: flex;
  386. align-items: center;
  387. justify-content: flex-end;
  388. .label{
  389. font-size: 24upx;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. color: #999999;
  393. }
  394. .price{
  395. display: flex;
  396. align-items: flex-end;
  397. .unit{
  398. font-size: 24upx;
  399. font-family: PingFang SC;
  400. font-weight: 500;
  401. color: #FF6633;
  402. line-height: 1.2;
  403. margin-right: 4upx;
  404. }
  405. .num{
  406. font-size: 32upx;
  407. font-family: PingFang SC;
  408. font-weight: bold;
  409. color: #FF6633;
  410. line-height: 1;
  411. }
  412. }
  413. }
  414. }
  415. .points{
  416. height: 88upx;
  417. padding: 0 30upx;
  418. background: #FFFFFF;
  419. border-radius: 16upx;
  420. display: flex;
  421. align-items: center;
  422. justify-content: space-between;
  423. .left{
  424. display: flex;
  425. align-items: center;
  426. image{
  427. width: 28upx;
  428. height: 28upx;
  429. margin-right: 20upx;
  430. }
  431. .text{
  432. font-size: 28upx;
  433. font-family: PingFang SC;
  434. font-weight: 500;
  435. color: #666666;
  436. }
  437. }
  438. .right{
  439. display: flex;
  440. align-items: center;
  441. .text{
  442. font-size: 28upx;
  443. font-family: PingFang SC;
  444. font-weight: 500;
  445. color: #111111;
  446. }
  447. image{
  448. margin-left: 15upx;
  449. width: 14upx;
  450. height: 24upx;
  451. }
  452. }
  453. }
  454. .remarks{
  455. height: 88upx;
  456. padding: 0 30upx;
  457. background: #FFFFFF;
  458. border-radius: 16upx;
  459. margin-top: 20upx;
  460. display: flex;
  461. align-items: center;
  462. input{
  463. width: 100%;
  464. font-size: 28upx;
  465. font-family: PingFang SC;
  466. font-weight: 500;
  467. color: #000000;
  468. }
  469. .input{
  470. font-size: 28upx;
  471. font-family: PingFang SC;
  472. font-weight: 500;
  473. color: #999999;
  474. }
  475. }
  476. }
  477. .btn-foot{
  478. box-sizing: border-box;
  479. width: 100%;
  480. height: 121upx;
  481. background: #FFFFFF;
  482. padding: 16upx 30upx;
  483. display: flex;
  484. align-items: center;
  485. justify-content: flex-end;
  486. position: fixed;
  487. left: 0;
  488. bottom: 0;
  489. z-index: 99;
  490. .right{
  491. display: flex;
  492. align-items: center;
  493. .total{
  494. display: flex;
  495. align-items: flex-end;
  496. margin-right: 15upx;
  497. .label{
  498. font-size: 26upx;
  499. font-family: PingFang SC;
  500. font-weight: 500;
  501. color: #999999;
  502. line-height: 1.5;
  503. }
  504. .price{
  505. display: flex;
  506. align-items: flex-end;
  507. .unit{
  508. font-size: 28upx;
  509. font-family: PingFang SC;
  510. font-weight: bold;
  511. color: #FF6633;
  512. line-height: 1.2;
  513. margin-right: 10upx;
  514. }
  515. .num{
  516. font-size: 32upx;
  517. font-family: PingFang SC;
  518. font-weight: bold;
  519. color: #FF6633;
  520. line-height: 1;
  521. }
  522. }
  523. }
  524. .btn{
  525. margin-left: 10rpx;
  526. width: 180upx;
  527. height: 88upx;
  528. line-height: 88upx;
  529. text-align: center;
  530. font-size: 30upx;
  531. font-family: PingFang SC;
  532. font-weight: bold;
  533. color: #FFFFFF;
  534. background: #2BC7B9;
  535. border-radius: 44upx;
  536. position: relative;
  537. .share{
  538. display: inline-block;
  539. position: absolute;
  540. top: 0;
  541. left: 0;
  542. width: 100%;
  543. height: 100%rpx;
  544. opacity: 0;
  545. }
  546. }
  547. }
  548. }
  549. </style>