confirmCompanyOrder.vue 10 KB

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