commodityDetails.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <view>
  3. <view style="width: 100%;height: 750rpx;">
  4. <image :src="form.filesList[0].url" mode="aspectFit" style="width: 100%;height: 750rpx;"
  5. @click="previewImage()" />
  6. </view>
  7. <view style="background-color: #fff;padding: 43rpx 65rpx;margin-bottom: 20rpx;">
  8. <view style="display: flex;justify-content: space-between;">
  9. <view style="display: flex;color: #E75F37;font-size: 40rpx;align-items: flex-end;">
  10. <view style="font-size: 26rpx;height: 40rpx;">
  11. </view>
  12. <view style="font-size: 40rpx;">
  13. {{ checkStatus == '通过' ? form.mallPrice|| 0 :'***'}}
  14. </view>
  15. </view>
  16. <view style="display: flex;align-items: center;">
  17. <view style="display: flex;margin-right: 10rpx;">
  18. <image v-if="Number(inventoryDataForm.storeInventory)" src="/static/images/tabBar/11.png"
  19. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  20. <image v-if="Number(inventoryDataForm.storeInventory)==0" src="/static/images/tabBar/14.png"
  21. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  22. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  23. 库存:{{ inventoryDataForm.storeInventory ? Number(inventoryDataForm.storeInventory) > 10 ? '充足' : inventoryDataForm.storeInventory : '' }}
  24. </view>
  25. </view>
  26. <view style="display: flex;align-items: center;">
  27. <image v-if="Number(inventoryDataForm.storeInventoryShare)" src="/static/images/tabBar/12.png"
  28. mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  29. <image v-if="Number(inventoryDataForm.storeInventoryShare)==0"
  30. src="/static/images/tabBar/15.png" mode="aspectFit" style="width: 102rpx;height: 36rpx;" />
  31. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 10rpx;">
  32. 库存:{{ inventoryDataForm.storeInventoryShare ? Number(inventoryDataForm.storeInventoryShare) > 10 ? '充足' : inventoryDataForm.storeInventoryShare : '' }}
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="retailPrice" v-if="form.suggestedRetailPrice">
  38. 建议零售价:¥{{form.suggestedRetailPrice}}
  39. </view>
  40. <view style="margin-top: 14rpx;">
  41. <u--text :text="form.cname" size="26rpx" color='#797979' lines="2"></u--text>
  42. </view>
  43. <view style="display: flex;justify-content: space-between;margin-top: 8rpx;align-items: center;">
  44. <view style="font-size: 24rpx;color: #C4C4C4;">
  45. 库存:{{ form.inventory ? Number(form.inventory) > 10 ? '充足' : form.inventory : '' }}
  46. </view>
  47. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory" buttonSize="53rpx" color="#414141"
  48. bgColor="#fff" iconStyle="color:#A4A4A4"></u-number-box>
  49. </view>
  50. <view style="display: flex;;margin-top: 8rpx;align-items:center;" v-for="(item, index) in inventoryData"
  51. :key="index">
  52. <view style="display: flex;align-items: center;">
  53. <view style="border-radius: 10rpx;border: 2rpx solid #F6744D;font-size: 26rpx;color: #E75F37;">
  54. {{item.storageName}}
  55. </view>
  56. <view style="font-size: 24rpx;color: #C4C4C4;margin-left: 35rpx;">
  57. 库存:{{Number(item.storeInventory) > 10 ? '充足' : Number(item.storeInventory)}}
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view style="background-color: #fff;padding:62rpx 62rpx 37rpx 62rpx;margin-bottom: 20rpx;">
  63. <view style="font-weight: 400;font-size: 26rpx;color: #797979;" v-show="arrow">
  64. <view style="display: flex;justify-content: space-between;">
  65. <view>
  66. 规格型号:{{ form.specificationAndModel||'-' }}
  67. </view>
  68. <view>
  69. 花纹:{{ form.brandItem || '-' }}
  70. </view>
  71. </view>
  72. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  73. <view>
  74. 产地:{{ form.placeProduction || '-' }}
  75. </view>
  76. <view>
  77. 防爆:{{ form.explosionProof == 1 ? "是" : "否" }}
  78. </view>
  79. </view>
  80. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  81. <view>
  82. 原厂:{{ form.originalFactory == 1 ? '是' : '否' }}
  83. </view>
  84. <view>
  85. 自修复:{{ form.selfRecovery == 1 ? '是' : '否' }}
  86. </view>
  87. </view>
  88. <view style="display: flex;justify-content: space-between;margin-top: 52rpx;">
  89. <view>
  90. 商品描述:{{ form.goodsDescription || '-' }}
  91. </view>
  92. </view>
  93. </view>
  94. <view style="display: flex;justify-content: center;margin-top: 49rpx;" @click="arrow = !arrow">
  95. <image v-if="arrow" src="/static/images/tabBar/10.png" mode="aspectFit"
  96. style="width: 33rpx;height: 26rpx;" />
  97. <image v-if="!arrow" src="/static/images/tabBar/10.png" mode="aspectFit"
  98. style="width: 33rpx;height: 26rpx;transform: rotate(180deg)" />
  99. </view>
  100. </view>
  101. <view style="background-color: #fff;padding:40rpx 62rpx;margin-bottom: 20rpx;">
  102. <view style="font-weight: 400;font-size: 30rpx;color: #F6744D;">
  103. 商品详情
  104. </view>
  105. </view>
  106. <view style="width: 100%;background-color: #fff;">
  107. <view v-html="form.detailsText"></view>
  108. </view>
  109. <view class="text-bottom">
  110. </view>
  111. <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;border-top:2rpx #F2F2F2 solid;"
  112. class="dynamic-bottom">
  113. <view style="display: flex;justify-content: space-around;align-items: center;">
  114. <view style="width: 71rpx;display: flex;flex-direction: column;align-items: center;"
  115. @click="shoppingCart">
  116. <view class="">
  117. <image src="/static/images/tabBar/16.png" mode="aspectFit"
  118. style="width: 31rpx;height: 28rpx;" />
  119. </view>
  120. <view style="font-size: 24rpx;color: #797979;">
  121. 购物车
  122. </view>
  123. </view>
  124. <view style="width:360rpx;">
  125. <u-button v-if="form.inventory > 0" type="primary" @click="placeAnOrder" text="加入购物车"
  126. color="#E75F37" shape='circle'></u-button>
  127. <u-button v-if="form.inventory == 0" type="primary" @click="soldOut" text="已售罄" color="#c8c9cc"
  128. shape='circle'></u-button>
  129. </view>
  130. </view>
  131. </view>
  132. <!-- 提取去登录 -->
  133. <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
  134. @cancel="adminShow = false"></u-modal>
  135. </view>
  136. </template>
  137. <script>
  138. import {
  139. appDetail,
  140. appDetailNew,
  141. addToCart,
  142. appModifyPrice,
  143. stockDescList,
  144. stockDescListV1,
  145. listShareV1,
  146. isProcurement
  147. } from '@/api/tabBar/homeNew.js'
  148. export default {
  149. data() {
  150. return {
  151. inventoryDataForm: {},
  152. checkboxValue: [],
  153. form: {
  154. shareList: []
  155. },
  156. arrow: true,
  157. dataList: [],
  158. screen: {},
  159. columns: [],
  160. keyName: '',
  161. showWarehouse: false,
  162. dataForm: {
  163. thisLocality: {},
  164. offsite: {}
  165. },
  166. inventoryFalse: true,
  167. inventoryData: [],
  168. // 审核状态
  169. checkStatus: '',
  170. adminShow: false,
  171. }
  172. },
  173. onLoad(onLoad) {
  174. this.checkStatus = uni.getStorageSync('checkStatus');
  175. if (uni.getStorageSync('whether_openShare') == 1) {
  176. appDetailNew(onLoad).then(res => {
  177. this.dataForm = res.data
  178. if (res.data.type == 0) {
  179. this.form = res.data.thisLocality
  180. } else {
  181. this.form = res.data.offsite
  182. }
  183. this.form.goodsNum = Number(this.form.goodsNum)
  184. this.stockDescListfun()
  185. })
  186. } else {
  187. appDetail(onLoad).then(res => {
  188. this.dataForm = res.data
  189. if (res.data.type == 0) {
  190. this.form = res.data.thisLocality
  191. } else {
  192. this.form = res.data.offsite
  193. }
  194. this.form.goodsNum = Number(this.form.goodsNum)
  195. this.stockDescListfun()
  196. })
  197. }
  198. },
  199. methods: {
  200. previewImage() {
  201. uni.previewImage({
  202. current: 0, // 当前显示图片的索引,默认是0
  203. urls: [this.form.filesList[0].url] // 需要预览的图片HTTP链接列表
  204. });
  205. },
  206. // admin确认
  207. adminConfirm() {
  208. uni.clearStorageSync();
  209. uni.redirectTo({
  210. url: '/pages/login/login'
  211. })
  212. },
  213. // 轮播图点击预览
  214. swiperclick(e) {
  215. let arr = this.form.filesList.map(item => {
  216. return item.url
  217. })
  218. uni.previewImage({
  219. count: arr[e],
  220. current: e,
  221. urls: arr
  222. })
  223. },
  224. inventoryFalsefun() {
  225. this.inventoryFalse = !this.inventoryFalse
  226. this.stockDescListfun()
  227. },
  228. // 库存查询
  229. stockDescListfun() {
  230. listShareV1({
  231. code: uni.getStorageSync('whether_openShare') == 1 ? this.form.goodsCode : this.form.code,
  232. id: this.form.id,
  233. whether: 0
  234. }).then(res => {
  235. this.inventoryDataForm = res.data
  236. })
  237. stockDescListV1({
  238. cname: this.form.cname,
  239. whether: 0
  240. }).then(res => {
  241. this.inventoryData = res.data.records
  242. })
  243. },
  244. soldOut() {
  245. uni.showToast({
  246. icon: "none",
  247. title: '商品已售罄',
  248. mask: true
  249. });
  250. },
  251. backToHome() {
  252. uni.$u.route({
  253. url: 'pages/tabBar/home',
  254. type: "switchTab"
  255. })
  256. },
  257. // 加入购物车
  258. placeAnOrder() {
  259. if (uni.getStorageSync('userInfo').tenant_id == '000000') {
  260. this.adminShow = true
  261. return
  262. }
  263. if (this.inventoryDataForm.storeInventory == 0 && this.inventoryDataForm.storeInventoryShare > 0) {
  264. let _this = this
  265. uni.showModal({
  266. title: '提示',
  267. content: '确实要购买次日达商品吗?',
  268. success: function(res) {
  269. if (res.confirm) {
  270. uni.showLoading({
  271. title: '加载中',
  272. mask: true
  273. });
  274. addToCart({
  275. ..._this.form,
  276. whetherIntegral: '0',
  277. detailsText: ''
  278. }).then(res => {
  279. uni.hideLoading();
  280. uni.showToast({
  281. title: "加入购物车成功",
  282. icon: "none",
  283. });
  284. }).catch(err => {
  285. uni.hideLoading();
  286. })
  287. }
  288. }
  289. });
  290. }
  291. if (this.inventoryDataForm.storeInventory > 0) {
  292. uni.showLoading({
  293. title: '加载中',
  294. mask: true
  295. });
  296. addToCart({
  297. ...this.form,
  298. whetherIntegral: '0',
  299. detailsText: ''
  300. }).then(res => {
  301. uni.hideLoading();
  302. uni.showToast({
  303. title: "加入购物车成功",
  304. icon: "none",
  305. });
  306. }).catch(err => {
  307. uni.hideLoading();
  308. })
  309. }
  310. },
  311. filterAll(screen) {
  312. this.screen = screen
  313. switch (screen[1]) {
  314. case "salesCompanyId":
  315. this.columns = [this.form.shareList]
  316. this.keyName = screen[1]
  317. this.showWarehouse = true
  318. break
  319. }
  320. },
  321. confirmWarehouse(e) {
  322. appModifyPrice({
  323. id: e.value[0].id
  324. }).then(res => {
  325. this.form.salesCompanyName = e.value[0].salesCompanyName
  326. this.form.salesCompanyId = e.value[0].salesCompanyId
  327. this.form.mallPrice = res.data.mallPrice
  328. this.form.inventory = res.data.inventory
  329. this.showWarehouse = false
  330. })
  331. },
  332. shoppingCart() {
  333. uni.$u.route({
  334. url: 'pages/tabBar/shoppingCart',
  335. type: "switchTab"
  336. })
  337. }
  338. }
  339. }
  340. </script>
  341. <style lang="scss" scoped>
  342. ::v-deep .u-number-box {
  343. border: 2rpx #E1E1E1 solid;
  344. border-radius: 8rpx;
  345. }
  346. ::v-deep .u-number-box__minus {
  347. border-right: 2rpx #E1E1E1 solid;
  348. }
  349. ::v-deep .u-number-box__plus {
  350. border-left: 2rpx #E1E1E1 solid;
  351. }
  352. ::v-deep .u-button {
  353. height: 60rpx;
  354. }
  355. .dynamic-bottom {
  356. padding: 20rpx 20rpx 0 20rpx;
  357. padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
  358. }
  359. .text-bottom {
  360. height: calc(env(safe-area-inset-bottom) + 126rpx);
  361. }
  362. .retailPrice {
  363. display: flex;
  364. color: #909399;
  365. font-size: 22rpx;
  366. height: 28rpx;
  367. }
  368. </style>