confirmCompanyOrder.vue 9.3 KB

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