confirmCompanyOrder.vue 13 KB

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