confirmCompanyOrder.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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>
  36. <!-- 底部按钮 -->
  37. <view class="btn-foot">
  38. <view class="right">
  39. <view class="total" >
  40. <text class="label">总金额:</text>
  41. <view class="price">
  42. <text class="unit">¥</text>
  43. <text class="num">{{price.totalPrice.toFixed(2)}}</text>
  44. </view>
  45. </view>
  46. <view class="btn" @click="openUpdateMoney()" >
  47. 实收金额
  48. </view>
  49. <view class="btn" >
  50. 分享
  51. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  52. </view>
  53. </view>
  54. </view>
  55. <modal v-if="inputShow" title="实收金额" confirm-text="保存" cancel-text="取消" @cancel="cancelUpdateMoney" @confirm="confirmUpdateMoney">
  56. <input type="text" v-model="inputTxt" placeholder="请输入实收金额" class="intxt" maxlength="8" />
  57. <input type="text" v-model="payAmount" placeholder="请输入货到付款金额" class="intxt pay_type" maxlength="8" />
  58. </modal>
  59. </view>
  60. </template>
  61. <script>
  62. import {getSalesOrder,addUserCart,updateSalseOrderMoney} from '@/api/companyOrder.js'
  63. export default {
  64. data() {
  65. return {
  66. inputShow:false,
  67. inputTxt:null,
  68. orderKey:null,
  69. price:{
  70. payPrice:0.00,
  71. totalPrice:0.00,
  72. },
  73. carts:[],
  74. isAgreement:false,
  75. payAmount:null,
  76. CompanyUserInfo:uni.getStorageSync('CompanyUserInfo'),
  77. packageId:'',
  78. isPackage:0
  79. }
  80. },
  81. onLoad(option) {
  82. this.orderKey=option.orderKey;
  83. if(option.packageId){
  84. this.packageId=option.packageId
  85. this.isPackage=1
  86. }
  87. this.getSalesOrder();
  88. },
  89. //发送给朋友
  90. onShareAppMessage(res) {
  91. return {
  92. title: this.carts[0].productName,
  93. path: '/pages_company/order/confirmOrder?orderKey='+this.orderKey+'&companyUserId='+this.CompanyUserInfo.userId+'&packageId='+this.packageId,
  94. imageUrl: this.carts[0].productImage //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  95. }
  96. },
  97. //分享到朋友圈
  98. onShareTimeline(res) {
  99. return {
  100. title:this.carts[0].productName,
  101. query:'orderKey='+this.orderKey+'&companyUserId='+this.CompanyUserInfo.userId+'&packageId='+this.packageId,
  102. imageUrl:this.carts[0].productImage //分享图标,路径可以是本地文件路径、代码包文件路径或者网络图片路径.支持PNG及JPG。显示图片长宽比是 5:4
  103. }
  104. },
  105. methods: {
  106. handleAgreement(){
  107. this.isAgreement=!this.isAgreement
  108. },
  109. openUpdateMoney(){
  110. console.log(1)
  111. this.inputShow = true
  112. },
  113. cancelUpdateMoney(){
  114. this.inputShow = false
  115. },
  116. confirmUpdateMoney(){
  117. console.log(parseFloat(this.inputTxt) )
  118. console.log(parseFloat(this.payAmount) )
  119. if(parseFloat(this.inputTxt)>0||parseFloat(this.payAmount)>0){
  120. var that=this;
  121. if(this.inputTxt==0){
  122. this.inputTxt=this.price.totalPrice.toFixed(2)
  123. }
  124. var data={createOrderKey:this.orderKey,token:uni.getStorageSync('CompanyUserToken'),
  125. isPackage:this.isPackage,
  126. money:this.inputTxt,payAmount:this.payAmount}
  127. updateSalseOrderMoney(data).then(
  128. res => {
  129. if(res.code==200){
  130. this.inputShow = false
  131. this.getSalesOrder();
  132. }else{
  133. uni.showToast({
  134. icon:'none',
  135. title: res.msg,
  136. });
  137. }
  138. },
  139. rej => {}
  140. );
  141. }
  142. else{
  143. uni.showToast({
  144. icon:'none',
  145. title: "必须其中一个金额大于0",
  146. });
  147. }
  148. },
  149. showDetail(item) {
  150. uni.navigateTo({
  151. url: 'productDetails?productId='+item.productId
  152. })
  153. },
  154. getSalesOrder(){
  155. var that=this;
  156. that.price.payPrice=0;
  157. that.price.totalPrice=0;
  158. var data={createOrderKey:this.orderKey}
  159. getSalesOrder(data).then(
  160. res => {
  161. if(res.code==200){
  162. this.carts=res.carts;
  163. this.carts.forEach(function(element) {
  164. that.price.payPrice+=element.price*element.cartNum;
  165. });
  166. that.price.totalPrice=res.totalMoney
  167. }else{
  168. uni.showToast({
  169. icon:'none',
  170. title: res.msg,
  171. });
  172. }
  173. },
  174. rej => {}
  175. );
  176. },
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. .pay_type{
  182. margin-top: 20rpx;
  183. }
  184. .inner-box{
  185. padding: 20upx 20upx 140upx;
  186. .goods-list{
  187. margin-top: 20upx;
  188. padding: 0 30upx;
  189. background-color: #FFFFFF;
  190. border-radius: 16upx;
  191. .item{
  192. padding: 30upx 0;
  193. border-bottom: 1px solid #EDEEEF;
  194. display: flex;
  195. align-items: center;
  196. .img-box{
  197. width: 160upx;
  198. height: 160upx;
  199. margin-right: 30upx;
  200. image{
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. .info-box{
  206. width: calc(100% - 190upx);
  207. height: 160upx;
  208. display: flex;
  209. flex-direction: column;
  210. justify-content: space-between;
  211. .name-box{
  212. font-size: 28upx;
  213. font-family: PingFang SC;
  214. font-weight: 500;
  215. color: #111111;
  216. line-height: 40upx;
  217. .tag{
  218. display: inline-block;
  219. padding: 0 6upx;
  220. height: 30upx;
  221. background: linear-gradient(90deg, #66b2ef 0%, #2BC7B9 100%);
  222. border-radius: 4upx;
  223. margin-right: 10upx;
  224. font-size: 22upx;
  225. font-family: PingFang SC;
  226. font-weight: bold;
  227. color: #FFFFFF;
  228. line-height: 30upx;
  229. float: left;
  230. margin-top: 7upx;
  231. }
  232. }
  233. .spec{
  234. margin-top: 10upx;
  235. font-size: 24upx;
  236. font-family: PingFang SC;
  237. font-weight: 500;
  238. color: #999999;
  239. line-height: 1;
  240. }
  241. .price-num{
  242. display: flex;
  243. align-items: center;
  244. justify-content: space-between;
  245. .price{
  246. display: flex;
  247. align-items: flex-end;
  248. .unit{
  249. font-size: 24upx;
  250. font-family: PingFang SC;
  251. font-weight: 500;
  252. color: #111111;
  253. line-height: 1.2;
  254. margin-right: 4upx;
  255. }
  256. .num{
  257. font-size: 32upx;
  258. font-family: PingFang SC;
  259. font-weight: 500;
  260. color: #111111;
  261. line-height: 1;
  262. }
  263. }
  264. .num{
  265. font-size: 24upx;
  266. font-family: PingFang SC;
  267. font-weight: 500;
  268. color: #999999;
  269. line-height: 1;
  270. }
  271. }
  272. }
  273. }
  274. .sub-total{
  275. height: 88upx;
  276. display: flex;
  277. align-items: center;
  278. justify-content: flex-end;
  279. .label{
  280. font-size: 24upx;
  281. font-family: PingFang SC;
  282. font-weight: 500;
  283. color: #999999;
  284. }
  285. .price{
  286. display: flex;
  287. align-items: flex-end;
  288. .unit{
  289. font-size: 24upx;
  290. font-family: PingFang SC;
  291. font-weight: 500;
  292. color: #FF6633;
  293. line-height: 1.2;
  294. margin-right: 4upx;
  295. }
  296. .num{
  297. font-size: 32upx;
  298. font-family: PingFang SC;
  299. font-weight: bold;
  300. color: #FF6633;
  301. line-height: 1;
  302. }
  303. }
  304. }
  305. }
  306. .points{
  307. height: 88upx;
  308. padding: 0 30upx;
  309. background: #FFFFFF;
  310. border-radius: 16upx;
  311. display: flex;
  312. align-items: center;
  313. justify-content: space-between;
  314. .left{
  315. display: flex;
  316. align-items: center;
  317. image{
  318. width: 28upx;
  319. height: 28upx;
  320. margin-right: 20upx;
  321. }
  322. .text{
  323. font-size: 28upx;
  324. font-family: PingFang SC;
  325. font-weight: 500;
  326. color: #666666;
  327. }
  328. }
  329. .right{
  330. display: flex;
  331. align-items: center;
  332. .text{
  333. font-size: 28upx;
  334. font-family: PingFang SC;
  335. font-weight: 500;
  336. color: #111111;
  337. }
  338. image{
  339. margin-left: 15upx;
  340. width: 14upx;
  341. height: 24upx;
  342. }
  343. }
  344. }
  345. .remarks{
  346. height: 88upx;
  347. padding: 0 30upx;
  348. background: #FFFFFF;
  349. border-radius: 16upx;
  350. margin-top: 20upx;
  351. display: flex;
  352. align-items: center;
  353. input{
  354. width: 100%;
  355. font-size: 28upx;
  356. font-family: PingFang SC;
  357. font-weight: 500;
  358. color: #000000;
  359. }
  360. .input{
  361. font-size: 28upx;
  362. font-family: PingFang SC;
  363. font-weight: 500;
  364. color: #999999;
  365. }
  366. }
  367. }
  368. .btn-foot{
  369. box-sizing: border-box;
  370. width: 100%;
  371. height: 121upx;
  372. background: #FFFFFF;
  373. padding: 16upx 30upx;
  374. display: flex;
  375. align-items: center;
  376. justify-content: flex-end;
  377. position: fixed;
  378. left: 0;
  379. bottom: 0;
  380. z-index: 99;
  381. .right{
  382. display: flex;
  383. align-items: center;
  384. .total{
  385. display: flex;
  386. align-items: flex-end;
  387. margin-right: 15upx;
  388. .label{
  389. font-size: 26upx;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. color: #999999;
  393. line-height: 1.5;
  394. }
  395. .price{
  396. display: flex;
  397. align-items: flex-end;
  398. .unit{
  399. font-size: 28upx;
  400. font-family: PingFang SC;
  401. font-weight: bold;
  402. color: #FF6633;
  403. line-height: 1.2;
  404. margin-right: 10upx;
  405. }
  406. .num{
  407. font-size: 32upx;
  408. font-family: PingFang SC;
  409. font-weight: bold;
  410. color: #FF6633;
  411. line-height: 1;
  412. }
  413. }
  414. }
  415. .btn{
  416. margin-left: 10rpx;
  417. width: 180upx;
  418. height: 88upx;
  419. line-height: 88upx;
  420. text-align: center;
  421. font-size: 30upx;
  422. font-family: PingFang SC;
  423. font-weight: bold;
  424. color: #FFFFFF;
  425. background: #2BC7B9;
  426. border-radius: 44upx;
  427. position: relative;
  428. .share{
  429. display: inline-block;
  430. position: absolute;
  431. top: 0;
  432. left: 0;
  433. width: 100%;
  434. height: 100%rpx;
  435. opacity: 0;
  436. }
  437. }
  438. }
  439. }
  440. </style>