confirmCompanyOrder.vue 9.8 KB

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